Python Forum
Executing DOS programs within Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Executing DOS programs within Python (/thread-8625.html)



Executing DOS programs within Python - mdsi2000 - Feb-28-2018

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


RE: Executing DOS programs within Python - micseydel - Feb-28-2018

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).


RE: Executing DOS programs within Python - mdsi2000 - Feb-28-2018

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


RE: Executing DOS programs within Python - micseydel - Mar-01-2018

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.


RE: Executing DOS programs within Python - mdsi2000 - Mar-01-2018

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


This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.