[mod_python] can't import python scripts into my index.py file

Ron Phelps rphelps at redshift.com
Sat Feb 28 19:51:00 EST 2009


I have similar mod_python setups at work and home. The differences are
at work the setup is Ubuntu Gutsy and at home I have Ubuntu Feisty so
the home installation uses 3.2 mod_python and the work 3.3. The other
difference is at home I have apache2 configured for two virtual
websites. The work installation is only one website. 

The problem is I can't import python scripts from index.py on my home
installation but I have no problem at work. Scripts in both
installations are in the home directory of the website.

-------------------
Code example from work, index.py uses a href link to call the following
python script all imports work eps_extract is python script in the same
directory as index.py

from cgi import escape
from urllib import unquote

#Import database and plotting functions
from select import select
import eps_extract

def frame():
	
	s = """\
	...
	html code here
	..."""

    return s

def plots():

	etc ...

------------------------
Code example from home - index.py:
I have tried simply using the import statement as above
and like below. The scripts weatherstation and pexpect are in the same
directory as index.py

import sys, os
from mod_python import apache
weatherstation = apache.import_module("weatherstation")
pexpect  = apache.import_module("pexpect")

Mod_python returns

ImportError: No module named weatherstation


Thanks for any help you can give. 

Ron 




More information about the Mod_python mailing list