[mod_python] PythonImport failure

Chris Hagner CHagner at fool.com
Tue Mar 27 16:02:59 EST 2001


Actually, I was running the latest (2.7.2), but I downloaded the latest from
modpython.org just to be sure.  No change.

BTW, I'll be moving my dev environment to Linux shortly (whew), so I'll let
you know if the same issue persists.  If you have any other ideas, tests,
goose chases... I'm happy to try them out.

Thanks.

Chris

-----Original Message-----
From: Gregory (Grisha) Trubetskoy [mailto:grisha at verio.net]
Sent: Tuesday, March 27, 2001 4:01 PM
To: Chris Hagner
Cc: 'mod_python at modpython.org'
Subject: RE: [mod_python] PythonImport failure



Try the mod_python 2.7.2 DLL and see if the problems persist

Grisha

On Tue, 27 Mar 2001, Chris Hagner wrote:

> A specific question about why PythonImport works for some modules and not
> for others.
>
> 1.  The following statement works.  It compiles/imports apache.py at
server
> startup.
>
> PythonImport mod_python.apache
>
> 2.  Now, when I create a dummy module in mod_python/MyObject.py
>
> def myFunction():
>     return "MyObject.myFunction()"
>
> class MyObject:
>
>     def __init__(self):
>         pass
>
> The following statement does not work.
>
> PythonImport mod_pytnon.MyObject
>
> Here's the error in error.log
> [Tue Mar 27 13:07:56 2001] [error] directive_PythonImport: error import
> mod_python.MyObject
> TypeError: must assign list (not "string") to slice
>
> Any help on this error msg?
>
> BTW, the first error line appears at start up... second appears upon
> immediate shutdown... probably just a buffer thing, but I thought I'd
share.
>
> 3.  I also tried import a base module which worked fine.
>
> PythonImport string
>
> 4.  But when I created a copy of string.py and simply renamed it, it
didn't
> work.
>
> PythonImport copyofstring
>
> Any thoughts on why mod_python appears to like some modules and not
others?
>
> Thanks in advance.
>
> Chris
>
>
>
> -----Original Message-----
> From: Chris Hagner [mailto:CHagner at fool.com]
> Sent: Thursday, March 15, 2001 12:07 PM
> To: 'Gregory (Grisha) Trubetskoy'
> Cc: 'mod_python at modpython.org'
> Subject: RE: [mod_python] PythonImport failure
>
>
> Thanks for the response.  For my tests, mypackage is a package named
> 'toolkit' and the mymodule is a module named 'brandconfig'.
>
> Oh yeah, I'm doing this on Apache/1.3.19 (Win32) mod_python/2.7.1
> Python/2.0.  I'm on Win2K (for development, sigh).
>
> INTERACTIVE SESSION TEST:
> ******************************
>
> Here's my python interactive session... the module only contains a single
> variable x.
>
> >>> import toolkit.brandconfig
> >>> dir(toolkit.brandconfig)
> ['__builtins__', '__doc__', '__file__', '__name__', 'x']
> >>> toolkit.brandconfig.x
> 123
> >>>
>
> So, the module is importable in my python environment.
>
>
> APACHE PYTHONIMPORT TEST:
> ******************************
>
> Just to be sure, I ran the apache test again.  Here's the httpd.conf
entry.
> Nothing shocking.
>