Question

J'ai ce fichier python test

import os

print 'Content-type: text/html' 
print 

print '<HTML><HEAD><TITLE>Python Sample CGI</TITLE></HEAD>'
print '<BODY>'
print "<H1>This is A Sample Python CGI Script</H1>"
print '<br>'
if os.environ.has_key('REMOTE_HOST'):
   print "<p>You have accessed this site from IP: "+os.environ["REMOTE_HOST"]+"</p>"
else:
   print os.environ['COMPUTERNAME']

print '</BODY></html>'

J'ai créé une application sur IIS 5.1 avec l'autorisation d'exécuter des scripts et créé une cartographie à .py comme ceci:

C:\Python30\python.exe -u "%" "%"

Mais quand je tente d'exécuter le script que je suis l'erreur suivante:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

C:\Python30\python.exe: can't find '__main__.py' in ''

Toute idée?

Était-ce utile?

La solution

C:\Python30\python.exe -u "%" "%"

A, mais il devrait être "% s". J'utilise:

"C:\Python30\python.exe" -u "%s" 

(Le second% s est pour la commande en ligne de requêtes , qui ne se produira jamais dans ce siècle.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top