Xqt added a comment.

@valhallasw

@Xqt: could you add a breakpoint/print statement to ... to figure out which stream this is going to? Is this the console or is it trying to log to a file?

I added:

stream = self.stream
print('>>>', msg, '<<<')
stream.write(msg)

with result:

>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  192 Liste der Staatsoberhäupter 937 v. Chr. <<<
 193 Motoko Ishii
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  193 Motoko Ishii <<<
 194 Dubičné
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  194 Dubičné <<<
--- Logging error ---
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\logging\__init__.py", line 995, i
n emit
    stream.write(msg)
  File "C:\Program Files (x86)\Python36-32\lib\encodings\cp1252.py", line 19, in
 encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u010d' in position
86: character maps to <undefined>
Call stack:
  File "C:\pwb\GIT\core\pwb.py", line 251, in <module>
    if not main():
  File "C:\pwb\GIT\core\pwb.py", line 244, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\pwb\GIT\core\pwb.py", line 115, in run_python_file
    main_mod.__dict__)
  File ".\scripts\listpages.py", line 283, in <module>
    main()
  File ".\scripts\listpages.py", line 261, in main
    pywikibot.stdout(output_list[-1])
  File "C:\pwb\GIT\core\pywikibot\logging.py", line 148, in stdout
    logoutput(text, decoder, newline, STDOUT, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\logging.py", line 109, in logoutput
    logger.log(_level, text, extra=context, **kwargs)
Message: ' 194 Dubičné'
Arguments: ()
 195 Fräulein Lausbub
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  195 Fräulein Lausbub <<<
 196 Louis Sosson
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  196 Louis Sosson <<<
 197 1. Division (Belgien) 1949/50
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  197 1. Division (Belgien) 1949/50 <<<
 198 Yalmakan FC
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  198 Yalmakan FC <<<
 199 Goldgrund (Begriffsklärung)
>>> 2018-07-05 18:14:49       listpages.py,  261 in               main: STDOUT
  199 Goldgrund (Begriffsklärung) <<<

and for print(stream) I got
<_io.TextIOWrapper name='C:\\pwb\\GIT\\core\\logs\\listpages-bot.log' mode='a' encoding='cp1252'>


TASK DETAIL
https://phabricator.wikimedia.org/T188231

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Xqt
Cc: Mpaa, Zoranzoki21, Dalba, Aklapper, pywikibot-bugs-list, valhallasw, Xqt, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to