0 Replies - 436 Views - Last Post: 12 April 2012 - 05:51 AM Rate Topic: -----

#1 xenor  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 148
  • Joined: 23-September 09

mod_wsgi import module error

Posted 12 April 2012 - 05:51 AM

I am using python 2.7 and also mod_wsgi is compiled with the same version. I have a module that is in a different folder than index.wsgi and i want to load it.....it is successful if it is in the same dir (i mean for the import that works if they are in the same folder)

So i got the code:

# -*- coding: utf-8 -*-
import sys
import os  
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') # the folder with the modules needer
from hypertable.thriftclient import *
from hyperthrift.gen.ttypes import*   
from SE_controller.SE_text_parser import SE_parse_text #the error
from SE_controller.SE_text_query import SE_text_query #the 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)
    
  
    return [output]




The error:

[Thu Apr 12 16:11:35 2012] [warn] mod_wsgi: Compiled for Python/2.7.2rc1.
[Thu Apr 12 16:11:35 2012] [warn] mod_wsgi: Runtime using Python/2.7.2+.
[Thu Apr 12 16:11:35 2012] [notice] Apache/2.2.20 (Ubuntu) mod_wsgi/3.3 Python/2.7.2+ configured -- resuming normal operations
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1] mod_wsgi (pid=9341): Target WSGI script '/home/baddc0re/Desktop/htdocs/index.wsgi' cannot be loaded as Python module.
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1] mod_wsgi (pid=9341): Exception occurred processing WSGI script '/home/baddc0re/Desktop/htdocs/index.wsgi'.
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1]   File "/home/baddc0re/Desktop/htdocs/index.wsgi", line 10, in <module>
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1]     from SE_controller.SE_text_parser import SE_parse_text
[Thu Apr 12 16:11:39 2012] [error] [client 127.0.0.1] ImportError: No module named SE_controller.SE_text_parser



Is This A Good Question/Topic? 0
  • +

Page 1 of 1