I've installed mod_python, and everything seems to be working, but it
fails when I try to import another file into the file that's actually
producing the output. I have these lines at the top of index.py:
from mod_python import apache
from storylab import *
.... and in the directory where index.py resides (/htdocs/python/), I
have a directory called "storylab". Inside that directory is
__init__.py. When I try to execute /htdocs/python/index.py, I get the
following error:
---
MOD_PYTHON ERROR
ProcessId: 828
Interpreter: 'localhost'
ServerName: 'localhost'
DocumentRoot: 'C:/htdocs'
URI: '/python/index.py'
Location: None
Directory: 'C:/htdocs/python/'
Filename: 'C:/htdocs/python/index.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'index'
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
296, in import_module
log, import_path)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
680, in import_module
execfile(file, module.__dict__)
File "C:\htdocs\python\index.py", line 2, in <module>
from storylab import *
ImportError: No module named storylab
---
What am I doing wrong? Any insight would be greatly appreciated.
Thanks,
Aaron 2 2028
Aaron Scott wrote:
I've installed mod_python, and everything seems to be working, but it
fails when I try to import another file into the file that's actually
producing the output. I have these lines at the top of index.py:
from mod_python import apache
from storylab import *
... and in the directory where index.py resides (/htdocs/python/), I
have a directory called "storylab". Inside that directory is
__init__.py. When I try to execute /htdocs/python/index.py, I get the
following error:
---
MOD_PYTHON ERROR
ProcessId: 828
Interpreter: 'localhost'
ServerName: 'localhost'
DocumentRoot: 'C:/htdocs'
URI: '/python/index.py'
Location: None
Directory: 'C:/htdocs/python/'
Filename: 'C:/htdocs/python/index.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'index'
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
296, in import_module
log, import_path)
File "C:\Python25\lib\site-packages\mod_python\importer.py", line
680, in import_module
execfile(file, module.__dict__)
File "C:\htdocs\python\index.py", line 2, in <module>
from storylab import *
ImportError: No module named storylab
---
What am I doing wrong? Any insight would be greatly appreciated.
You need to tell python that it should add the path your storylab-module is
residing in to the sys.path-list of module locations.
There are a bunch of ways to do so:
- in your main-script, import sys, and append the proper path to sys.path
- add a .pth-file into python's site-packages that points to the location
- set the environment variable PYTHONPATH
- use distutils or setuptools to proper install the module.
Google will help you to find additional information about the above
mentioned concepts.
Diez
On Jul 22, 3:30*am, Aaron Scott <aaron.hildebra...@gmail.comwrote:
I've installedmod_python, and everything seems to be working, but it
fails when I try to import another file into the file that's actually
producing the output. I have these lines at the top of index.py:
frommod_pythonimport apache
from storylab import *
... and in the directory where index.py resides (/htdocs/python/), I
have a directory called "storylab". Inside that directory is
__init__.py. When I try to execute /htdocs/python/index.py, I get the
following error:
---
MOD_PYTHONERROR
ProcessId: * * *828
Interpreter: * *'localhost'
ServerName: * * 'localhost'
DocumentRoot: * 'C:/htdocs'
URI: * * * * * *'/python/index.py'
Location: * * * None
Directory: * * *'C:/htdocs/python/'
Filename: * * * 'C:/htdocs/python/index.py'
PathInfo: * * * ''
Phase: * * * * *'PythonHandler'
Handler: * * * *'index'
Traceback (most recent call last):
* File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
* * default=default_handler, arg=req, silent=hlist.silent)
* File "C:\Python25\lib\site-packages\mod_python\importer.py", line
1202, in _process_target
* * module = import_module(module_name, path=path)
* File "C:\Python25\lib\site-packages\mod_python\importer.py", line
296, in import_module
* * log, import_path)
* File "C:\Python25\lib\site-packages\mod_python\importer.py", line
680, in import_module
* * execfile(file, module.__dict__)
* File "C:\htdocs\python\index.py", line 2, in <module>
* * from storylab import *
ImportError: No module named storylab
---
What am I doing wrong? Any insight would be greatly appreciated.
You can't put Python packages in same directory as handler scripts
managed by mod_python. See documentation for import_module() in: http://www.modpython.org/live/curren...pi-apmeth.html
Graham This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lorenz Köhl |
last post by:
hi,
I've python 2.3 and apache 2.0.47 installed on my SuSE8.2.
when trying to compile modpython into apache, make stops with the error
----
In file included from...
|
by: Michele Petrazzo |
last post by:
I'm using PyChart like a module for create charts into a little web
site, but when I try to create one, I have this error:
/var/www/html/lgt/draw.py:19, in draw:
can =...
|
by: Julien Cigar |
last post by:
Hello,
I'm using mod_python 3.1.3 with Apache 2.0.54 on a Debian box with the
publisher handler and the Clearsilver template engine, and from time to
time apache returns an 500 error code...
|
by: jcharth |
last post by:
Hello for somereason when i execute php files in folder other than the
document root, i get error 500 and the php file is downloaded to my
browser with the 500 error code. I think it could be...
|
by: Mark |
last post by:
Good morning.
I recently made some changes to my Access project, and I introduced
some problems that I could not resolve. So I deleted the forms that I had
altered and saved the project. Then I...
|
by: T. Crane |
last post by:
Hi,
When troubleshooting code that's saved in a text file, I often find that I
want to make a change to it, re-save it, then reimport it. However, just
typing
import myTestCode
doesn't...
|
by: deepak |
last post by:
I installed apache 2.2.4 and modPython 3.3.1 on Fc6
while starting the apache server the following error occurs:
httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf:
Cannot load...
|
by: Paul Rudin |
last post by:
I'm occasionally seeing tracebacks like this:
Traceback (most recent call last):
File "logging/__init__.py", line 744, in emit
File "logging/__init__.py", line 630, in format
File...
|
by: Martin P. Hellwig |
last post by:
Hello all,
I had some troubles in the past how to arrange my packages and modules,
because I usually don't develop my stuff in the Lib\site-packages
directory I have some troubles when importing...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |