|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
||||
|
||||
|
Various CGI problems
Hey all. I've just bought my own piece of the web, a host with Python installed (there ain't that many!) and I started tinkering with cgis.
After many problems (me == dumb enough to forget to chmod +x the scripts ) I was able to get the little bastards to run. Still, I'm having some problems.#1 The only error I EVER receive is the "500 Internal server error" or something like that. Is there nay way to get useful error messages ? #2 I'm trying to import a script - placed in the same folder as the one that's executed - and whether I name it script.py or script.cgi , it won't import and I get the 500 error. How could I solve that ? Thanks for the help again, d00ds.
__________________
Time is the greatest of teachers ; sadly, it kills all of its students. - Hector Berlioz |
|
#2
|
||||
|
||||
|
Ah i'm sure you'll have allot of fun when you get into it Solar..
If you want to redirect errors to the browser you can just add this line to the top of your CGI.. import sys; sys.stderr = sys.stdout alternativly you can use the cgitb module which will do the same thing but can also format the error message to make it easier to read. i dont know why it wont import though.. try one of the methods aobve and see what error you get. if you can solve it i sugest you kick your admins *** thats what i do.Mark. |
|
#3
|
||||
|
||||
|
Check sys.path? Your host may have set Python up so the path doesn't include the current working directory. That or you will need to find out your full absolute path and add that to sys.path, e.g.
sys.path.append("/var/www/sites/myaccount/cgi-bin") Try that? |
|
#4
|
||||
|
||||
|
This is a generic error message and it can be caused by any number of problems.
First and foremost, check your permissions, in this case probably not the script, but one or more of the other files that the script is trying to read or write to. Another possibility is you changed something else in the script causing a syntax error. Either check your programming skills, or start over with a fresh copy of the script. Also make sure that your not uploading your script in binary mode, o and one more thing.. it would be getter if you post your codes ![]()
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#5
|
||||
|
||||
|
Quote:
Is there a module that allows that ? ![]() No, thanks a lot, guys, I'll be trying that as soon as I get a second or two or three. |
|
#6
|
|||
|
|||
|
this used to happen to me when I found this free Python host a week ago, turns out it was a dumb mistake. I kept forgeting to write
#!/usr/bin/python at the top of the file |
|
#7
|
||||
|
||||
|
So 2k, u gonna make this the links
, what host are you using?Anyway you should probably use '#!/usr/bin/env python' instead, this way you wont have to change your shebang for it to work on multiple systems.. and yes it works with the windows version of Apache too ![]() Mark. |
|
#8
|
|||
|
|||
|
www.1and1.com 3 years free hosting, 500 meg space with 5gb a month traffic. Python, Perl and PHP hosting with MySQL, etc..
very good deal except you'll probably want to buy a domain name since you don't choose your domain name and the one they give you is pretty useless (ie sdfj454d.homeonline.us) Features: Website/Connectivity: Hosted on I/O optimized own 1&1 Linux version 500 MB web space 5,000 MB/month traffic ($.99 per GB for additional traffic) No limits on simultaneous hits/bandwidth Protected by firewall Continuous backups of your website 99.9% Uptime guarantee Website features: Advanced live site statistics, log files, ready-to-run CGI-library, own CGI programming (Perl, Python), FrontPage 2002 extensions Advanced Password Protection 5 FTP accounts PHP3 & PHP4 MySQL Proxy SSL Secure Server Cron Jobs SSH Secure Shell Access Advanced Developer Tools CRM/E-commerce: WebElements Newsletter Tool One-on-one online dialogue Turn-key web database applications Chats Forums Domain names: Register or transfer .com/.net/.org/.info for just $5.99/year 50 subdomains (e.g., shop.yourDomain.com) Point up to 100 external domain names to 1&1 Applications: Free template loaded online WebsiteCreator Free full version of Fusion 7, search engine registration, ranking, optimization Total software worth $300 1&1 Control Panel E-mail handling: 50 POP3 e-mail accounts (50 MB each) Catch-all e-mail addresses Auto-responders, unlimited forwarding. 1&1 Advanced WebMail Symantec virus scanner Support: 1&1 Express support by e-mail Last edited by jimmy2k1 : November 22nd, 2003 at 11:00 PM. |
|
#9
|
|||
|
|||
|
Quote:
I didn't see it specified so here is how to use it. Add these 2 lines at the top of your script (after the other import statements is a nice place): Code:
import cgitb cgitb.enable() If that doesn't print out any meaningful error messages either, run your script as a shell script (type "python script.py" in your shell). |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Various CGI problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|