Simple CGI Web Server in Python on VMS

I am trying to run an extremely simple CGI server on a VMS made in python.

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

The problem is that it serves static content correctly and tries to execute CGIs (it is in the right place, and I used these CGIs with Apache, so part is definitely not a problem), but it hangs somewhere. This is what I do not know about VMS.

Any pointer to the right direction will be appreciated. :)

Update: simplified, I need to run the program on VMS and somehow get the results of this program. Any links to the execution of subprocesses and obtaining their results are enough for me.

+6
source share
3 answers

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

If so, I think this thread , and this file (which seems to implement the form of popen2 ) may contain the keys to your salvation. Apparently, there are VMS-specific modules (at least vms.starlet , vms.rtl.lib , vms.dvidef , vms.clidef ) in the port that provide interfaces for functions such as the VMS spawn function. However, the documentation seems spotty or nonexistent.

+1
source

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

See the source code of the run_cgi method.

Experiment with the subprocess module to see if it / is running VMS on it.

0
source

To execute a subprocess and get its output in 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 explicitly on Linux, so I'm not sure about the specifics of the VMS for Python or the subprocess module.

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

-1
source

Source: https://habr.com/ru/post/887158/


All Articles