Jul-12-2022, 10:56 PM
Hello,
I'm trying to run cmds with python.
For example: I want my python program to be able to open/run MagicMirror by cd into it's directory(C:\MagicMirror) and running "node serveronly".
I tried to do this but it would run my desired cmd in the terminal running my python program. Therefore, it never ran/kept crashing.
I had this:
And the reason I cd.. twice is because when I manually open the cmd prompt I am in "C:\Users\My-PC" so I figured in order to get to "C:/" I cd.. twice.
But when I try running the code I end up here "C:\Users\My-PC\Downloads"
So, how do I cd into MagicMirror and run "node serveronly" using python?
I don't know if this makes sense, but any help would be greatly appreciated.
Thanks in advance.
I'm trying to run cmds with python.
For example: I want my python program to be able to open/run MagicMirror by cd into it's directory(C:\MagicMirror) and running "node serveronly".
I tried to do this but it would run my desired cmd in the terminal running my python program. Therefore, it never ran/kept crashing.
I had this:
os.system('cmd /k "cd.. & cd.. & cd MagicMirror & node server only"')My python program is located in a folder in my Downloads: "C:\Users\My-PC\Downloads\VoiceAssistant"
And the reason I cd.. twice is because when I manually open the cmd prompt I am in "C:\Users\My-PC" so I figured in order to get to "C:/" I cd.. twice.
But when I try running the code I end up here "C:\Users\My-PC\Downloads"
So, how do I cd into MagicMirror and run "node serveronly" using python?
I don't know if this makes sense, but any help would be greatly appreciated.
Thanks in advance.