ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

cannot load python module that is in different folder #262

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
So here is the code:

# -*- coding: utf-8 -*-
import sys  
import site
site.addsitedir('/SE_controller')  #try to load module from folder
sys.path.append('/opt/hypertable/0.9.5.6/lib/py')
sys.path.append('/opt/hypertable/0.9.5.6/lib/py/gen-py')
sys.path.append('/usr/lib/python2.7/site-packages')     
sys.path.append('/SE_controller') #try to load module from folder
from hypertable.thriftclient import *
from hyperthrift.gen.ttypes import * 
from SE_text_query import * #error
from SE_text_parser import * #error
def application(environ, start_response):
    status = '200 OK' 
    output = 'Hello World!'     
    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    text='asdasdasd' 

    return [output]

The error log:

[Thu Apr 12 15:54:14 2012] [warn] mod_wsgi: Compiled for Python/2.7.2rc1.
[Thu Apr 12 15:54:14 2012] [warn] mod_wsgi: Runtime using Python/2.7.2+.
[Thu Apr 12 15:54:14 2012] [notice] Apache/2.2.20 (Ubuntu) mod_wsgi/3.3 
Python/2.7.2+ configured -- resuming normal operations
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1] mod_wsgi (pid=7971): 
Target WSGI script '/home/baddc0re/Desktop/htdocs/index.wsgi' cannot be loaded 
as Python module.
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1] mod_wsgi (pid=7971): 
Exception occurred processing WSGI script 
'/home/baddc0re/Desktop/htdocs/index.wsgi'.
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1] Traceback (most recent 
call last):
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1]   File 
"/home/baddc0re/Desktop/htdocs/index.wsgi", line 11, in <module>
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1]     from SE_text_query 
import * #ova e dobro
[Thu Apr 12 15:54:20 2012] [error] [client 127.0.0.1] ImportError: No module 
named SE_text_query

Original issue reported on code.google.com by Dame.Jov...@gmail.com on 12 Apr 2012 at 12:34

GoogleCodeExporter commented 8 years ago
Closing as should have been and is now being dealt with on mailing list.

Original comment by Graham.Dumpleton@gmail.com on 12 Apr 2012 at 11:50