How to open cmd.exe and use it in python?
-
i have just finished some simple tutorials on programming in python, and im trying to write some simple yet useful programs. the only way i know of to get get my program to interact with my computer on a useful manner is to use cmd.exe. (yes i'm a noob, so whoever answers please give a detailed explanation) every time i try and open the exe file with python, it says i have an ioerror. i have seen many sollution on the web, but i don't understand them, and for some, i don't have the proper modules. also, if i get in. could someone please tell me how to execute my code in cmd from within the python program.
-
Answer:
import subprocess subprocess.call(['C:\\Temp\\a b c\\Notepad.exe']) import win32api # if active state python is installed or install pywin32 package seperately try: win32api.WinExec('NOTEPAD.exe') # Works seamlessly except: pass TheCommand = '\"\"C:\\Temp\\a b c\\Notepad.exe\"\"' os.system(TheCommand)
Jacob at Yahoo! Answers Visit the source
Related Q & A:
- How To Open Zipx File Online?Best solution by solvusoft.com
- How To Open Your Third Eye Fast?Best solution by Yahoo! Answers
- How to create complete .exe in WPF .net framework application?Best solution by Programmers
- How do I use WordNet in Python?Best solution by Stack Overflow
- How to delete an entry from a dictionary in Python?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.