In apache error.log you should see something like: mod_wsgi/3.4 Python/2.7.3 configured
This tells you the version of the python mod_wsgi is loading. You can then fix it if this is incorrect by specifying PYTHONHOME in the apache configuration for mod_wsgi. Please look up the apache mod_wsgi documentation. On Wed, Mar 13, 2013 at 10:29 AM, Smego <[email protected]> wrote: > Thanks. > But please specifically, how to check it? > > > > On Wednesday, March 13, 2013 12:35:20 PM UTC+8, Pradeep Banavara wrote: > >> You don't need to specify absolute paths in the python script when you >> are using mod_wsgi. Just check if mod_wsgi is loading the same version of >> Python as the default python webserver. That might be the issue. >> >> >> On Wed, Mar 13, 2013 at 8:29 AM, smego <[email protected]> wrote: >> >>> Dear all, >>> When run from apache, the import doesn't work by complaining: >>> 3345 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> mod_wsgi (pid=4389): Target WSGI script '/data1/code.py' cannot be loaded >>> as Python module. >>> 3346 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> mod_wsgi (pid=4389): Exception occurred processing WSGI script >>> '/data1/code.py'. >>> 3347 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> Traceback (most recent call last): >>> 3348 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> File "/data1/code.py", line 3, in <module> >>> 3349 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> from config.url import urls >>> 3350 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135] >>> ImportError: No module named config.url >>> When run from web.py server, it works ok. >>> And I resolve that from a online tip: >>> If you get an "ImportError: No module named web" in your apache >>> error.log file, you could try setting the absolute path in code.py before >>> importing web: >>> import sys, os >>> abspath = os.path.dirname(__file__) >>> sys.path.append(abspath) >>> os.chdir(abspath) >>> import web >>> >>> Question is, Why that is happening? Is that a must for apache >>> applications or can be set in some place as default setting? >>> Thank you. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "web.py" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to webpy+un...@**googlegroups.com. >>> To post to this group, send email to [email protected]. >>> >>> Visit this group at >>> http://groups.google.com/**group/webpy?hl=en<http://groups.google.com/group/webpy?hl=en> >>> . >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/webpy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
