os.unlink on Windows
thomas at jollans.com
Sat Aug 7 13:46:13 CEST 2010
On 08/07/2010 01:10 PM, Shambhu Sharma wrote:
> I am new to Python. I was trying to use os.unlink function in
> windows. But i am getting error:
> OSError: [Errno 2] No such file or directory:
> Input file to os.unlink is: 'C:\SHAMBHU\tmp\text_delete.txt'. But
> os.unlink is adding extra backslash with pathname.
No, it isn't. What you're seeing is simply the repr() of the path name
>>> p = r'C:\SHAMBHU\tmp\text_delete.txt'
I think the file you're trying to delete probably doesn't exist. Why
don't you double-check that.
> I tried with
> Python2.5 and Python3.1 but got same error.
> Please suggest how to remove this error.
> If linux doesn't have a solution, then u have a wrong problem.
> Shambhu Kumar Sharma
> 91-98864 91913
More information about the Python-list