-1

I just fork clone a repo inconvergent/hyphae on github to reuse hyphae.py with an update from python2.6 to python2.7 (and then 3.5) I fixed some error due to update but i still have TypeError for now.

Done

Update from python2.6 to pyton2.7.13 by adding () after all print

Fix

File "/home/user/hyphae/hyphae.py", line 378
main()
^
IndentationError: expected an indented block    

By adding 2 whitespace

When do python2.7 /home/user/hyphae/hyphae.py with terminal

()
('filename', 'generations_a')
('SIZE', 15000)
('ZONEWIDTH', 80.0)
('RAD', 0.002666666666666667)
('ZONES', 187)
('one', 6.666666666666667e-05)
Traceback (most recent call last):
File "/home/user/hyphae/hyphae.py", line 378, in <module>
main()
File "/home/user/hyphae/hyphae.py", line 203, in main
R = np.zeros(NMAX,'float')
TypeError: 'float' object cannot be interpreted as an index

I not that few questions were asked about TypeError: 'float' object cannot be interpreted as an index in stackoverflow, e.g Here ot there, but as the noob as i'm, i don't find how to solve the matter.

0

1 Answer 1

2
NMAX = 2*1e7 # maxmimum number of nodes

NMAX is a floating point number. In older versions of numpy, you can call zeros with a float as an argument. But this behavior is deprecated, and no longer works in the most recent version.

Try converting NMAX to an integer.

NMAX = int(2*1e7) # maxmimum number of nodes
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.