Question

Je suis en train d'exécuter un serveur CGI extrêmement simple sur VMS fait en python.

import sys    
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler    
server_address=('',8080)
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
httpd.serve_forever()

Le problème, c'est qu'il sert à contenu statique correctement et il tente d'exécuter les CGIs (il est au bon endroit et Ihave utilisé avec Apache les CGIs de sorte qu'une partie est certainement pas la question) mais quelque part se bloque. Il est quelque chose que je ne sais pas VMS.

Tout pointeur vers la bonne direction serait appréciée. :)

Mise à jour: simplifié, je dois exécuter un programme sur VMS et obtenir les résultats de ce programme en quelque sorte. Toute référence à l'exécution et obtenir leurs sous-processus des résultats est suffisant pour moi.

Était-ce utile?

La solution

Are you using the Python port from http://hg.vmspython.org/vmspython/ ?

If so, I think this thread, and this file (which appears to implement a form of popen2), may hold the keys to your salvation. There appear to be VMS-specific modules (at least vms.starlet, vms.rtl.lib, vms.dvidef, vms.clidef) in the port that provide interfaces to such things as VMS's spawn function. Documentation seems to be spotty or nonexistent, however.

Autres conseils

CGIHTTPServer.py uses os.fork if available, subprocess.Popen if not.

See the source code of the run_cgi method.

Experiment withe the subprocess module to see if/how it works on VMS.

To execute a subprocess and get its output on posix:

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import Popen, PIPE
>>> output = Popen(['/bin/ls', '/'], stdout = PIPE).communicate()[0]
>>> print output
bin
boot
dev
etc
home
..snip..
root
sbin
>>> 

This is clearly on Linux, so I'm not sure of any VMS specifics to Python or the subprocess module.

http://docs.python.org/library/subprocess.html

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