Copying a file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Copying a file (/thread-20597.html) |
Copying a file - Kundan - Aug-21-2019 import shutil shutil.copy(“\\Om-pc\e\Office File\Access Original 14-16\Cash MAR.2017 TO APR.2019.accdb”, "C:\Users\KUNDAN\Desktop\Cash MAR.2017 TO APR.2019.accdb ") The above code is giving the following error: Traceback (most recent call last): File "C:\Users\KUNDAN\backup.py", line 2 shutil.copy(“\\Om-pc\e\Office File\Access Original 14-16\Cash MAR.2017 TO APR.2019.accdb”, "C:\Users\KUNDAN\Desktop\Cash MAR.2017 TO APR.2019.accdb ") ^ SyntaxError: invalid character in identifier RE: Copying a file - snippsat - Aug-21-2019 Use Code tag. You are mixing left double quotation mark with ordinary quotation mark. Next error will be here C:\U ,do not use single backslash \ in path because of escape character.Fixed it would be like this. import shutil shutil.copy("\\Om-pc\e\Office File\Access Original 14-16\Cash MAR.2017 TO APR.2019.accdb", r"C:\Users\KUNDAN\Desktop\Cash MAR.2017 TO APR.2019.accdb") |