[issue23454] plistlib and xml.parsers.expat python3 problems with strings and bytes

2015-02-12 Thread Ulrich Dorsch

New submission from Ulrich Dorsch:

TypeError: startswith first arg must be str or a tuple of str, not bytes

In line 558 of plistlib.py at the beginnging of def _is_fmt_xml(header) is 
the problem, caused by the use of the byte arguments defined in line 555 
(prefixes = (b'?xml', b'plist')).

Similar Problem in line 572:
header.startswith(bom). bom is of type bytes.

FIX: change the definition to:
line 555: prefixes = ('?xml', 'plist')
line 572: header.startswith(str(bom))

Remaining problem is:
TypeError: read() did not return a bytes object (type=str)

This occurs in the parser object generated by ParserCreate() from 
xml.parsers.expat

I stopped there with tracing / resolving the problem.

--
components: Library (Lib)
messages: 235828
nosy: Ulrich.Dorsch
priority: normal
severity: normal
status: open
title: plistlib and xml.parsers.expat python3 problems with strings and bytes
type: crash
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23454
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23454] plistlib and xml.parsers.expat python3 problems with strings and bytes

2015-02-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

All correct. plistlib.load() requires binary file object as documented [1].

[1] https://docs.python.org/3/library/plistlib.html#plistlib.load

--
nosy: +ronaldoussoren, serhiy.storchaka
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23454
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com