Bugs item #3066934, was opened at 2010-09-15 17:12 Message generated for change (Comment added) made by xqt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3066934...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: category Group: None
Status: Pending
Resolution: None Priority: 7 Private: No Submitted By: Daniel Barrett (djbarrett)
Assigned to: xqt (xqt)
Summary: AttributeError: type object 'Timestamp' has no attribute 'st
Initial Comment: category.py is throwing the error in the Summary. MediaWiki 1.15.4,
$ sudo python category.py move -from:"AABBCC" -to:"DD" Traceback (most recent call last): File "/usr/local/pywikipedia/pagegenerators.py", line 1238, in __iter__ for loaded_page in self.preload(somePages): File "/usr/local/pywikipedia/pagegenerators.py", line 1257, in preload pywikibot.getall(site, pagesThisSite) File "/usr/local/pywikipedia/wikipedia.py", line 4208, in getall _GetAll(site, pages, throttle, force).run() File "/usr/local/pywikipedia/wikipedia.py", line 3887, in run xml.sax.parseString(data, handler) File "/usr/lib64/python2.4/xml/sax/__init__.py", line 49, in parseString parser.parse(inpsrc) File "/usr/lib64/python2.4/xml/sax/expatreader.py", line 107, in parse xmlreader.IncrementalParser.parse(self, source) File "/usr/lib64/python2.4/xml/sax/xmlreader.py", line 123, in parse self.feed(buffer) File "/usr/lib64/python2.4/xml/sax/expatreader.py", line 207, in feed self._parser.Parse(data, isFinal) File "/usr/lib64/python2.4/xml/sax/expatreader.py", line 303, in end_element self._cont_handler.endElement(name) File "/usr/local/pywikipedia/xmlreader.py", line 202, in endElement self.callback(entry) File "/usr/local/pywikipedia/wikipedia.py", line 3923, in oneDone page2._versionhistory = [(revisionId, str(Timestamp.fromtimestampformat(timestamp)), username, entry.comment)] File "/usr/local/pywikipedia/pywikibot/__init__.py", line 47, in fromtimestampformat return cls.strptime(ts, cls.mediawikiTSFormat) AttributeError: type object 'Timestamp' has no attribute 'strptime' type object 'Timestamp' has no attribute 'strptime' Getting [[Category:AABBCC]]... Getting [[Category:AABBCC]]... Couldn't delete Category:AABBCC - not empty.
$ python version.py Pywikipedia [http] trunk/pywikipedia (r8562, 2010/09/15, 12:54:46) Python 2.4.3 (#1, Sep 3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] config-settings: use_api = True use_api_login = True
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2010-09-15 19:34
Message: I haven't found this error. Could you verify some things via idle: import wikipedia as wp t = time.strftime("%Y%m%d%H%M%S",time.gmtime()) t
this should print sth like '20100915172517'
wp.Timestamp.
Please hold this dot and you'll see availlable methods
wp.Timestamp.fromtimestampformat(t)
produces
Timestamp(2010, 9, 15, 17, 31, 53)
str(wp.Timestamp.fromtimestampformat(t))
produces
'2010-09-15T17:31:53Z'
Please also give me your sys.path()
----------------------------------------------------------------------
Comment By: Daniel Barrett (djbarrett) Date: 2010-09-15 17:22
Message: The bug was introduced in revision 8562:
svn diff -c8562 Index: wikipedia.py =================================================================== --- wikipedia.py (revision 8561) +++ wikipedia.py (revision 8562) @@ -2559,8 +2559,11 @@ dataQuery = self._versionhistoryearliest else: thisHistoryDone = True - elif not hasattr(self, '_versionhistory') or forceReload: + elif not hasattr(self, '_versionhistory') or forceReload or \ + len(self._versionhistory) < revCount: self._versionhistory = [] + # ?? does not load if len(self._versionhistory) > revCount + # shouldn't it elif getAll and len(self._versionhistory) == revCount: # Cause a reload, or at least make the loop run thisHistoryDone = False @@ -3907,7 +3910,7 @@ successful = False for page2 in self.pages: if page2.sectionFreeTitle() == page.sectionFreeTitle(): - if not (hasattr(page2,'_contents') or hasattr(page2,'_getexception')) or self.force: + if not (hasattr(page2,'_contents') or hasattr(page2, '_getexception')) or self.force: page2.editRestriction = entry.editRestriction page2.moveRestriction = entry.moveRestriction if editRestriction == 'autoconfirmed': @@ -3917,6 +3920,7 @@ page2._ipedit = ipedit page2._revisionId = revisionId page2._editTime = timestamp + page2._versionhistory = [(revisionId, str(Timestamp.fromtimestampformat(timestamp)), username, entry.comment)] section = page2.section() # Store the content page2._contents = text
----------------------------------------------------------------------
Comment By: Daniel Barrett (djbarrett) Date: 2010-09-15 17:16
Message: Note: the example did create category "DD" but did not recategorize the page in the AABBCC category. (There is only one page in the category.)
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3066934...
pywikipedia-bugs@lists.wikimedia.org