May-29-2022, 03:37 AM
Using Python 3.7 on Windows 10 pro, I ran to the strange thing:
Path to vlc.exe on my PC is: C:\Program Files\VideoLAN\VLC\vlc.exe. In my script, I've defined it as: fullpath = "\"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\""
The strange thing is that when I run: subprocess.Popen(fullpath, stdout=None, stderr=None, stdin=None, close_fds=True), that works correctly, but when I run the:
os.system("taskkill /f /im " + fullpath) it fails with: ERROR: Invalid query. When I tested if the file exist with os.path.exists(fullpath) it returned False
I googled around and according to what I found, I think I defined path correctly, so I don't understand why it works with the subprocces.popen and not in other cases? BTW: I also replaced the double backslashes with single forward slashes but the issue remained the same
Path to vlc.exe on my PC is: C:\Program Files\VideoLAN\VLC\vlc.exe. In my script, I've defined it as: fullpath = "\"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\""
The strange thing is that when I run: subprocess.Popen(fullpath, stdout=None, stderr=None, stdin=None, close_fds=True), that works correctly, but when I run the:
os.system("taskkill /f /im " + fullpath) it fails with: ERROR: Invalid query. When I tested if the file exist with os.path.exists(fullpath) it returned False
I googled around and according to what I found, I think I defined path correctly, so I don't understand why it works with the subprocces.popen and not in other cases? BTW: I also replaced the double backslashes with single forward slashes but the issue remained the same