[SciPy-user] weird error in mod_python (3.1.4.r1) /scipy (0.4.8)/gentoo (~x86) web application

Robert Kern robert.kern at gmail.com
Sun Apr 2 22:27:31 CDT 2006


Webb Sprague wrote:
> This may be un-reproducible, and it does NOT happen within ipython
> shell, but I am getting the backtrace below when trying to import
> scipy within my application.  I would guess it has to do with the very
> outdated ebuild of mod_python, (see the gentoo bug: 
> http://bugs.gentoo.org/show_bug.cgi?id=123852), but just in case
> anybody has any quick fixes, please let me know.
> 
> I have restarted Apache numerous times to make sure there isn't some
> weird cache thing going on (the source of most of my phantom bug
> reports).  Scipy 0.3.2 does not have this problem.
> 
> Backtrace follows. (6), with LcUtil.py, is where it tries to import
> and errors out.
> 
> Mod_python error: "PythonHandler mod_python.publisher"
> 
> Traceback (most recent call last):
> 
> (1)  File "/usr/lib/python2.4/site-packages/mod_python/apache.py",
> line 299, in HandlerDispatch
>     result = object(req)
> 
> (2)  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py",
> line 98, in handler
>     path=[path])
> 
> (3)  File "/usr/lib/python2.4/site-packages/mod_python/apache.py",
> line 457, in import_module
>     module = imp.load_module(mname, f, p, d)
> 
> (4)  File "/var/www/localhost/htdocs/larry/lc.py", line 32, in ?
>     import LcSinglePopObject
> 
>  (5) File "/var/www/localhost/htdocs/larry/LcSinglePopObject.py", line 40, in ?
>     import LcUtil
> 
> (6)  File "/var/www/localhost/htdocs/larry/LcUtil.py", line 8, in ?
>     import scipy as S
> 
>   File "/usr/lib/python2.4/site-packages/scipy/__init__.py", line 18, in ?
>     import pkg_resources as _pr # activate namespace packages
> (manipulates __path__)
> 
>   File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2347, in ?
>     working_set = WorkingSet()
> 
>   File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 343,
> in __init__
>     self.add_entry(entry)
> 
>   File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 358,
> in add_entry
>     for dist in find_distributions(entry, True):
> 
>   File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1450,
> in find_distributions
>     importer = get_importer(path_item)
> 
>   File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1407,
> in get_importer
>     importer = hook(path_item)
> 
> TypeError: zipimporter() argument 1 must be string, not
> builtin_function_or_method

It looks like this is an issue with setuptools which provides pkg_resources.py.
You may want to ask on the Distutils-SIG mailing list. In the meantime, you can
just delete try: except: suite. It's not necessary if you aren't using namespace
package eggs.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-user mailing list