python cgi newbie question

Jeff Shannon jeff at ccvcorp.com
Thu Sep 6 18:55:10 EDT 2001


Anastasios Papadopoulos wrote:

> Check file permisions of every file the programm uses.It must be available
> to everyone, since a web-user doesn't have much permissions and Apache (?)
> uses this account.
> That is, if the programm works perfect in Python...
>
> > lecturerlist = [rec.split('|') for rec in
> open('lecturer.txt').xreadlines()]
> > examlist = [rec.split('|') for rec in open('exam.txt').xreadlines()]

You should also check your paths--since you are not specifying a path, Python
looks for these files in the "current directory"--whatever that may be for
your cgi script.  (I'd guess that it would be the directory that the script is
located in, but I'm not at all sure of this.)

Plus, as has been noted elsewhere, you didn't provide a definition of
sort1()--I'm not sure if this simply didn't get pasted to your message, or if
it's truly missing.  Another minor detail--you have "print allocationlist"
where you probably intend to use "pprint ...".  My personal preference would
be to use "import pprint" instead of "from pprint import pprint", and then use
"pprint.pprint allocationlist" -- avoiding "from module import func" makes
this sort of error a lot easier to spot, not to mention making it easier for
someone *else* to read your code and figure out where your functions come
from.

Hope this helps...

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list