Image.open() cannot identify image file in python script file -


i trying execute script

from pil import image im = image.open("image.jpg") nx, ny = im.size 

it working fine when run in python shell

pytesser_v0.0.1]#env python >>> pil import image >>> im = image.open("image.jpg") <pil.jpegimageplugin.jpegimagefile image mode=rgb size=46x24 @ 0x7fa4688f16d0> 

but when put in test.py file , run python test.py getting error

file "test1.py", line 17, in <module>     im = image.open("image.jpg")   file "/usr/local/python.2.7.11/lib/python2.7/site-packages/pil/image.py", line 2309, in open     % (filename if filename else fp)) ioerror: cannot identify image file 'image.jpg' 

please me issue, thanks

ps: earlier installed pil imaging-1.1.7 setup.py, later installed pillow, think problem in mutual presence of pil , pillow library on machine.

make sure "image.jpg" in same directory "test1.py".

if isn't either move it, or put correct directory inside of image.open().


Comments

Popular posts from this blog

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

javascript - Laravel datatable invalid JSON response -