Reputation: 315
I just add django-simple-captcha into my apache2.2+django1.8 project
in python command line
from PIL.Image import *
didn't show any error
and I have already set all the files in Python2.7/site-packages to chmod 777
but when I start server and request some page
there will be error logs:
mod_wsgi (pid=16530): Exception occurred processing WSGI script '/root/code/python/mysite/mysite/wsgi.py'.,
Traceback (most recent call last):, referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__,
response = self.get_response(request), referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 218, in get_response,
response = self.handle_uncaught_exception(request, resolver, sys.exc_info()), referer:
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 264, in
if resolver.urlconf_module is None:, referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 396, in urlconf_module,
self._urlconf_module = import_module(self.urlconf_name), referer: http://xx.xx.xx.xx/
File "/usr/local/python27/lib/python2.7/importlib/__init__.py", line 37, in import_module, referer:
__import__(name), referer: http://xx.xx.xx.xx/
File "/root/code/python/mysite/mysite/urls.py", line 38, in <module>, referer: http://xx.xx.xx.xx/
url(r'^captcha/', include('captcha.urls')),, referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 33, in include, referer:
urlconf_module = import_module(urlconf_module), referer: http://xx.xx.xx.xx/
File "/usr/local/python27/lib/python2.7/importlib/__init__.py", line 37, in import_module, referer:
__import__(name), referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/captcha/urls.py", line 6, in <module>, referer:
from captcha import views, referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/captcha/views.py", line 21, in <module>, referer:
import Image, referer: http://xx.xx.xx.xx/
File "/usr/local/lib/python2.7/site-packages/Image.py", line 1, in <module>, referer: http://xx.xx.xx.xx/
from PIL.Image import *, referer: http://xx.xx.xx.xx/
ImportError: No module named PIL.Image, referer: http://xx.xx.xx.xx/
Can anybody help me ?
Upvotes: 0
Views: 1360
Reputation: 75
You should add manually PIL library source in your root path of project.
Download source here http://www.pythonware.com/products/pil/#pil117 and copy PIL
directory to your project.
Upvotes: 1
Reputation: 1323
PIL is not imported as PIL, you just need to import Image directly
import Image
or
from Image import *
Upvotes: 0