Python Forum

Full Version: my python is popping up the error FileNotFoundError: [WinError 3] ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import os
path="C:\\User\\Desktop\\sr.txt"
os.chdir(path)
retval=os.getcwd()
print("Directory changed successfully %s" %retval)
#can the members or author of this forum plzz help me iam getting this error even after creating the test file named above on the desktop and i have given the correct path of the file it seems i wanna know how i'm getting this error and how i can resolve the following error
#ERROR:
Traceback (most recent call last):
File "C:\Users\Personal\AppData\Local\Programs\Python\Python36\os.chdir().py", line 3, in <module>
os.chdir(path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\User\\Desktop\\sr.txt'
'sr.txt' is not part of the path, it is the destination. Remove it from the path variable and it will work fine.
i am giving you a warning as this is not the first time a mod spoke to you about it, nor second time you posted code with proper tags. I wont even respond to any of your posts because you are not following the rules.
I see some code.  Is there a question attached?  Or do you just want someone to describe the error message?