Why isn't my os.rename working?
- by Alex
Hi All,
I'm trying to rename some files, but getting a baffling error*. When I run this:
if os.path.isfile(fullPath):
print 'fmf exists'
print fullPath
print newFilePath
os.rename(fullPath,newFilePath)
I get the following error:
fmf exists
(correct fullPath)
(correct newFilePath, ie. destination)
Traceback (most recent call last):
File "whatever.py", line 374, in ?
os.rename(fullPath,newFilePath)
OSError: [Errno 2] No such file or directory
Since I know that the file at fullPath exists, I'm baffled by the error. Of course, newFilePath doesn't exist, because that would be dumb. Any hints?
Thanks!
Alex
*Aren't they all?