Python Forum

Full Version: Executing DOS programs within Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Group!
I have been a programmer for 30 years (yea an old timer) I'm new to Python and I'm working on a project to convert a software from MS DOS based to a Python framework calling DOS executable on the database server. Example would be a customer maintenance app that would call the database server for each field in the app. Below is an example. What Python class or method can I use to accomplish this? Sorry, if I'm not making myself too clear.

CUSTOMER NAME:_________ (Free form entry field)
CUSTOMER ADDRESS:______ (Free form entry field)
CUSTOMER CITY:_________ (Python calls a DOS executable with the entered data and return results)
CUSTOMER STATE:________ (Python calls a DOS executable with the entered data and return results)
CUSTOMER ZIP CODE:_____ (Python calls a DOS executable with the entered data and return results)


-Peter G
Looks like you want to look at https://docs.python.org/3/library/subprocess.html
It being a DOS program shouldn't matter in this case, it could be any executable (including scripts).
micseydel, So subprocess will actually go back to the server, execute the DOS executable and it will return any possible results?

I'll take a look at at https://docs.python.org/3/library/subprocess.html and get very familiar with it.

Thanks,
-Peter G
No, I thought you would host this on that server. It's hard to give you a thorough answer with limited information, but if I had to do this, I suspect I'd wrap the DOS stuff on the server using subprocess and surface a REST API with the Flask framework (though you might use Django, or something else), and then the "client" application would interact with the REST server via regular HTTP calls.
micseydel,
Sorry if I wasn't too clear on my objective this would be a client calling the server. The end goal is to use Django as the web framework to call/request/read/update the server. So you are recommending to use a REST API on the client and making HTTP calls to the server? So, Django has the features that I'm looking for.



btw; the database is not relational but rather a multivalued database http://downloads.openqm.com/help/mvintro.htm something like a NoSQL.

-Peter G