Repository navigation
Fix TypeError: a bytes-like object is required, not 'str' - #9292
Conversation
|
|
||
| if six.PY3: | ||
| if isinstance(filename, bytes): | ||
| filename = filename.decode('utf-8', errors='replace') |
There was a problem hiding this comment.
Should probably use https://docs.python.org/3/library/os.html#os.fsdecode here?
For format I dunno what is the correct encoding; that probably is deep into the kpsewhich sources but I guess all relevant formats have ASCII compatible names so utf-8 should just be fine.
There was a problem hiding this comment.
Not sure the filesystem encoding is a better choice for a function searching for a file. Is this even relevant? MikTeX's kpsewhich does not find any non-ASCII file name.
There was a problem hiding this comment.
then perhaps add a comment that in practice the encoding is irrelevant -- other than being ASCII-compatible -- because you don't expect non-ASCII filenames to be found (to avoid later head-scratching as to why utf-8).
|
@cgohlke You mind if I push to your branch? |
|
@anntzer I added a line comment about the encoding. |
|
The doc failure is un-related and fixed on all the active branches. |
Backport PR #9292 on branch v2.1.x
Fix multipage_pdf.py failing on Python 3 (tested on Windows with matplotlib-2.1):