[Pywikipedia-bugs] [Maniphest] [Commented On] T149672: category.py with OAuth: don't abort if the username does not exist on other project

2016-11-01 Thread Ladsgroup
Ladsgroup added a comment.
My bot is cleaning as much as it canTASK DETAILhttps://phabricator.wikimedia.org/T149672EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: LadsgroupCc: Ladsgroup, Aklapper, MarcoAurelio, pywikibot-bugs-list, MayS, Mdupont, JJMC89, jayvdb, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Commented On] T142155: Bot can't login. keyError in GetCookie

2016-11-01 Thread Vladis13
Vladis13 added a comment.
Work nothing: login, Oauth, Botpassword. :(
I don't understand, there the common login has broken at past week and it temporary bug? Or it forever, now only Oauth, which dont work?TASK DETAILhttps://phabricator.wikimedia.org/T142155EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: Legoktm, Vladis13Cc: Vladis13, Gallicbot, Krinkle, MZMcBride, Jay8g, revi, Paladox, Aschroet, zhuyifei1999, Stashbot, gerritbot, DrTrigon, Betacommand, Lokal_Profil, Tgr, Legoktm, JJMC89, Yamaha5, jayvdb, Ladsgroup, Xqt, valhallasw, Multichill, Anomie, CodeCat, TerraCodes, Luke081515, He7d3r, Basilicofresco, Jagwar, MarcoAurelio, Dalba, Aklapper, Joutbis, pywikibot-bugs-list, MayS, Mdupont, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Edited] T149747: weblinkchecker.py goes into infinite loop when running on free software directory

2016-11-01 Thread iank
iank edited the task description. (Show Details)
EDIT DETAILS...```


When running with "python3 -m traceWhen running with "python3 -m trace --trace", --trace"the output ends up in thisan infinite loop (3 iterations pasted):...TASK DETAILhttps://phabricator.wikimedia.org/T149747EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: iankCc: Aklapper, pywikibot-bugs-list, iank___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Created] T149747: weblinkchecker.py goes into infinite loop when running on free software directory

2016-11-01 Thread iank
iank created this task.iank added a project: Pywikibot-weblinkchecker.py.Herald added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTIONAt least 50% of the time, it hangs until I kill it.

To repro, I populate a user config, then

python generate_family_file.py https://directory.fsf.org/wiki/Main_Page
python3 pwb.py weblinkchecker.py -log -max_external_links:15 -start:!

When running with "python3 -m trace --trace" output ends up in this loop (3 iterations pasted):

weblinkchecker.py(864): while threading.activeCount() >= config.max_external_links:
 --- modulename: threading, funcname: active_count
threading.py(1245): with _active_limbo_lock:
threading.py(1246): return len(_active) + len(_limbo)
weblinkchecker.py(865): time.sleep(config.retry_wait)
weblinkchecker.py(864): while threading.activeCount() >= config.max_external_links:
 --- modulename: threading, funcname: active_count
threading.py(1245): with _active_limbo_lock:
threading.py(1246): return len(_active) + len(_limbo)
weblinkchecker.py(865): time.sleep(config.retry_wait)
weblinkchecker.py(864): while threading.activeCount() >= config.max_external_links:
 --- modulename: threading, funcname: active_count
threading.py(1245): with _active_limbo_lock:
threading.py(1246): return len(_active) + len(_limbo)
weblinkchecker.py(865): time.sleep(config.retry_wait)

I tried running with -max_external_links:2 and got the same issue

The log file just stops after processing what seems like some random amount of pages. For example, in the log for the last run, you see normal output, then frozen for over a day when I killed it:

2016-10-31 06:19:27 bot.py, 1231 in   current_page: STDOUT   Working on 'Appctl'
2016-10-31 06:20:03 bot.py, 1231 in   current_page: STDOUT   Working on 'Appdirs'
2016-10-31 06:20:04  weblinkchecker.py,  588 inrun: INFO *[[Appctl]] links to http://sourceforge.net/tracker/?group_id=150275 - 404 Not Found.
2016-11-01 13:20:30 bot.py, 1452 inrun: INFO 
KeyboardInterrupt during WeblinkCheckerRobot bot run...
2016-11-01 13:20:30 bot.py, 1370 in   exit: INFO 
607 pages read
0 pages written
2016-11-01 13:20:30 bot.py, 1379 in   exit: INFO Execution time: 1 days, 26350 seconds
2016-11-01 13:20:30 bot.py, 1384 in   exit: INFO Read operation time: 185 seconds
2016-11-01 13:20:30 bot.py, 1392 in   exit: INFO Script terminated successfully.

I've attached the last few thousand lines before the infinite loop from the tracing run: F4686276: pywikibot-hang-trace-tail.log

It hangs on both python2 and python3.

I'm running on debian stretch. 
I have python3-requests package installed, version 2.11.1-1
Pywikibot is from git, commit 62ba14a1825, oct 27 2016.TASK DETAILhttps://phabricator.wikimedia.org/T149747EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: iankCc: Aklapper, pywikibot-bugs-list, iank___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Updated] T147654: win32_unicode does not correctly handle different console configurations under Python 3

2016-11-01 Thread Dalba
Dalba added a comment.
For me, the current patch also fails on redirecting output when win-unicode-console is installed:


G:\PATH>pywikibot-core\pwb.py listpages -lang:cs -cat:Obce_v_departementu_Essonne > out.txt
C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\site-packages\win_unicode_console\__init__.py:31: RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == 'cp1252', readline hook consumer may assume they are the same
  readline_hook.enable(use_pyreadline=use_pyreadline)
Cannot find buffer interface for stdout, stderr or stdin.
Using (incorrect) text interfaces instead. This is likely to
break on non-ascii text.
.write: TypeError('write() argument must be str, not bytes',)
Traceback (most recent call last):
  File "G:\PATH\pywikibot-core\pwb.py", line 255, in 
if not main():
  File "G:\PATH\pywikibot-core\pwb.py", line 249, in main
run_python_file(filename, [filename] + args, argvu, file_package)
  File "G:\PATH\pywikibot-core\pwb.py", line 121, in run_python_file
main_mod.__dict__)
  File "G:\PATH\pywikibot-core\scripts\listpages.py", line 282, in 
main()
  File "G:\PATH\pywikibot-core\scripts\listpages.py", line 260, in main
pywikibot.stdout(output_list[-1])
  File "G:\PATH\pywikibot-core\pywikibot\logging.py", line 146, in stdout
logoutput(text, decoder, newline, STDOUT, **kwargs)
  File "G:\PATH\pywikibot-core\pywikibot\logging.py", line 107, in logoutput
logger.log(_level, text, extra=context, **kwargs)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1345, in log
self._log(level, msg, args, **kwargs)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1415, in _log
self.handle(record)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1425, in handle
self.callHandlers(record)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1487, in callHandlers
hdlr.handle(record)
  File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 855, in handle
self.emit(record)
  File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 526, in emit
return self.UI.output(text, targetStream=self.stream)
  File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 245, in output
self._print(text, targetStream)
  File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 184, in _print
self._write(text, target_stream)
  File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 146, in _write
target_stream.write(text)
  File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\win32_unicode.py", line 150, in write
self._stream.write(text)
TypeError: write() argument must be str, not bytes
CRITICAL: Closing network session.

Therefore I guess that it also won't work on Python 3.6 where PEP 528 is accepted and implements essentially the same modifications as win_unicode_console.

I've uploaded a new patch. To summarize:


win_unicode_consolepatchresult
disabledold*TypeError:write() argument must be str, not bytes
disabledcurrent*OK
enabledoldTypeError: write() argument must be str, not bytes
enabledcurrentTypeError: write() argument must be str, not bytes
disablednew*OK
enablednewOK





old: before cc2cb51c1c94bb2d080b6ba28a520ea7442eb656
current: after cc2cb51c1c94bb2d080b6ba28a520ea7442eb656
new: The new patch that I've uploaded.
TASK DETAILhttps://phabricator.wikimedia.org/T147654EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: valhallasw, DalbaCc: Dalba, David.Mirth, gerritbot, valhallasw, Xqt, Aklapper, pywikibot-bugs-list, Wesalius, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, jayvdb, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Changed Subscribers] T149672: category.py with OAuth: don't abort if the username does not exist on other project

2016-11-01 Thread MarcoAurelio
MarcoAurelio added a subscriber: Ladsgroup.MarcoAurelio added a comment.
@Ladsgroup Maybe your "Dexbot" could be run on olowiki so old interwiki links are added/migrated to Wikidata, while we await resolution on this one? (olowiki is now part of the global bot policy so Dexbot edits won't be a problem there). Thanks!TASK DETAILhttps://phabricator.wikimedia.org/T149672EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: MarcoAurelioCc: Ladsgroup, Aklapper, MarcoAurelio, pywikibot-bugs-list, MayS, Mdupont, JJMC89, jayvdb, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Created] T149672: category.py with OAuth: don't abort if the username does not exist on other project

2016-11-01 Thread MarcoAurelio
MarcoAurelio created this task.MarcoAurelio added projects: Pywikibot-core, Pywikibot-category.py.Herald added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTIONWhen removing Category:Wp/olo on olo.wikipedia.org (a relict left from importing the site from incubator), the bot systematically fails and abort if the page where the category is to be removed has an interwiki link (old-style, not wikidata) and the bot account is not registered on that site. I'm not sure if that's the desired behaviour.

WARNING: API error mwoauth-invalid-authorization-invalid-user: The authorization headers in your request are for a user that does not exist here
ERROR: Fatal error:
Traceback (most recent call last):
  File ".\scripts\category.py", line 1282, in main
bot.run()
  File ".\scripts\category.py", line 574, in run
self._change(pagegenerators.CategorizedPageGenerator(self.oldcat))
  File ".\scripts\category.py", line 615, in _change
sortKey=self.keep_sortkey)
  File "F:\MWDEV\pywikibot-core\pywikibot\page.py", line 2073, in change_category
newtext = textlib.replaceCategoryLinks(oldtext, cats)
  File "F:\MWDEV\pywikibot-core\pywikibot\textlib.py", line 1246, in replaceCategoryLinks
interwiki = getLanguageLinks(s2, insite=site)
  File "F:\MWDEV\pywikibot-core\pywikibot\tools\__init__.py", line 1447, in wrapper
return obj(*__args, **__kw)
  File "F:\MWDEV\pywikibot-core\pywikibot\textlib.py", line 856, in getLanguageLinks
result[site] = pywikibot.Page(site, pagetitle)
  File "F:\MWDEV\pywikibot-core\pywikibot\tools\__init__.py", line 1447, in wrapper
return obj(*__args, **__kw)
  File "F:\MWDEV\pywikibot-core\pywikibot\tools\__init__.py", line 1447, in wrapper
return obj(*__args, **__kw)
  File "F:\MWDEV\pywikibot-core\pywikibot\page.py", line 2178, in __init__
super(Page, self).__init__(source, title, ns)
  File "F:\MWDEV\pywikibot-core\pywikibot\page.py", line 160, in __init__
self._link = Link(title, source=source, defaultNamespace=ns)
  File "F:\MWDEV\pywikibot-core\pywikibot\page.py", line 4939, in __init__
self._defaultns = self._source.namespaces[defaultNamespace]
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 1014, in namespaces
self._namespaces = NamespacesDict(self._build_namespaces())
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 2610, in _build_namespaces
is_mw114 = MediaWikiVersion(self.version()) >= MediaWikiVersion('1.14')
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 2717, in version
version = self.siteinfo.get('generator', expiry=1).split(' ')[1]
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 1676, in get
preloaded = self._get_general(key, expiry)
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 1622, in _get_general
default_info = self._get_siteinfo(props, expiry)
  File "F:\MWDEV\pywikibot-core\pywikibot\site.py", line 1548, in _get_siteinfo
data = ""
  File "F:\MWDEV\pywikibot-core\pywikibot\data\api.py", line 2342, in submit
self._data = super(CachedRequest, self).submit()
  File "F:\MWDEV\pywikibot-core\pywikibot\data\api.py", line 2175, in submit
% (self.site, info))
pywikibot.exceptions.NoUsername: Failed OAuth authentication for wikipedia:hif: The authorization headers in your request are for a user that does not exist here
F:\MWDEV\pywikibot-core>

Thank you.TASK DETAILhttps://phabricator.wikimedia.org/T149672EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: MarcoAurelioCc: Aklapper, MarcoAurelio, pywikibot-bugs-list, MayS, Mdupont, JJMC89, jayvdb, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs