$ python3 pwb.py makecat TEST -lang:en -family:wikipedia Traceback (most recent call last): File "pwb.py", line 263, in <module> if not main(): File "pwb.py", line 257, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 121, in run_python_file main_mod.__dict__) File "./scripts/makecat.py", line 224, in <module> 'category', workingcatname.encode('ascii', 'xmlcharrefreplace') + '_exclude.txt') TypeError: can't concat bytes to str <class 'TypeError'> CRITICAL: Closing network session.
Description
Description
Details
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[bugfix] Don't use mixed bytestring and unicode for filename | pywikibot/core | master | +3 -1 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Invalid | None | T72936 Important tasks to be solved (tracking) | |||
Resolved | Xqt | T60053 Pywikibot Python 3 compatibility (tracking) | |||
Resolved | Xqt | T163349 makecat.py fails under python 3: TypeError: can't concat bytes to str |
Event Timeline
Comment Actions
the problem is in config2.py.makepath or datafilepath. I think bytestrings are reqired not unicode or these os methods.
Comment Actions
workingcatname.encode('ascii', 'xmlcharrefreplace') + '_exclude.txt')
This is wrong -- workingcatname.encode('ascii', 'xmlcharrefreplace') will create a bytes object, and this cannot be concatenated with the '_exclude.txt' string.
workingcatname.encode('ascii', 'xmlcharrefreplace').decode('ascii') + '_exclude.txt'
should be OK.
Comment Actions
Change 365449 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Don't use mixed bytestring and unicode for filename
Comment Actions
Change 365449 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Don't use mixed bytestring and unicode for filename