Bonsoir , j'ai crée un serveur avec python :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
port = 8080
httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
httpd.serve_forever()
ce serveur me permet d'afficher sur firefox le code d'un fichier .py :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
html_header = 'Content-type: text/html\r\n\r\n'
 html_code= '''
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>TEST </title>
    </head>
    <body>
        TEST AFFICHAGE
    </body>
</html>
'''
print(html_header)
print(html_code)
le fichier suivant a était rendu exécutable , avec localhost:8080/index.py
j'obtiens donc l'affichage du fichier dans firerox , afin de me permetre d'éxécuter le code pour obtenir TEST AFFICHAGE de la lecture de index.py , j 'ai crée un fichier cgi-bin pour l'index.py mais la quand je lance localhost:8080/cgi-bin/index.py c'est l'erreur 403 :
Mes fichiers :

Desktop => Serveur
______ => index.html
______ => cgi-bin => index.py


Error response

Error code: 403

Message: CGI script is not executable ('/cgi-bin/index.py').

Error code explanation: 403 - Request forbidden -- authorization will not help.

systéme = Mac os X 10.8.3 intel core 2