electronut / pp

Code for book Python Playground by Mahesh Venkitachalam (No Starch Press, USA)
564 stars 500 forks source link

Difficulty with volrender.py #14

Closed jbraench closed 6 years ago

jbraench commented 6 years ago

I am using Spyder (Python 2.7) with Anaconda and trying to get volrender.py to work. I had to make one change. Anaconda likes pyglfw so i loaded this and changed 'import glfw' to 'import pyglfw as glfw'. This works.

Now when i try to compile and run, i get the following error: Reloaded modules: raycube, volreader, glutils, slicerender, raycast starting volrender... usage: volrender.py [-h] --dir IMAGEDIR volrender.py: error: argument --dir is required An exception has occurred, use %tb to see the full traceback. SystemExit: 2 entering %tb i get: %tb Traceback (most recent call last): File "/Users/jamesbranch/anacondaPython2.7/anaconda/lib/python2.7/site-packages/spyder/utils/ipython/start_kernel.py", line 198, in main locals().pop('file') KeyError: 'file'

I would be most appreciative if i could get some advice on how to fix this.

electronut commented 6 years ago

usage: volrender.py [-h] --dir IMAGEDIR

Looks like you are not specifying the image directory?

electronut commented 6 years ago

Please post your output on specifying the image directory as mentioned in the book.

electronut commented 6 years ago

Closing till I get further feedback.

kyuty commented 5 years ago

I solve it. plz(add some args for parser.parse_args):

print('starting volrender...')
# create parser
parser = argparse.ArgumentParser(description="Volume Rendering...")
# add expected arguments
parser.add_argument('--dir', dest='imageDir', required=True)
# parse args
args = parser.parse_args('--dir sphere-cuboid'.split())