[Tutor] bug in uu library module?

Michael P. Reilly arcege@speakeasy.net
Mon, 23 Jul 2001 11:43:44 -0400 (EDT)


Rick Pasotto wrote
> I'm working on a program that needs to uudecode some files. The first
> line of a uuencoded file is 'begin [mode] [filename]'. The library
> module uses string.split to parse this line. If the filename has spaces
> in it the module does not recognize the line since it has more than
> three fields.
> 
> What is the best way to deal with this?

Flog the person to send you silly filenames with spaces? ;)

> Should I cut-n-paste the library code into my program and then change
> that? Would it be better to re-write the file changing the 'begin' line
> by substituting underscores for spaces in the output file name?

I would suggest that latter; unless you wish to upgrade.

> And finally, is this a bug? Spaces in filenames create all sorts of
> havoc but it looks like they're here to stay and we need to deal with
> them.

It is a bug only in that uudecode(1) can handle filenames with spaces
but uu.py cannot.  (Not that it is a bug that spaces are allowed. ;))

It is fixed in Python 2.1, but not in Python 1.5.2 or 2.0.

  -Arcege

-- 
+----------------------------------+-----------------------------------+
| Michael P. Reilly                | arcege@speakeasy.net              |