I'm using the code below to read the zipped, base64 encoded WMF file saved in an XML file with "Save as XML" from MS Word. As the "At this point" comment shows, I know that the base64 decoding is going fine, but unzipping from the decodedVersion StringIO object isn't getting me anything, because the len(fileContent) call is returning 0. Any suggestions?
thanks, Bob ########################################### import sys, base64, gzip, StringIO infile = sys.argv[1] outfile = sys.argv[2] # When unencoding base64 file, write to a string that acts like a file decodedVersion = StringIO.StringIO() base64.decode(open(infile, 'r'),decodedVersion) # At this point, if we write out decodedVersion.getvalue() to a file, # gzip -d makes a proper wmf file from it, so we know everything's OK so far. # following based on # http://www.diveintopython.org/http_web_services/gzip_compression.html fileObj = gzip.GzipFile(fileobj=decodedVersion); fileContent = fileObj.read() print len(fileContent) -- http://mail.python.org/mailman/listinfo/python-list