FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Problem with python script





leac3
Hi, I'm trying to learn Python, it seems easy since I'm a Senior PHP Developer. But I don't get it to run a simple "hello world" script.

I use Notepad in Windows 7, saving the file (p.py) with UTF-8 codification. Upload the file using FileZilla in ASCII mode and UTF-8, to the cgi-bin directory where a .htacess exists.
Code:
Options -Indexes +ExecCGI
AddHandler cgi-script .cgi .pl .py


The script is a simple "hello world" script:
Code:
#!/usr/bin/python

print "Content-type:text/html\r\n\r\n"
print "<!doctype html>"
print "<head>"
print "</head>"
print "<body>"
print "hello world"
print "</body>"


Also I change the permission to 775.

I try to run the script from http://leac3python.frihost.org/cgi-bin/p.py but I get this error:
Quote:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request
leac3python.frihost.org


The server error log write this:
Quote:
[Wed Jan 11 08:21:34 2012] [error] [client 190.201.238.216] suexec failure: could not open log file
[Wed Jan 11 08:21:34 2012] [error] [client 190.201.238.216] fopen: Permission denied
[Wed Jan 11 08:21:34 2012] [error] [client 190.201.238.216] Premature end of script headers: p.py
[Wed Jan 11 08:21:34 2012] [error] [client 190.201.238.216] File does not exist: /home/leac3/domains/leac3python.frihost.org/public_html/favicon.ico


What can I do?
leac3
Isuue solved. Finally, my first Hello World script in Python is running !!

I was using Notepad but it doesn't have an option to save in Unicode codification,. however I used Wordpad and it has explicitly to save in Unicode.

Very Happy

P.D.: I applied all this configuration in GoDaddy and finally the script works.
jcreus
leac3 wrote:
Isuue solved. Finally, my first Hello World script in Python is running !!

I was using Notepad but it doesn't have an option to save in Unicode codification,. however I used Wordpad and it has explicitly to save in Unicode.

Very Happy

P.D.: I applied all this configuration in GoDaddy and finally the script works.

For further problems, consider switching to Linux Wink No such problems, and great development tools.
amagard
Good thread, thanks for the hint. I had been running into the same problem.
With the help of Editplus I finally changed my file to Linux File Format.
jcreus
amagard wrote:
Good thread, thanks for the hint. I had been running into the same problem.
With the help of Editplus I finally changed my file to Linux File Format.


If I were you, not only I'd change to the Linux File Format: also to the Linux Operating System Smile.
Related topics
python script???
Python execute External Application. How?
PythonOption in .htaccess
php or python question about some processing.
Weird file problem :(
Python and CPU load
website in python
What is the difference between CGI and python script?
Run python script
Python, CGI and CSS
Python CGI script 500 error
Python script execution help [Serv. 3]
python programming
Anonymous FTP Scanner - Python Script
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.