Hello! I am having trouble getting the abspath when entering only an executable file. How can I fix this to return the full abspath? I am taking user input and opening a process (application). Here is my code:
file = "/" + arr + ".exe" print(file) path = os.path.abspath(file) print(path) subprocess.Popen(path) localtime = time.asctime(time.localtime(time.time())) print(arr + " opened at " + localtime + "\n")
When args = 'firefox', this is outputted:
firefox.exe C:\firefox.exe Traceback (most recent call last): File "C:\Python33\lib\subprocess.py", line 1090, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
Any suggestions? Thanks!
Edited 4 Years Ago by PhilEaton