1

我想知道当我从 PyCharm 或从命令行运行 python 程序时有什么区别。

实际上我正在使用一个名为 wand-py 的库(ImageMagick 绑定)。

如果我从命令行运行我的程序,它就可以工作。

虽然如果我使用 PyCharm Run 或调试它不会,我会得到以下回溯。

/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

我在终端和 PyCharm 中使用相同的虚拟环境。

你们知道什么可能导致问题吗?

谢谢,

亚历克西斯。

4

0 回答 0