Dalba added a comment.
Sorry, It seems that I missed this -- seemingly related -- warning message when importing pywikibot:
import sys sys.path.append('c:/core') import pywikibot as pwb
WARNING: Running on Windows and transliteration_target is not set. Please see https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Pywikibot/Windows exception UnsupportedOperation('fileno',) while fixing up sys.stdout and sys.stderr
@Sitic: It works fine in command prompt.
@XZise: I applied the patch and now it logs in successfully. But still got the following error when trying to save a test edit:
p= pwb.Page(pwb.Site('fa'), 'ویکیپدیا:صفحه تمرین') p.put('تمرين', ' ')
Page [[fa:وyکyپدyا:صفحه تمرyن]] saved Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> p.put('تمرين', ' ') File "c:/core\pywikibot\page.py", line 1117, in put **kwargs) File "c:/core\pywikibot\tools__init__.py", line 930, in wrapper return obj(*__args, **__kw) File "c:/core\pywikibot\page.py", line 1036, in save **kwargs) File "c:/core\pywikibot\page.py", line 1052, in _save pywikibot.output(u"Page %s saved" % link) File "c:/core\pywikibot\bot.py", line 457, in output logoutput(text, decoder, newline, INFO, **kwargs) File "c:/core\pywikibot\bot.py", line 427, in logoutput logger.log(_level, text, extra=context, **kwargs) File "C:\Python34\lib\logging__init__.py", line 1341, in log self._log(level, msg, args, **kwargs) File "C:\Python34\lib\logging__init__.py", line 1409, in _log self.handle(record) File "C:\Python34\lib\logging__init__.py", line 1419, in handle self.callHandlers(record) File "C:\Python34\lib\logging__init__.py", line 1481, in callHandlers hdlr.handle(record) File "C:\Python34\lib\logging__init__.py", line 853, in handle self.emit(record) File "c:/core\pywikibot\userinterfaces\terminal_interface_base.py", line 434, in emit return self.UI.output(text, targetStream=self.stream) File "c:/core\pywikibot\userinterfaces\terminal_interface_base.py", line 191, in output self._print(text, targetStream) File "c:/core\pywikibot\userinterfaces\terminal_interface_base.py", line 132, in _print self.printColorized(text, targetStream) File "c:/core\pywikibot\userinterfaces\terminal_interface_win32.py", line 99, in printColorized targetStream.write(text.encode(self.encoding, 'replace')) File "C:\Python34\lib\idlelib\PyShell.py", line 1344, in write raise TypeError('must be str, not ' + type(s).__name__) TypeError: must be str, not bytes
(Although the edit was saved.) Should I open another task for that?
TASK DETAIL https://phabricator.wikimedia.org/T91921
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Dalba Cc: gerritbot, XZise, Sitic, Aklapper, Dalba, jayvdb, pywikipedia-bugs