Rubin16 created this task. Rubin16 added a subscriber: Rubin16. Rubin16 added a project: pywikibot-core. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION The bot says that template isn't found though it's actually present and is mentioned in the code: ``` C:\pt2>c:\python27\python.exe pwb.py nowcommons.py -replaceloose -replace -v The base directory is C:\pt2 === Pywikibot framework v2.0 -- Logging header === COMMAND: ['nowcommons.py', '-replaceloose', '-replace', '-v'] DATE: 2015-04-26 12:25:18.418000 UTC svnversion failed WARNING: C:\pt2\pywikibot\version.py:97: DeprecationWarning: pywikibot.version.g etversion_svn is deprecated, use getversion_svn_setuptools instead. (tag, rev, date, hsh) = vcs_func(_program_dir)
WARNING: C:\pt2\pywikibot\version.py:245: DeprecationWarning: pywikibot.version. svn_rev_info is deprecated, use getversion_svn_setuptools instead. tag, rev, date = svn_rev_info(_program_dir)
VERSION: pywikibot/__init__.py (, -1 (unknown), 2015/04/26, 13:50:19, n/a) CONFIG FILE DIR: C:\pt2 PACKAGES: BaseHTTPServer (c:\python27\lib\BaseHTTPServer.pyc) = 0.3 SimpleHTTPServer (c:\python27\lib\SimpleHTTPServer.pyc) = 0.6 SocketServer (c:\python27\lib\SocketServer.pyc) = 0.4 Tkinter (c:\python27\lib\lib-tk\Tkinter.pyc) = $Revision: 81008 $ _ctypes (c:\python27\DLLs_ctypes.pyd) = 1.1.0 _hashlib (c:\python27\DLLs_hashlib.pyd) = ?? _socket (c:\python27\DLLs_socket.pyd) = ?? _sqlite3 (c:\python27\DLLs_sqlite3.pyd) = ?? _ssl (c:\python27\DLLs_ssl.pyd) = ?? _tkinter (c:\python27\DLLs_tkinter.pyd) = ?? cgi (c:\python27\lib\cgi.pyc) = 2.6 ctypes (c:\python27\lib\ctypes) = 1.1.0 distutils (c:\python27\lib\distutils) = 2.7.9 email (c:\python27\lib\email) = 4.0.3 logging (c:\python27\lib\logging) = 0.5.1.2 mwparserfromhell: No module named mwparserfromhell pickle (c:\python27\lib\pickle.pyc) = $Revision: 72223 $ platform (c:\python27\lib\platform.pyc) = 1.0.7 pyexpat (c:\python27\DLLs\pyexpat.pyd) = 2.7.9 pywikibot ([path unknown]) = ?? re (c:\python27\lib\re.pyc) = 2.2.1 select (c:\python27\DLLs\select.pyd) = ?? setuptools (c:\python27\lib\site-packages\setuptools) = 7.0 tkFont (c:\python27\lib\lib-tk\tkFont.pyc) = 0.9 unicodedata (c:\python27\DLLs\unicodedata.pyd) = ?? urllib (c:\python27\lib\urllib.pyc) = 1.17 urllib2 (c:\python27\lib\urllib2.pyc) = 2.7 MODULES: === === === === === === === === === === === === === === Pywikibot SVN repository Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] LOADING SITE wikipedia:ru VERSION: 1.26wmf2 Found 2 wikipedia:ru processes running, including this one. Retrieving 50 pages from wikipedia:ru. Working on u'\u0424\u0430\u0439\u043b:Ptz al vet.jpg'
Файл:Ptz al vet.jpg <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Ptz-al-pobr.jpg'
Файл:Ptz-al-pobr.jpg <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Magas-4.PNG'
Файл:Magas-4.PNG <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Groz-11.PNG'
Файл:Groz-11.PNG <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Groz-12.PNG'
Файл:Groz-12.PNG <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Groz-13.PNG'
Файл:Groz-13.PNG <<<
NowCommons template not found. Working on u'\u0424\u0430\u0439\u043b:Groz-14.PNG'
```
See [[https://ru.wikipedia.org/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Groz-14.PNG%7C file ]]: it has {{NowCommons}} template, mentioned in line 153 of nowcommons.py
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: Rubin16 Cc: pywikipedia-bugs, Aklapper, Rubin16, jayvdb
XZise added a subscriber: XZise. XZise added a comment.
Hmm I where does Файл:Groz-14.PNG https://ru.wikipedia.org/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Groz-14.PNG have a now commons template? In line 333 of nowcommons.py it's searching through the contents of that page and looking for the template. As that page is not hosted on the Russian Wikipedia anymore that won't work.
s = pywikibot.Site('ru', 'wikipedia') p = pywikibot.Page(s, 'Файл:Groz-14.PNG') list(p.templatesWithParams())
[]
And (if I interpret that correctly), the file was moved on 2015-04-13 and you've run your script 13 days later.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: XZise Cc: XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
Rubin16 added a comment.
Oops, I have already deleted it.
When I ran the script, the file was the following: https://ru.wikipedia.org/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Groz-14.PNG
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: Rubin16 Cc: XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
XZise added a comment.
Ah okay, I tested it with that:
import pywikibot s = pywikibot.Site('ru', 'wikipedia') p = pywikibot.Page(s, 'Файл:Groz-14.PNG') t = list(p.templatesWithParams()) list(p.templatesWithParams())
[(Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:\xd0\x98\xd0\xb7\xd0\xbe\xd0\xb1\xd1\x80\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5'), ['Время создания=2010', 'Источник=Станислав Гайдук', 'Автор=Станислав Гайдук', 'Описание=Грозный, фонтан, 2010 год.']), (Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:PD-self'), []), (Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:NowCommons'), [])]
[_[0] for _ in t]
[Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:\xd0\x98\xd0\xb7\xd0\xbe\xd0\xb1\xd1\x80\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5'), Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:PD-self'), Page(b'\xd0\xa8\xd0\xb0\xd0\xb1\xd0\xbb\xd0\xbe\xd0\xbd:NowCommons')]
[_[0] in ['NowCommons'] for _ in t]
[False, False, False]
[_[0].title(withNamespace=False) in ['NowCommons'] for _ in t]
[False, False, True]
So I think at some point templatesWithParams returned a Page instance instead of a string and nowcommons hasn't been updated.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: XZise Cc: XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
XZise added a comment.
Okay I checked and compat does use strings while core uses since https://phabricator.wikimedia.org/rPWBC55d6232edd0edb379076e020383a150708178... Page instances. And the script was committed in https://phabricator.wikimedia.org/rPWBC00dee9ab8e37111c66943d00332845b930690... with the code regarding the templates as it is now.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: XZise Cc: XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
gerritbot added a subscriber: gerritbot. gerritbot added a comment.
Change 206759 had a related patch set uploaded (by XZise): [FIX] Expect that the template is a Page instance
https://gerrit.wikimedia.org/r/206759
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: gerritbot Cc: gerritbot, XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: gerritbot Cc: gerritbot, XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 206759 merged by jenkins-bot: [FIX] Expect that the template is a Page instance
https://gerrit.wikimedia.org/r/206759
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: gerritbot Cc: gerritbot, XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
Xqt closed this task as "Resolved". Xqt claimed this task.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: Xqt Cc: gerritbot, XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
XZise claimed this task. XZise set Security to None.
TASK DETAIL https://phabricator.wikimedia.org/T97248
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: XZise Cc: gerritbot, XZise, Aklapper, Rubin16, jayvdb, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org