Issue
I want to open a file and then run a game from in it. I tried:
import os
os.startfile(r'C:/Users/Andy/Desktop/Jnes')
os.startfile("Jnes.exe")
But that only brought up the first file and didn't run the game.
Solution
Your first line is superfluous. The parent Python process still has it's default working directory. That line will not change it, so the second line will fail as it will not find the file named Jnes.exe
.
So either use:
os.startfile(r'C:/Users/Andy/Desktop/Jnes/Jnes.exe')
This will keep the working directory (for the Python process) unchanged, or, if you want it changed, use:
os.chdir(r'C:/Users/Andy/Desktop/Jnes')
os.startfile("Jnes.exe")
Answered By - exhuma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.