Difference running python in PyCharm and in terminal

喜你入骨 提交于 2019-12-24 10:39:21

问题


I'm wondering what is the difference when I run a python program from PyCharm or from the command line.

Actually I'm using a library called wand-py (ImageMagick binding).

If I run my program from the command line it works.

Though if I use PyCharm Run or debug it doesn't and I get the following traceback.

/Users/alexisbenoist/Documents/python/papyrus/env/bin/python "/Applications/PyCharm CE.app/helpers/pydev/pydevd.py" --multiproc --client 127.0.0.1 --port 58993 --file /Users/alexisbenoist/Documents/python/papyrus/tets.py
Connected to pydev debugger (build 135.973)
pydev debugger: process 73166 is connecting

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/helpers/pydev/pydevd.py", line 1733, in <module>
    debugger.run(setup['file'], None, None)
  File "/Applications/PyCharm CE.app/helpers/pydev/pydevd.py", line 1226, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Users/alexisbenoist/Documents/python/papyrus/tets.py", line 23, in <module>
    blob = image_to_blob(PATH)
  File "/Users/alexisbenoist/Documents/python/papyrus/tets.py", line 12, in image_to_blob
    pdf.alpha_channel = False
  File "/Users/alexisbenoist/Documents/python/papyrus/env/lib/python2.7/site-packages/wand/image.py", line 419, in wrapped
    result = function(self, *args, **kwargs)
  File "/Users/alexisbenoist/Documents/python/papyrus/env/lib/python2.7/site-packages/wand/image.py", line 992, in alpha_channel
    self.raise_exception()
  File "/Users/alexisbenoist/Documents/python/papyrus/env/lib/python2.7/site-packages/wand/resource.py", line 218, in raise_exception
    raise e
wand.exceptions.WandError: wand contains no images `MagickWand-1' @ error/magick-image.c/MagickSetImageAlphaChannel/9504

I'm using the same virtual env in the terminal and PyCharm.

Do you guys know what could cause the problem?

Thanks,

Alexis.

来源:https://stackoverflow.com/questions/27484440/difference-running-python-in-pycharm-and-in-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!