Traceback (most recent call last):
File "/data/data/com.termux/files/home/vikaspy/pwb.py", line 399, in
<module>
if not main():
File "/data/data/com.termux/files/home/vikaspy/pwb.py", line 391, in main
run_python_file(filename,
File "/data/data/com.termux/files/home/vikaspy/pwb.py", line 106, in
run_python_file
exec(compile(source, filename, 'exec', dont_inherit=True),
File "./scripts/replace.py", line 1075, in <module>
main()
File "./scripts/replace.py", line 929, in main
single_summary = i18n.twtranslate(
File
"/data/data/com.termux/files/home/vikaspy/pywikibot/tools/_deprecate.py",
line 404, in wrapper
return obj(*__args, **__kw)
File "/data/data/com.termux/files/home/vikaspy/pywikibot/i18n.py", line
700, in twtranslate
raise pywikibot.exceptions.TranslationError(
pywikibot.exceptions.TranslationError: Unable to load messages package
scripts.i18n for bundle replace-replacing
It can happen due to lack of i18n submodule or files. See
https://www.mediawiki.org/wiki/Manual:Pywikibot/i18n
CRITICAL: Exiting due to uncaught exception <class
'pywikibot.exceptions.TranslationError'>
$
Hi all,
I'm building a small pywikibot tool[1] which is designed to be installed
via pip (and in turn installs Pywikibot via pip).
The tool uses the page.touch() function which is where I get a
pywikibot.i18n.TranslationError when I run it.
page.touch() gets it's edit summary from i18n.twtranslate(self.site,
'pywikibot-touch') which in turn is defined in /scripts/i18n/pywikibot/.
Unless I'm confused the Error occurs because the pip distribution does not
include the /scripts folder or the i18n submodule.
So my first question is am I just doing something obviously wrong and the
i18n submodule should have been available over pip as well?
If it's not just me then would it not make sense to have any i18n files
necessary to the Pywikibot *library* to also be distributed via the same
pip package? (i18n for scripts is another issue since for scripts you
cannot use pip).
Cheers,
André / Lokal_Profil
[1] https://github.com/lokal-profil/pywikibot-sdc
André Costa | Chief Operating Officer, Wikimedia Sverige |
Andre.Costa(a)wikimedia.se | +46 (0)733-964574
Stöd fri kunskap, bli medlem i Wikimedia Sverige.
Läs mer på blimedlem.wikimedia.se
------
sent from my mobile, all typos are due to autocorrect ;)
Hi,
currently you can’t see the tags because this property is not retrieved. You have to modify the APISite.usercontribs() method to get it.
https://doc.wikimedia.org/pywikibot/master/_modules/pywikibot/site/_generat…
Please create a Phabricator task for it. I think it is important enough to improve User.contributions() as well as APISite.usercontribs().
By the way, you can use collections.Counter to simplify your code.
https://docs.python.org/3/library/collections.html?highlight=counter#collec…
Best
xqt
> Am 22.05.2022 um 02:48 schrieb i.hate.spam.mail.here(a)gmail.com:
> Hi,
>
> I have this piece of code that counts edits:
> <pre>
> from pywikibot import Site, User
>
> user = User(Site("en"), input('Enter user name: '))
> counts = {}
> for page, oldid, ts, comment in user.contributions(9999999999999):
> page.namespace()
> try:
> counts[str(page.namespace())] += 0
> except KeyError:
> counts.update({str(page.namespace()): 0})
> counts[str(page.namespace())] += 1
> print('Totals:')
> for key in counts:
> a = key.replace(':', '')
> if (a == ""):
> a = 'Main'
> print(a + ":", counts[key])
> </pre>
> My question is how to see the tags in edits. It seems that .contributions() does not return the tags.
> _______________________________________________
> pywikibot mailing list -- pywikibot(a)lists.wikimedia.org
> To unsubscribe send an email to pywikibot-leave(a)lists.wikimedia.org
Hi,
I have this piece of code that counts edits:
<pre>
from pywikibot import Site, User
user = User(Site("en"), input('Enter user name: '))
counts = {}
for page, oldid, ts, comment in user.contributions(9999999999999):
page.namespace()
try:
counts[str(page.namespace())] += 0
except KeyError:
counts.update({str(page.namespace()): 0})
counts[str(page.namespace())] += 1
print('Totals:')
for key in counts:
a = key.replace(':', '')
if (a == ""):
a = 'Main'
print(a + ":", counts[key])
</pre>
My question is how to see the tags in edits. It seems that .contributions() does not return the tags.
Forwarding the message below to this list as some of you might be
interested in the topic - there is a dedicated room to talk about all
things Python (PAWS, Pywikibot, etc.). If you are interested in claiming a
session slot, now is the time!
Cheers,
Srishti
*Srishti Sethi*
Senior Developer Advocate
Wikimedia Foundation <https://wikimediafoundation.org/>
---------- Forwarded message ---------
From: Melinda Seckington <mseckington(a)wikimedia.org>
Date: Thu, May 5, 2022 at 2:21 PM
Subject: [Wikidata] Wikimedia Hackathon May 20-22: Info about the online
space, local meetups and more
To: <wikimedia-l(a)lists.wikimedia.org>, <wikitech-l(a)lists.wikimedia.org>, <
wikidata-l(a)lists.wikimedia.org>, <cloud(a)lists.wikimedia.org>, <
wikitech-ambassadors(a)lists.wikimedia.org>
Hi all,
The Wikimedia Hackathon
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022> is coming up in
two weeks, on May 20-22. The Hackathon is an event by and for technical
contributors from around the world. It’s a space to work together on
technical projects, learn new skills, and meet others in the technical
community. Newcomers are welcome
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/How_to/Newcomers>!
A few updates:
The main event will happen in an online game-style space
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/How_to#Joining_the_…>,
supported by local meetups
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/Meetups> organized
by community members around the world. Instructions on how to enter the
online space will be published shortly before the start of the hackathon.
If you would like to attend a meetup, please visit the local meetups
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/Meetups> page to
learn if there is one nearby and how to join.
If you already know what you are going to be working on or need help on a
project, please add your project to the hackathon Phabricator board
<https://phabricator.wikimedia.org/project/view/5802/>. If you have tasks
that are good for newcomers and are up to helping others, please also tag
them with #good first tasks
<https://phabricator.wikimedia.org/tag/good_first_task/>.
If you have an idea for a session or social activity, you can pick an open
slot in the category which fits your topic and add the session directly to
the schedule
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/Schedule>. All
topics are welcome, as long as they are connected to the technical
environment of the Wikimedia projects! We are particularly interested in
sessions that are useful for newcomers.
If you are new to the technical community or this is your first Wikimedia
Hackathon, please check out the list of tips for newcomers
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/How_to/Newcomers>.
If you have any questions, feel free to ask on the talk page
<https://www.mediawiki.org/wiki/Talk:Wikimedia_Hackathon_2022>. If you want
to brainstorm ideas or find a co-speaker for your session, the hackathon
social channels
<https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/Discussions> are a
good place to find others. You can also add your name to the participants
list <https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2022/Participants>
and find out what others are interested in.
Many thanks to the folks who already expressed interest in helping with
facilitation or newcomer support! We plan to publish the shift plan early
next week. Those up for helping are welcome to pick an open slot once it’s
up.
We are looking forward to meeting you all soon!
Melinda, for the hackathon committee
--
Melinda Seckington
Developer Advocacy Manager
Wikimedia Foundation <https://wikimediafoundation.org/>
_______________________________________________
Wikidata mailing list -- wikidata(a)lists.wikimedia.org
To unsubscribe send an email to wikidata-leave(a)lists.wikimedia.org
Hello fellow bot writers,
I have a problem which must have been solve a million times before,
but I can't find a full solution. I need to add sections to a talk
page in various locations (depending on the page):
# at the top of the page
# before the first section (i.e. at the top, but after some header)
# at the end of the page, before categories etc.
The first case is trivial and I know about pywikibot.textlib.add_text
which covers the third case, but there doesn't seem to be a ready-made
solution for #2. Do you know any?
Thank you,
Strainu