SunQuest
           Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old November 16th, 2003, 10:46 PM
SolarBear's Avatar
SolarBear SolarBear is offline
onCsdfeu
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 100 SolarBear User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 43 sec
Reputation Power: 6
Send a message via ICQ to SolarBear Send a message via MSN to SolarBear
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

Reply With Quote
  #2  
Old November 17th, 2003, 02:15 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old November 17th, 2003, 04:26 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 8
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?

Reply With Quote
  #4  
Old November 17th, 2003, 07:02 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonder.
Posts: 5,543 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1Folding Points: 108894 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Weeks 1 Day 22 h 42 m 5 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook
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

Reply With Quote
  #5  
Old November 17th, 2003, 08:50 AM
SolarBear's Avatar
SolarBear SolarBear is offline
onCsdfeu
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 100 SolarBear User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 43 sec
Reputation Power: 6
Send a message via ICQ to SolarBear Send a message via MSN to SolarBear
Quote:
Originally posted by xlordt
...Either check your programming skills...

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.

Reply With Quote
  #6  
Old November 17th, 2003, 04:54 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 7
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

Reply With Quote
  #7  
Old November 22nd, 2003, 05:08 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #8  
Old November 22nd, 2003, 10:54 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 7
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.

Reply With Quote
  #9  
Old November 23rd, 2003, 09:22 AM
ilves ilves is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Norway
Posts: 41 ilves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 22 sec
Reputation Power: 6
Quote:
Originally posted by netytan

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 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).
__________________
Good web hosting info - articles about web hosting
hb's web dev blog

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Various CGI problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway