[Pywikipedia-l] "edit" option error: 'module' object has no attribute 'ui'

info at gno.de info at gno.de
Wed Jul 13 21:32:28 UTC 2011


Fixed in r9360. Thanks.
xqt

----- Ursprüngliche Nachricht -----
Von: Chris Watkins
Gesendet: Mittwoch, 13. Juli 2011 08:12
An: Pywikipedia discussion list
Betreff: Re: [Pywikipedia-l] "edit" option error: 'module' object has no	attribute 'ui'

I've solved my problem, and I might have found a bug...



On Sat, Jul 2, 2011 at 01:10, Chris Watkins <chriswaterguy at appropedia.org> wrote:

With my current installation of Pywikipediabot, whenever I run replace.py and choose edit, it aborts with an error. I'm running on Debian (Linux) and I have python-tk installed.  (I had it working on a previous computer. From memory, it also had python-tk installed, and it was either running Debian or Ubuntu - can't recall).


Ok, so I did some troubleshooting myself.  I was able to get it working for an old version of Pywikipediabot (I had to install the package "idle" first in Debian). Then by changing files and lines of code one at a time, I narrowed down the bug in the new version to lines 31-32 of editarticle.py:

import pywikibot
from pywikibot import i18n

I replaced these two lines with the equivalent section, a single line, from an older version (I think about 16 Sep 2010):

import wikipedia as pywikibot

I don't know if I'm missing out on something by not having that new code referring to i18n, but so far it's working well.
Cheers,
Chris

 

At the message: 
Do you want to accept these changes? ([y]es, [N]o, [e]dit, open in [b]rowser, [a]ll, [q]uit) 

I enter: e

And I get this output: 

Traceback (most recent call last):
  File "replace.py", line 808, in <module>
    main()
  File "replace.py", line 799, in main
    bot.run()
  File "replace.py", line 428, in run
    as_edited = editor.edit(original_text)
  File "/home/PATH/editarticle.py", line 121, in edit
    pywikibot.ui.editText(text, jumpIndex=jumpIndex,
AttributeError: 'module' object has no attribute 'ui'


The relevant line in editarticle.py is

120            return self.restoreLinebreaks(
121                pywikibot.ui.editText(text, jumpIndex=jumpIndex,
122                                      highlight=highlight))


Any suggestions? Thanks.

-- 
Chris Watkins

Appropedia.org - Sharing knowledge to build rich, sustainable lives.





-- 
Chris Watkins

Appropedia.org - Sharing knowledge to build rich, sustainable lives.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/pywikipedia-l/attachments/20110713/3d495cfb/attachment.htm 


More information about the Pywikipedia-l mailing list