python - Wand and ghostscript issue on PyCharm -


so have installed wand, ghostscript, imagemagick. trying convert pdf image. code following.

code:

from wand.image import image image_pdf = image(filename="/<fullpath>/xyz.pdf", resolution=500) image_jpeg = image_pdf.convert('jpeg') print (len(image_jpeg.sequence)) 

when run code through terminal (i mean open python terminal , paste code there), works. same code fails in pycharm.

error:

file "/usr/local/lib/python2.7/site-packages/wand/resource.py", line 222, in raise_exception raise e wand.exceptions.delegateerror: failedtoexecutecommand `'gs' -sstdout=%stderr -dquiet -dsafer -dbatch -dnopause -dnoprompt -dmaxbitmap=500000000 -daligntopixels=0 -dgridfittt=2 '-sdevice=pngalpha' -dtextalphabits=4 -dgraphicsalphabits=4 '-r500x500'  '-soutputfile=/var/folders/61/7q0vknr92mndbbgzqvsk3xl4r4yw3f/t/magick-24738xypz5ldqnatj%d' '-f/var/folders/61/7q0vknr92mndbbgzqvsk3xl4r4yw3f/t/magick-24738tr70pw391vdt' '-f/var/folders/61/7q0vknr92mndbbgzqvsk3xl4r4yw3f/t/magick-24738wi4q1lv6aich'' (1) @ error/pdf.c/invokepdfdelegate/292 exception typeerror: typeerror("object of type 'nonetype' has no len()",) in <bound method image.__del__ of <wand.image.image: (empty)>> ignored 

i checked python version in terminal which python2 , /usr/local/bin/python2

my pycharm pythton interpreter located @ /usr/local/cellar/python/2.7.13_1/....

what missing here?

you should isolate python environment system python (and yes, homebrew installation considered system python installation too) using virtualenvwrapper.

from i'm seeing, python system using not same python pycharm using. while can fixed going settings > project interpreter , selecting right path interpreter...

enter image description here

...it best ensure install of necessary dependencies project needs in isolated virtual environment instead.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -