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

Webb Sprague webb.sprague at gmail.com
Mon Jun 5 18:34:09 EDT 2006


Hi all,

I am using mod_python to send binary files and I would like the client
to know the length of the file (so their "percent downloaded" widget
can be used).  Is there a way to put the byte length in the headers
some how?

I did look in the request object docs, but couldn't find it.

Thx
W

On 4/2/06, Webb Sprague <webb.sprague at gmail.com> wrote:
> Thanks to Graham's help, I found the typo
> ("sys.path.append(os.getcwd)" should have been
> "sys.path.append(os.getcwd())"), and all is well.
>
> W
>
> On 4/2/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> > 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.
> >
> > Looking through pkg_resources.py, critical bit of code seems to be:
> >
> > class WorkingSet(object):
> >     """A collection of active distributions on sys.path (or a similar list)"""
> >
> >     def __init__(self, entries=None):
> >         """Create working set from list of path entries (default=sys.path)"""
> >         self.entries = []
> >         self.entry_keys = {}
> >         self.by_key = {}
> >         self.callbacks = []
> >
> >         if entries is None:
> >             entries = sys.path
> >
> >         for entry in entries:
> >             self.add_entry(entry)
> >
> > Specifically, "entries" is set to 'sys.path' and then each entry in that is
> > processed. The final error suggests that one of the entries in 'sys.path'
> > is actually a function and not a string.
> >
> > Are you setting 'sys.path' using PythonPath directive in mod_python
> > and somehow stuffed it up, or are you setting 'sys.path' explicitly in
> > any other places?
> >
> > Graham
> >
> > > 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
> > >
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>


More information about the Mod_python mailing list