configuring mxCGIPython

M.-A. Lemburg mal at lemburg.com
Fri Apr 26 14:04:33 EDT 2002


Mark McEahern wrote:
> 
> [M.-A. Lemburg]
> > Hmm, interesting. Looks like sys.path is empty at this point.
> > I wonder whether this is a bug in the frozen cgipython built
> > or just a consequence of freezing the interpreter.
> >
> > Could you try setting PYTHONPATH to the dir where cgipython
> > lives ?
> 
> I tried that.  The first error related to site.py no longer occurs, but I
> still get the second error.  Output appended at the end of the message.  I
> don't really know what line 27 of cgipython.py is?

You have to call cgipython as:

	cgipython script.py [options]

You probably have passed in something else as first parameter
which is why you get the error in cgipython.py:

# run the script file passed in sys.argv[1]
import sys
try:
        script = sys.argv[1]
except IndexError:
        sys.stderr.write('Usage: cgipython <pyfile> [parameters]\n')
else:
        del sys.argv[0]
        execfile(script) # <-- this is line 27

I should probably add another try:except: here which generates
a better error messages.

> > Since the stuff currently done in site.py doesn't really
> > make all that much sense here, I think cgipython should
> > probably use an empty site.py file instead of the standard
> > one (should enhance startup times even more).
> 
> Sadly, I don't know enough to really judge this.
>
> > Good question. It probably doesn't even start looking for
> > it since it's already preregistered in the built-in
> > modules.
> 
> I'm building my own fresh copy of cgipython to see if that makes any
> difference.  I'll let you know.
> 
> Again, I appreciate your feedback and help.

That's ok. I want cgipython to be as easy to use as possible
and our little chat helps with this.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/





More information about the Python-list mailing list