Skip to Content.
Sympa Menu

pcplantdb - Re: [pcplantdb] python import problem in cgi env.

pcplantdb@lists.ibiblio.org

Subject: pcplantdb

List archive

Chronological Thread  
  • From: Richard Morris <webmaster@pfaf.org>
  • To: Permaculture Plant Database <pcplantdb@lists.ibiblio.org>
  • Subject: Re: [pcplantdb] python import problem in cgi env.
  • Date: Tue, 07 Dec 2004 17:58:59 +0000

Chad Knepp wrote:

Hello Ibiblio staff,

I'm having some inexplicable (to me anyway) problems with python
failing to import certain packages in the cgi environment of the
virtual host permaculture.info (/public/vhost/pyg). I've written a
test python cgi script to demonstrate the problem that I will attach.
I suspect that the problem has something to do with the fact that the
cgi version of python is 1.5.2 and the shell version of python 2.2.3
or something in the config details of apache or nfs.
Anyway, the problem is currently preventing our cgi script from
importing the necessary packages to function. Our cgi script (Eden)
is designed to function both as a cgi script and a command line
interface one. The cli method of Eden is working properly indicating
[to me] that the problem is an aspect of the cgi environment not Eden
itself. The problem demonstration script also includes cgi and cli
versions.

[ATTACHMENT ~/problem.py, application/octet-stream]

Here is some of the sample output from the cli:

sys.version = 2.2.3 (#1, Aug 8 2003, 08:44:02) [GCC 3.2.3 20030502 (Red Hat
Linux 3.2.3-13)]
sys.path = ['.', '/public/vhost/pyg/cgi-bin', '/usr/lib/python2.2',
'/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-dynload',
'/usr/lib/python2.2/site-packages']
imported cgi, cgitb, Eden.Session

From the cgi:

sys.version = 1.5.2 (#1, Mar 13 2003, 18:24:53) [GCC 2.96 20000731 (Red Hat
Linux 7.2 2
sys.path = ['/public/vhost/pyg/cgi-bin', '/usr/lib/python1.5/',
'/usr/lib/python1.5/ plat-linux-i686', '/usr/lib/python1.5/lib-tk',
'/usr/lib/python1.5/lib-dynload', '/usr/lib/ python1.5/site-packages']
imported cgi
import cgitb raised an ImportError: No module named cgitb
import Eden.Session raised a SyntaxError: invalid syntax

You can execute the cli script at /public/vhost/pyg/cgi-bin/problem.py
and access the cgi version at
<http://permaculture.info/cgi-bin/problem.py

Thanks for your time,
Chad

Yep I've had similar problems in the past. I guess that we need to code for the cgi version i.e. 1.5.2.

Could possibly hassle ibiblio to use a more recient version.

Is there some way to specify which version of python to use with the cgi.

I'd suggest a bug report to ibiblio support.

Rich
--
Plants for a Future: 7000 useful plants
Web: http://www.pfaf.org/ same as http://www.comp.leeds.ac.uk/pfaf/
Post: 1 Lerryn View, Lerryn, Lostwithiel, Cornwall, PL22 0QJ
Tel: 01208 872 963 / 0845 458 4719
Email: webmaster@pfaf.org
PFAF electronic mailing list http://groups.yahoo.com/group/pfaf






Archive powered by MHonArc 2.6.24.

Top of Page