os.remove / windows / spaces?

John Machin sjmachin at lexicon.net
Fri Mar 28 22:20:17 CET 2003

"j2" <spamfilter2 at mupp.net> wrote in message news:<3e8449f1$1_4 at read01.nntp.se.dataphone.net>...
> > RTFErrormessage. The argument path has " at each end -- not a valid
> > character in a path in Windows.
> Yes, but
> tempdir = 'u:\\Program\\Network Associates\\tvd\\updates\\temp\\'
> pubdir = 'u:\\Program\\Network Associates\\tvd\\updates\\'
> updateini = 'update.ini'
> If so, where does the double quotes come from?  I tried escaping hte space,
> but that didnt work. But the os.path.join worked.

(1) This is confusing. "tempdir" and "updateini" are not related to
your problem description!!

(2) os.path.join "worked" -- with one argument??? If called with only
one argument, it merely returns that argument.

[Mathias Waack]
Does os.remove(os.path.join(pubdir + OldZipFileName)) work?

j2, *exactly* what worked? Was it something like this:

os.remove(os.path.join(pubdir, OldZipFileName)) ???

I suggest you insert something like this just before the call to
   p1 = pubdir
   p2 = OldZipFileName
   for p in [p1, p2, p1+p2, os.path.join(p1+p2), os.path.join(p1,p2)]
      print len(p)
      print p
      print repr(p)
This may clue you in to what is happening.

I suspected that the extraneous quotes were inserted by the
error-handler when making up the error message, but I can't see that
in the source, and I can't reproduce it.

Please post what versions of Windows & Python you are using.

More information about the Python-list mailing list