Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config
On 3/28/2017 11:59 AM, vishnupras...@gmail.com wrote: I capture following error in apache logs. AH01215: from PIL import Image: /var/www/images/index.py AH01215: ImportError: No module named PIL: /var/www/images/index.py A general response to this particular message is a) check spelling in code matches actual filename b) check search path "import sys; print(sys.path)" and then see if the path contains the directory actually containing the module For this specific case, follow Chris's advice. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config
On 28/03/2017 18:35, Chris Angelico wrote: On Wed, Mar 29, 2017 at 3:32 AM, Karimwrote: On 28/03/2017 18:05, Chris Angelico wrote: On Wed, Mar 29, 2017 at 2:59 AM, wrote: Please help if this wont resolve, I have to completely move away from python. How about, instead, moving away from CGI? Switch to Apache's modpython. I've deployed several Python-based web sites without difficulties. ChrisA Ah ok. What do you think of Django? (Bouncing back to the list because I think the private message was unintentional. Apologies if I'm misreading your intentions.) Not hugely experienced with Django; I mainly use Flask. But they're fairly similar in style and structure. Either way, you make yourself an importable package/module that has all your code in it, and then you set up WSGI so that Apache can call on you. ChrisA Thank you Chris! -- https://mail.python.org/mailman/listinfo/python-list
Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config
On Wed, Mar 29, 2017 at 3:32 AM, Karimwrote: > > On 28/03/2017 18:05, Chris Angelico wrote: >> >> On Wed, Mar 29, 2017 at 2:59 AM, wrote: >>> >>> Please help if this wont resolve, I have to completely move away from >>> python. >> >> How about, instead, moving away from CGI? Switch to Apache's >> modpython. I've deployed several Python-based web sites without >> difficulties. >> >> ChrisA > > > Ah ok. What do you think of Django? (Bouncing back to the list because I think the private message was unintentional. Apologies if I'm misreading your intentions.) Not hugely experienced with Django; I mainly use Flask. But they're fairly similar in style and structure. Either way, you make yourself an importable package/module that has all your code in it, and then you set up WSGI so that Apache can call on you. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config
On Wed, Mar 29, 2017 at 2:59 AM,wrote: > Please help if this wont resolve, I have to completely move away from python. How about, instead, moving away from CGI? Switch to Apache's modpython. I've deployed several Python-based web sites without difficulties. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config
What did you do? I have configured in apache httpd.conf - enabling of mod_cgi.so and httpd-vhosts.conf. In httpd-vhosts have following conifguration. Basically am trying to capture all /images/ pattern, read have that process using a index.py script and return back as image/jpeg content. ServerAdmin abc@bbc.com ServerName www.groc-example.com ServerAlias groc-example.com Alias "/images/" "/var/www/images/" DirectoryIndex index.py ErrorLog "/private/var/log/apache2/groc-example-images-error_log" CustomLog "/private/var/log/apache2/groc-access-log" common Options +ExecCGI Allow from all Require all granted ForceType text/html AddHandler cgi-script .py In the index.py am just trying to start the script by trying to import the image. It doenst work i.e. recognize at all. The same import of PIL works from python2/python3 interface in spyder or pycharm or commandlines. If I remove PIL import statement, the html works or prints out to browser. #! /usr/bin/env python from PIL import Image print "" print "hello world" print "--" print "" What did you expect to happen? python script to recognize PIL but it doesnt recognize. I have uninstalled PIL-SIMD multiple times and reinstalled but it isnt working. Though I have both python2 and python3, default am using python2 and so is apache CGI interface. What actually happened? I capture following error in apache logs. AH01215: from PIL import Image: /var/www/images/index.py AH01215: ImportError: No module named PIL: /var/www/images/index.py What versions of Pillow and Python are you using? Python 2.7.12 Pillow-SIMD Pillow-SIMD (4.0.0.post0) Please help if this wont resolve, I have to completely move away from python. -- https://mail.python.org/mailman/listinfo/python-list