Python troubles

radford.will70

New Member
Messages
1
Reaction score
0
Points
0
I've set permissions in folders scgi-bin and cgi-bin.

I uploaded testing.py to both folders.

I've tried the htaccess handler in both folders with the internal error 500 message.
Code:
AddHandler cgi-script .py

I've used a very simple script, an example from these forums that was stated to work.
Code:
print("Content-type: text/html")
print("")

print("<html>")
print("<body>")

print( "Hi there")

print("</body>")
print("</html>")


I get the script outputting the whole script's code line by line but never the processed code.

Is there something obvious I'm doing wrong? It's a "free" account at x10hosting, does that matter or do all accounts have access to python and cgi?

Thanks in advance.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
You only need an AddHandler directive outside of cgi-bin (and scgi-bin, if it's already configured with a ScriptAlias directive). What you're missing is a shebang line. Add:
Code:
#!/usr/bin/python
to the start of the script. Also check that the script has execute permissions, that you upload it in ASCII mode, and that your editor doesn't insert a byte order mark. A bit of searching should have turned this up.
 
Last edited:
Top