configuring mxCGIPython

Mark McEahern marklists at mceahern.com
Fri Apr 26 17:05:52 EDT 2002


[M.-A. Lemburg]
> 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:

This is the shell script wrapper I'm using to test it:

  #!/bin/bash
  # test2.cgi

  echo content-type: text/plain
  echo

  export LD_LIBRARY_PATH="/home/chain/cgi-bin"
  export PYTHONVERBOSE="1"
  export PYTHONPATH="/home/chain/cgi-bin"

  if [ -f cgipython ]
  then
    echo cgipython exists
    # Trying to send stderr to stdout.
    ./cgipython test.py 2>&1
  else
    echo cgipython does not exist
  fi

test.py is in the same folder as cgipython.  Are the stderr/stdout
redirectors confusing it?  If I run that from my local Linux shell (i.e.,
NOT on the ISP), I get:

	$ cgipython test.py 2>&1
	2.2.1 (#1, Apr 26 2002, 09:41:38)
	[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)]

> # 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

Yes, thank you.  After I built my own version of mxCGIPython, I was able to
find cgipython.py in the temp folder and find the line.  By the way, I can
send you the cgipython I generated.  It's not working for me on my ISP--I'm
getting this error, but that may have more to do with the kernel/libraries
my ISP has than anything else:

  cgipython exists
  ./cgipython: /lib/libpthread.so.0: version `GLIBC_2.2' not found (required
by ./cgipython)
  ./cgipython: /lib/libc.so.6: version `GLIBC_2.2' not found (required by
./cgipython)

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

Sounds good.

Thanks,

// mark






More information about the Python-list mailing list