os.remove / windows / spaces?
Ben Hutchings
do-not-spam-ben.hutchings at businesswebsoftware.com
Fri Mar 28 06:21:13 EST 2003
In article <3e83f929$1_3 at read01.nntp.se.dataphone.net>, j2 wrote:
> How do i make the below be able to handle paths with spaces in it?
>
> os.remove(pubdir + OldZipFileName)
>
> Right now i get
>
> Traceback (most recent call last):
> File
> "C:\Python22\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
> line 310, in RunScript
> exec codeObject in __main__.__dict__
> File "C:\Scripts\AntiVirus\NAIUPT.py", line 184, in ?
> os.remove(pubdir + OldZipFileName)
> OSError: [Errno 22] Invalid argument: '"u:\\Program\\Network
> Associates\\tvd\\updates\\dat-4254.zip"'
>>>>
os.remove() has no problem with spaces in a filename. It does, however,
appear to have a problem with double-quotes around the filename. You'll
want to remove those, because they aren't part of the filename.
More information about the Python-list
mailing list