summaryrefslogtreecommitdiffstats
path: root/Lib/uu.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-01-10 19:14:28 (GMT)
committerGuido van Rossum <guido@python.org>2001-01-10 19:14:28 (GMT)
commit62c11155eb13e950e10d660b8f5150e04efb3a5e (patch)
tree8cc30db3133cabc84daf72ea6124d2eac90bb926 /Lib/uu.py
parent3d15bd88063019352d11382f5d1b36b6845f65dc (diff)
downloadcpython-62c11155eb13e950e10d660b8f5150e04efb3a5e.zip
cpython-62c11155eb13e950e10d660b8f5150e04efb3a5e.tar.gz
cpython-62c11155eb13e950e10d660b8f5150e04efb3a5e.tar.bz2
Adapted version of SF Patch #103173 by pyretic: make uu.decode work
with spaces in filename. I changed the module to use string methods instead of the string module. Also, instead of stripping the last character of the filename (assuming this is the linefeed), I strip trailing whitespace (assuming creating files with trailing whitespace in their name cannot possibly be a wise idea). (Note that I believe that /F's "workaround for broken uuencoders" is no longer needed since the recent fix to binascii.c, but I'll leave it in since it appears pretty harmless.)
Diffstat (limited to 'Lib/uu.py')
-rwxr-xr-xLib/uu.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/uu.py b/Lib/uu.py
index 3856d69..bf1f82a 100755
--- a/Lib/uu.py
+++ b/Lib/uu.py
@@ -32,7 +32,6 @@ decode(in_file [, out_file, mode])
import binascii
import os
-import string
import sys
class Error(Exception):
@@ -97,17 +96,17 @@ def decode(in_file, out_file=None, mode=None):
raise Error, 'No valid begin line found in input file'
if hdr[:5] != 'begin':
continue
- hdrfields = string.split(hdr)
+ hdrfields = hdr.split(" ", 2)
if len(hdrfields) == 3 and hdrfields[0] == 'begin':
try:
- string.atoi(hdrfields[1], 8)
+ int(hdrfields[1], 8)
break
except ValueError:
pass
if out_file is None:
- out_file = hdrfields[2]
+ out_file = hdrfields[2].rstrip()
if mode is None:
- mode = string.atoi(hdrfields[1], 8)
+ mode = int(hdrfields[1], 8)
#
# Open the output file
#