I am trying to use a copy command for Windows and we have directories such as c:\oracle.
While trying to execute one such, we get the following error:
source_file=folder+"\"
^
SyntaxError: Lexical error at line 17, column 23. Encountered: "\r" (13), after : ""
Here folder is my path of c:\oracle and while trying to add file to it like:
source=folder+"\"+src_file
I am not able to do so. Any suggestion on how to solve this issue?
I tried with / but my copy windows calling source in os.command is getting "the syntax is incorrect" and the only way to solve it is to use \ but I am getting the above error in doing so.
Please suggest. Thanks for your help
Thanks.
Short answer:
You need:
Long answer:
The problem with
is that
\is the escape character. What it’s doing in this particular case is escaping the"so that it’s treated as a character of the string rather than the string terminator, similar to:which would have the same problem.
In other words, you’re trying to construct a string consisting of
", some other text and the end of line (\r, the carriage return character). That’s where your error is coming from: