[XML-SIG] [ pyxml-Bugs-614049 ] expatbuilder Unicode filenames on Win32

noreply@sourceforge.net noreply@sourceforge.net
Tue, 24 Sep 2002 14:14:13 -0700


Bugs item #614049, was opened at 2002-09-24 21:14
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=614049&group_id=6473

Category: DOM
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Lenihan (brianl)
Assigned to: Nobody/Anonymous (nobody)
Summary: expatbuilder Unicode filenames on Win32 

Initial Comment:
Trent Mick's go.by broke after installing PyXML 0.8.1
for Python 2.2.1

C:\Python22>go d
Traceback (most recent call last):
  File "C:\Python22\go.py", line 435, in ?
    sys.exit( main(sys.argv) )
  File "C:\Python22\go.py", line 380, in main
    generateShellScript(shellScript) # no-op, overwrite
old one
  File "C:\Python22\go.py", line 302, in
generateShellScript
    shortcuts = getShortcuts()
  File "C:\Python22\go.py", line 291, in getShortcuts
    dom = xml.dom.minidom.parse(shortcutsXml)
  File
"C:\Python22\Lib\site-packages\_xmlplus\dom\minidom.py",
line 1595, in parse
    return expatbuilder.parse(file)
  File
"C:\Python22\lib\site-packages\_xmlplus\dom\expatbuilder.py",
line 932, in parse
    result = builder.parseFile(file)
  File
"C:\Python22\lib\site-packages\_xmlplus\dom\expatbuilder.py",
line 170, in parseFile
    buffer = file.read(16*1024)
AttributeError: 'unicode' object has no attribute 'read'

getShortcuts is using win32.shell.SHGetFolderPath to
find the shortcults.xml file and it returns a Unicode
string.

Lines 926 and 959 in expatbuilder.py both test whether
they have been handed a string or a file like this:

    if isinstance(file, type('')):
        fp = open(file, 'rb')
        result = builder.parseFile(fp)
        fp.close()
    else:
        result = builder.parseFile(file)

I worked around it by adding or isinstance(file, type(u''))

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=614049&group_id=6473