Unicode issue with Python v3.3

Cameron Simpson cs at zip.com.au
Sat Apr 13 20:01:07 EDT 2013


On 13Apr2013 07:16, nagia.retsina at gmail.com <nagia.retsina at gmail.com> wrote:
| root at macgyver [/home/nikos/public_html/cgi-bin]# ls ../cgi.err.out 
| ../cgi.err.out

I prefer "ls -ld" myself.

| root at macgyver [/home/nikos/public_html/cgi-bin]# cat ../cgi.err.out 
| 
| Also i have foudn the error log and i tried to view it but it was
| empty and then i removed it and then run the script both from shell
| and broswer but it didnt reappeared.

Never remove it. It is only created by the web server at startup or log rotation time. So now you need to restart the apache to get it back.

Just open a spare terminal and run:

  tail -f /var/log/httpd/error_log

| Should we check the Apache and CGI enviroment somehow and also
| make sure as you say that *I* run the CGI scripts and not user
| 'Apache' ?

Well, it is helpful to know. if the CGI script tries to write any data to files,
if it runs as a different user it will need different permissions on the files.

| Tell me what commands i should issues please and i will display the output to you.

I would be tempter to wrap the CGI script in a shell script.
Suppose your script is named foo.py. 

You can move the script to foo-py and make a shell script called "foo.py" looking like this:

  #!/bin/sh
  exec 2>>/home/nikos/cgi.err.out
  echo "$0 $*" >&2
  id >&2
  env | sort >&2
  set -x
  exec /full/path/to/foo-py ${1+"$@"}

and make sure it, like the original, is readable and executable:

  chmod a+rx foo.py foo-py

Make sure cgi.err.out is publicly writable (in case the apache is
not running the CGIs are you):

  chmod a+w cgi.err.out

Then:

  tail -f cgi.err.out

in a spare window.

Then try the script.

It should transcribe information about the script's user and
environment and also catch errors.

This should help in debugging.

Cheers,
-- 

I die. I have a terrible fever in my head and it gets hotter and hotter until
my head is a fire, a forge, a star. I set the world on fire and all die. O the
embarrassment.  - Joe Haldeman, _A !Tangled Web_



More information about the Python-list mailing list