on-internet
← Community

subprocess.Popen and relative directories

Stack Overflow ·

I am writing a script to open notepad.exe using subprocess.Popen(): import subprocess command = '%windir%\system32\\notepad.exe' process = subprocess.Popen(command) output = process.communicate() print(output[0]) This throws a FileNotFoundError. Is it possible to change/add to the above code to make it work with relative paths? I did try to run the script from C:\Windows> after moving it there, which again failed. Also set the shell=True, but failed as well. Writing a similar script using os.popen() works ok with relative paths, regardless which directory the script is run from, but as far as

Comments

Sign in or sign up to comment and upvote.

No comments yet.