Skip to main content
deleted 7 characters in body; edited tags
Source Link
Cornelius Roemer
  • 10.4k
  • 6
  • 62
  • 122

I am trying to use a shutil script I found, but running it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new scripttriggers:

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14"))SyntaxError:  shutil.move(f, dest1) unterminated string elifliteral (f.startswith("Log 54")): detected at shutil.move(f,line dest24) 

This is maybe related to the script containing raw windows paths. How do I fix the script?

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 

I am trying to use a shutil script I found but it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14")):  shutil.move(f, dest1)  elif (f.startswith("Log 54")):  shutil.move(f, dest2) 

I am trying to use a shutil script I found, but running it triggers:

SyntaxError: unterminated string literal (detected at line 4) 

This is maybe related to the script containing raw windows paths. How do I fix the script?

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 
Post Closed as "Duplicate" by Trenton McKinney python
edited body
Source Link
Ric
  • 111
  • 1
  • 1
  • 4

I am trying to use a shutil script I found but it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52”\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59”\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 

I am trying to use a shutil script I found but it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52” dest3 = r" C:\Users\[username]\Desktop\Reports\59” files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 

I am trying to use a shutil script I found but it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52" dest3 = r" C:\Users\[username]\Desktop\Reports\59" files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 
improve formatting. Add relevant tags.
Source Link
wjandrea
  • 33.9k
  • 10
  • 69
  • 105

Raw strings containing Windows paths produce SyntaxError"SyntaxError: unterminated string literalliteral"

I am trying to use a shutil script I found but it receives "SyntaxError: unterminated string literal (detected at line 4)" errorSyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52” dest3 = r" C:\Users\[username]\Desktop\Reports\59” files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 

Raw strings containing Windows paths produce SyntaxError: unterminated string literal

I am trying to use a shutil script I found but it receives "SyntaxError: unterminated string literal (detected at line 4)" error. Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52” dest3 = r" C:\Users\[username]\Desktop\Reports\59” files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 

Raw strings containing Windows paths produce "SyntaxError: unterminated string literal"

I am trying to use a shutil script I found but it receives SyntaxError: unterminated string literal (detected at line 4). Any assistance would be appreciated to fixing this or new script

import shutil import os source = r"C:\Users\[username]\Downloads\" dest1 = r" C:\Users\[username]\Desktop\Reports\14" dest2 = r" C:\Users\[username]\Desktop\Reports\52” dest3 = r" C:\Users\[username]\Desktop\Reports\59” files = os.listdir(source) for f in files: if (f.startswith("Log 14")): shutil.move(f, dest1) elif (f.startswith("Log 54")): shutil.move(f, dest2) 
deleted 461 characters in body; edited title
Source Link
John Kugelman
  • 364.5k
  • 70
  • 555
  • 600
Loading
edited tags
Link
John Kugelman
  • 364.5k
  • 70
  • 555
  • 600
Loading
added 64 characters in body
Source Link
Ric
  • 111
  • 1
  • 1
  • 4
Loading
Source Link
Ric
  • 111
  • 1
  • 1
  • 4
Loading