Last modified: 2014-09-12 21:42:23 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72760, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70760 - KeyError: 'edit' (missing token?)
KeyError: 'edit' (missing token?)
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Highest critical
: ---
Assigned To: Fabian
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-12 08:28 UTC by Nemo
Modified: 2014-09-12 21:42 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Nemo 2014-09-12 08:28:04 UTC
Related to 36ca8cd178464a9b78360e59a9193d3931ed0177 ?

$ python pwb.py replace.py -page:Meta:Sandbox -family:meta -lang:meta "-->" " -->" -v
The base directory is /home/nemobis/pwb/core
WARNING: Configuration variable 'flickr' is defined but unknown.
Misspelled?
=== Pywikibot framework v2.0 -- Logging header ===
COMMAND: ['replace.py', '-page:Meta:Sandbox', '-family:meta', '-lang:meta', '-->', ' -->', '-v']
DATE: 2014-09-12 08:26:11.014271 UTC
VERSION: [https] r-pywikibot-core.git (9affcaa, g4065, 2014/06/12, 15:27:31, n/a)
SYSTEM: ('Linux', 'tools-login', '3.2.0-59-virtual', '#90-Ubuntu SMP Tue Jan 7 23:02:33 UTC 2014', 'x86_64')
PACKAGES:
  distutils (/usr/lib/python2.7/distutils/) = 2.7.3
  email (/usr/lib/python2.7/email/) = 4.0.3
  httplib2 (/home/nemobis/pwb/core/externals/httplib2/python2/httplib2/) = 0.9
  json (/usr/lib/python2.7/json/) = 2.0.9
  logging (/usr/lib/python2.7/logging/) = 0.5.1.2
  mwparserfromhell (/usr/lib/python2.7/dist-packages/mwparserfromhell/) = 0.3.3
  pickle (/usr/lib/python2.7/pickle.pyc) = $Revision: 72223 $
  pywikibot (/home/nemobis/pwb/core/pywikibot/) = $Id: e25bdc0cabd94de228688730c24eb3f90e88f6eb $
  re (/usr/lib/python2.7/re.pyc) = 2.2.1
  urllib (/usr/lib/python2.7/urllib.pyc) = 1.17
  urllib2 (/usr/lib/python2.7/urllib2.pyc) = 2.7
MODULES:
  pywikibot/comms/http.py f2f6eaa 2014-09-12 07:56:28.691705
  pywikibot/data/api.py 0e846ae 2014-09-12 07:56:28.783707
  pywikibot/textlib.py 10088ac 2014-09-12 07:56:29.227719
  pywikibot/i18n.py e10ccbf 2014-09-12 07:56:29.123716
  pywikibot/comms/threadedhttp.py 790190b 2014-09-12 07:56:28.703705
  pywikibot/date.py 94f1dc7 2014-09-12 07:56:28.811708
  pywikibot/fixes.py 723631d 2014-09-12 07:56:29.115716
  pywikibot/exceptions.py 51880db 2014-09-12 07:56:28.855709
  pywikibot/site.py eb7cf93 2014-09-12 07:56:29.215719
  pywikibot/bot.py 357bc40 2014-09-12 07:56:28.659704
  pywikibot/throttle.py 003b522 2014-09-12 07:56:29.235719
  pywikibot/page.py b63c049 2014-09-12 07:56:29.167717
  pywikibot/editor.py 6cdcf52 2014-09-12 07:56:28.839709
  pywikibot/family.py d2e6a6d 2014-09-12 07:56:29.103716
  pywikibot/plural.py 02a50e4 2014-09-12 07:56:29.191718
  pywikibot/version.py c8cb36c 2014-09-12 07:56:29.371723
  pywikibot/userinterfaces/terminal_interface.py b0e2743 2014-09-12 07:56:29.299721
  pywikibot/userinterfaces/terminal_interface_base.py 03b51f8 2014-09-12 07:56:29.307721
  pywikibot/config2.py b021a05 2014-09-12 08:20:38.497870
  pywikibot/pagegenerators.py 0ba02b4 2014-09-12 07:56:29.179718
  pywikibot/userinterfaces/terminal_interface_unix.py da6f43e 2014-09-12 07:56:29.319721
  pywikibot/tools.py 1cbe087 2014-09-12 07:56:29.251720
  pywikibot/login.py feece17 2014-09-12 07:56:29.147717
  pywikibot/userinterfaces/transliteration.py 1d8e217 2014-09-12 07:56:29.343722
SITE VERSION: 1.24wmf20
MESSAGES: unknown (not logged in)
=== === === === === === === === === === === === === ===
Pywikibot re25bdc0cabd94de228688730c24eb3f90e88f6eb
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3]
Found 1 meta:meta processes running, including this one.
Retrieving 1 pages from meta:meta.


>>> Meta:Sandbox <<<
- {{Meta:Sandbox/Please do not edit this line}}<!-- <translate><!--T:3-->
+ {{Meta:Sandbox/Please do not edit this line}}<!-- <translate><!--T:3 -->
- Please edit below this line.</translate> -->
+ Please edit below this line.</translate>  -->

Do you want to accept these changes? ([y]es, [N]o, [e]dit, open in [b]rowser, [a]ll, [q]uit) y
Site("meta", "meta").login(False) called when a previous login was in progress.
Exception in thread Put-Thread:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/nemobis/pwb/core/pywikibot/__init__.py", line 653, in async_manager
    request(*args, **kwargs)
  File "/home/nemobis/pwb/core/pywikibot/page.py", line 990, in _save
    watch=watchval, bot=botflag, **kwargs)
  File "/home/nemobis/pwb/core/pywikibot/site.py", line 878, in callee
    return fn(self, *args, **kwargs)
  File "/home/nemobis/pwb/core/pywikibot/site.py", line 3529, in editpage
    token = self.tokens['edit']
  File "/home/nemobis/pwb/core/pywikibot/site.py", line 1193, in __getitem__
    return storage[key]
KeyError: 'edit'

Dropped throttle(s).
Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
All threads finished.
Comment 1 Nemo 2014-09-12 09:19:10 UTC
Reverting that single patch didn't help.
Maybe the example is not the best one because even with compat the edit is "aborted by an extension hook", but I can reproduce on any page.
Comment 2 Fabian 2014-09-12 09:21:51 UTC
Uh I might know what is happening here. You are using a WMF wiki?
Comment 3 Nemo 2014-09-12 10:02:01 UTC
(In reply to Fabian from comment #2)
> Uh I might know what is happening here. You are using a WMF wiki?

Yes
Comment 4 Fabian 2014-09-12 10:05:03 UTC
I'm currently working on a fix, or to be more specific I 'have' one but I don't get what I expect.

Depending on how git savy you are: https://github.com/xZise/pywikibot-core/commit/a44818b139c0e4168ff8a6b92546e612b9ae6181 should fix it, but this is what I get: http://paste.ubuntu.com/8325881/

(It looks like the same error, but it doesn't find a 'csrf' token and not an 'edit' token like in your case and that's because when something is requesting an edit token it actually requests a csrf token.)
Comment 5 Gerrit Notification Bot 2014-09-12 15:00:21 UTC
Change 159991 had a related patch set uploaded by XZise:
[FIX] Tokens: Return the csrf token, when such a token is requested

https://gerrit.wikimedia.org/r/159991
Comment 6 Gerrit Notification Bot 2014-09-12 21:01:41 UTC
Change 159991 merged by jenkins-bot:
[FIX] Tokens: Return the csrf token and request correct site

https://gerrit.wikimedia.org/r/159991

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links