maxfield icon indicating copy to clipboard operation
maxfield copied to clipboard

makePlan.py script

Open whytecrow opened this issue 8 years ago • 7 comments

I cannot find the script, am I the only one? Running the example gives me the "No such file or directory" error. I'm lost..

whytecrow avatar Jun 03 '16 12:06 whytecrow

You're right. I thought I corrected the documentation when "makePlan.py" was renamed "maxfield.py". I'll fix it now. Thanks!

jpeterbaker avatar Jun 03 '16 12:06 jpeterbaker

Thanks for a quick reply, anyway, the script fails with complaints about parentheses. I think it's due recent python version (3.5) - obviously the print statement needs the arguments closed in parentheses. After correcting that, the script cannot import geometry module.. This is a little bit beyond my knowledge - the file is in lib as well as the other passed to the import command.

Corrected files:

maxfield.py35.txt lib.maxfield.py35.txt

whytecrow avatar Jun 03 '16 19:06 whytecrow

I very unwisely had two files named "maxfield.py" in the project, but since one was tucked away in lib, I thought it wouldn't matter. I've changed one to lib/makeFields.py. Get this version and make sure you're running maxfield.py and not something that's in the lib directory. Does that solve your problems?

jpeterbaker avatar Jun 06 '16 02:06 jpeterbaker

No. I'm sorry to say. I didn't run the lib/maxfield.py script, either.

$ python maxfield.py -n 4 EXAMPLE.csv output/ output.pkl 
Traceback (most recent call last):
  File "maxfield.py", line 27, in <module>
    from lib import makeFields,PlanPrinter,geometry,agentOrder
  File "/home/mine/maxfield/lib/makeFields.py", line 23, in <module>
    import geometry
ImportError: No module named 'geometry'

So I added "from lib" to all imported scripts, et voila..

$ python maxfield.py -n 4 EXAMPLE.csv output/ output.pkl 
Maxfield Copyright (C) 2015 Jonathan Baker: [email protected]
Traceback (most recent call last):
  File "maxfield.py", line 251, in <module>
    sys.exit(main())
  File "maxfield.py", line 153, in main
    for i in xrange(n):
NameError: name 'xrange' is not defined

whytecrow avatar Jun 07 '16 09:06 whytecrow

maxfield uses python2 (2.7.11 or so). It will not work with python3.

$ python2 --version Python 2.7.11

$ python2 maxfield.py ...

mvinni avatar Jun 07 '16 09:06 mvinni

Yeah! That's it. I didn't know that the 2.7 version was installed as well. I'll have to install 2.7 libs. xrange function was replaced by range in 3.0... Little more hacking and it will work!

whytecrow avatar Jun 07 '16 10:06 whytecrow

Thanks! I've barely touched Python 3, but I didn't think that could be the whole problem.

jpeterbaker avatar Jun 07 '16 16:06 jpeterbaker