Python Forum
Subprocess.Popen() not working when reading file path from csv file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subprocess.Popen() not working when reading file path from csv file
#13
I still believe something is going wrong with the interpretation of special characters. For example: you can insert a "vertical tab" by asigning the literal: "\v".
See this:
>>> print("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe")
C:\Program Files\VideoLAN\VLC\vlc.exe
>>> print("C:\Program Files\VideoLAN\VLC\vlc.exe")
C:\Program Files\VideoLAN\VLC
                             lc.exe

>>> print("C:\\Program Files (x86)\\2BrightSparks\\SyncBackFree\\SyncBackFree.exe")
C:\Program Files (x86)\2BrightSparks\SyncBackFree\SyncBackFree.exe
>>> print("C:\Program Files (x86)\2BrightSparks\SyncBackFree\SyncBackFree.exe")
C:\Program Files (x86)BrightSparks\SyncBackFree\SyncBackFree.exe
In the first example ("C:\Program Files\VideoLAN\VLC\vlc.exe") you see the "\v" is replaced by a "vertical tab".
In the second example ("C:\Program Files (x86)\2BrightSparks\SyncBackFree\SyncBackFree.exe") you can see the "\2" is replaced by ... I don't know. It disappeared. Apparently it is seen as an octal code.

See String literals to see how backslashes are handled.
Could it be something like this is happening when assigning literals to strings?

I believe it is allowed in Python for Windows to use the forward slash instead of the backslash in folder paths. Perhaps you can try that.
Reply


Messages In This Thread
RE: Subprocess.Popen() not working when reading file path from csv file - by ibreeden - May-07-2021, 02:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Appending sys.path not working with spyder Larz60+ 2 743 Apr-11-2025, 08:50 AM
Last Post: Larz60+
  How to write variable in a python file then import it in another python file? tatahuft 4 1,157 Jan-01-2025, 12:18 AM
Last Post: Skaperen
  Get an FFMpeg pass to subprocess.PIPE to treat list as text file? haihal 2 1,245 Nov-21-2024, 11:48 PM
Last Post: haihal
  JSON File - extract only the data in a nested array for CSV file shwfgd 2 1,240 Aug-26-2024, 10:14 PM
Last Post: shwfgd
  FileNotFoundError: [Errno 2] No such file or directory although the file exists Arnibandyo 0 1,348 Aug-12-2024, 09:11 AM
Last Post: Arnibandyo
  import a function from another file using relative path paul18fr 6 3,941 Aug-01-2024, 06:40 AM
Last Post: paul18fr
  "[Errno 2] No such file or directory" (.py file) IbrahimBennani 13 7,410 Jun-17-2024, 12:26 AM
Last Post: AdamHensley
  Reading an ASCII text file and parsing data... oradba4u 2 1,618 Jun-08-2024, 12:41 AM
Last Post: oradba4u
  Understanding subprocess.Popen Pedroski55 6 2,384 May-12-2024, 10:46 AM
Last Post: Pedroski55
  File Handling not working properly TheLummen 8 4,262 Feb-17-2024, 07:47 PM
Last Post: TheLummen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020