Re: package importing
Steven Lott <s_lott-/[email protected]> Thu, 24 Jun 2010 03:11:29 -0700 (PDT)
| Newsgroups | gmane.comp.python.mod_python |
|---|---|
| Message-ID | <[email protected]> |
--===============1202717003== Content-Type: multipart/alternative; boundary="0-259143216-1277374289=:36992" --0-259143216-1277374289=:36992 Content-Type: text/plain; charset=us-ascii You might want to post this question on StackOverflow.com. There are many Python experts there, also. -- S. Lott Whitby 42 #188 -- "Red Ranger" ________________________________ From: Ivan Ricotti <i.ricotti-ZdDpcFUkCv/[email protected]> To: [email protected] Sent: Thu, June 24, 2010 5:43:10 AM Subject: [mod_python] package importing Hello, I'm exploring mod_python and I'm having trouble with the package importing. I've a structure like this: <my base dir> | +- __init__.py +- index.py +- package (directory) | +- __init__.py +- package.py (file) and an Apache Virtual Host like this: <VirtualHost *:80> ServerAdmin root@localhost ServerName myname DocumentRoot /path/to/my base dir <Location /> DirectoryIndex index.html index.py Options Indexes MultiViews FollowSymLinks AddHandler mod_python .py PythonHandler mod_python.publisher </Location> </VirtualHost> in the index.py file I've something like this: from package.package import myobject .... .... When I load index.py from Apache, I get a 500 Internal Server Error as follows: ImportError: No module named package.package What am I doing wrong? Cheers, Ivan -- Ivan Ricotti ------------------------------------------------- eLabor sc - via Giuseppe Garibaldi 33, 56127 Pisa tel: +39 050 970 363, web: http://www.elabor.biz email: i.ricotti-ZdDpcFUkCv/[email protected] GnuPG KeyID: DFD581C5 - 13/11/2003 _______________________________________________ Mod_python mailing list [email protected] http://mailman.modpython.org/mailman/listinfo/mod_python --0-259143216-1277374289=:36992 Content-Type: text/html; charset=us-ascii <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:10pt"><div></div><div>You might want to post this question on StackOverflow.com. There are many Python experts there, also.<br> </div>--<br>S. Lott <br><br><div>Whitby 42 #188 -- "Red Ranger"<div><br></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><br><div style="font-family:arial, helvetica, sans-serif;font-size:13px"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Ivan Ricotti <i.ricotti-ZdDpcFUkCv/[email protected]><br><b><span style="font-weight: bold;">To:</span></b> [email protected]<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, June 24, 2010 5:43:10 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [mod_python] package importing<br></font><br> Hello,<br><br>I'm exploring mod_python and I'm having trouble with the package importing.<br><br>I've a structure like this:<br><br> <my base dir><br> |<br> +- <a target="_blank" href="http://__init__.py">__init__.py</a><br> +- <a target="_blank" href="http://index.py">index.py</a><br> +- package (directory)<br> |<br> +- __init__.py<br> +- <a target="_blank" href="http://package.py">package.py</a> (file)<br><br>and an Apache Virtual Host like this:<br><br><br> <VirtualHost *:80><br><br> ServerAdmin root@localhost<br> ServerName myname<br> DocumentRoot /path/to/my base dir<br><br> &l t;Location /><br> DirectoryIndex index.html index.py<br> Options Indexes MultiViews FollowSymLinks<br> AddHandler mod_python .py<br> PythonHandler mod_python.publisher<br> </Location><br><br> </VirtualHost><br><br>in the index.py file I've something like this:<br><br> from package.package import myobject<br> ....<br> ....<br><br>When I load index.py from Apache, I get a 500 Internal Server Error as<br>follows:<br><br> ImportError: No module named package.package<br><br>What am I doing wrong?<br><br>Cheers,<br>Ivan<br><br>-- <br>Ivan Ricotti <br>---------------------- ---------------------------<br>eLabor sc - via Giuseppe Garibaldi 33, 56127 Pisa<br><span>tel: +39 050 970 363, web: <a target="_blank" href="http://www.elabor.biz">http://www.elabor.biz</a></span><br>email: <a ymailto="mailto:i.ricotti-ZdDpcFUkCv/[email protected]" href="mailto:i.ricotti-ZdDpcFUkCv/[email protected]">i.ricotti-ZdDpcFUkCv/[email protected]</a><br>GnuPG KeyID: DFD581C5 - 13/11/2003<br>_______________________________________________<br>Mod_python mailing list<br><a ymailto="mailto:[email protected]" href="mailto:[email protected]">[email protected]</a><br><span><a target="_blank" href="http://mailman.modpython.org/mailman/listinfo/mod_python">http://mailman.modpython.org/mailman/listinfo/mod_python</a></span><br></div></div></div><div style="position:fixed"></div> </div><br> </body></html> --0-259143216-1277374289=:36992-- --===============1202717003== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Mod_python mailing list [email protected] http://mailman.modpython.org/mailman/listinfo/mod_python --===============1202717003==--