: Ok. Here is what I did. I don't have a place in my cgi directory to type
:
python eventcal.py
Oh, you don't have a command line? How do you log in to your server? Do they only give you a graphical interface?
: If there is a place, I don't know where it is so I didn't do anything with that. I did however find my error log and looked at the problem with the 500 error. It said this:
:
[Mon Jan 6 11:34:30 2003] [error] [client ] Premature end of script headers: /home/virtual/site78/fst/var/www/cgi-bin/cal.py
: [Mon Jan 6 23:41:09 2003] [error] [client ] Premature end of script headers: /home/virtual/site78/fst/var/www/cgi-bin/eventcal.py
: File "eventcal.py", line 79
: month += 1
: ^
: SyntaxError: invalid syntax
: [Mon Jan 6 23:46:24 2003] [error] [client ] Premature end of script headers: /home/virtual/site78/fst/var/www/cgi-bin/eventcal.py
: File "eventcal.py", line 79
: month += 1
: ^
: SyntaxError: invalid syntax
: [Mon Jan 6 23:51:19 2003] [error] [client ] Premature end of script headers: /home/virtual/site78/fst/var/www/cgi-bin/eventcal.py
:
: This is all fine and good. I don't know how to change my end of script headers to fix the problem though. The script I just cut-and-pasted.
The script headers aren't the problem. If you look closely, the script has a syntax error which is causing it to abort before it prints out anything. The http "headers" are lines like "Content-type: text/html". I don't understand why month += 1 is throwing a syntax error. It works fine on my machine and "+=" is pretty standard programming notation. I suppose though, that an older version of python might not support that operator. Here is the block of code where the offending line is:
if form.has_key("next.x"):
month += 1
if month > 12:
month = 1
year += 1
if form.has_key("prev.x"):
month -= 1
if month < 1:
month = 12
year -= 1
Try changing this part to:
if form.has_key("next.x"):
month = month + 1
if month > 12:
month = 1
year = year + 1
if form.has_key("prev.x"):
month = month - 1
if month < 1:
month = 12
year = year - 1
We'll replace the += and -= shorthand operators with the full expressions and see if that gets us past the syntax error. Got that?
: The line:
#!/usr/bin/python
: Is no different than the "Hello cgi world" script. And I don't really understand about the environment or how to set it up. I am guessing it's set up correctly because the cgi world script works just fine.
Ok, don't worry about it for now then.
: I actually just remembered what the environment was. Yes, the scripts are executable. "pythontest.py", "cal.py", and "eventcal.py". *sheesh*
Actually, I was just wondering if python is in your PATH or if you would have to type /usr/bin/python to run the interpreter manually, but since you don't seem to have a command line anyways this is rather moot.
Onward and upward!
infidel