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 1933
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: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
| |