#8661

edit

Hi, Xqt. Please take a look at my comment on Special:Code/pywikipedia/8661#code-comments. Best regards, Malafaya 12:09, 24 October 2010 (UTC)Reply

Done by Multichil. Thanks, Malafaya 12:19, 24 October 2010 (UTC)Reply

archivebot.py — Does it works for "es"-projects?

edit

Hello Xqt. May I know if the archivebot.py script works for Spanish-language projects? In the past it didn't due to timestamp-related things IIRC. If it isn't yet supported, I can pass you the required changes if needed so you can push them to the pywiki scripts (if you like, of course). Thank you, --Marco Aurelio (talkmeta) 19:58, 8 May 2012 (UTC)Reply

I've never tried it. If you have a patch for currently used timestamps, that would be great. Xqt (talk) 05:34, 9 May 2012 (UTC)Reply
I did tested it yesterday and it gives me an error message telling me that the spanish language is not currently supported. I can submit the required changes but I need to know which needs to be translated or addapted. Regards. --Marco Aurelio (talkmeta) 14:07, 9 May 2012 (UTC)Reply
Could you give us the error messages and traceback at sourceforge. I cannot follow. Xqt (talk) 16:50, 9 May 2012 (UTC)Reply

Bug

edit

Your edit -- http://svn.wikimedia.org/viewvc/pywikipedia/trunk/pywikipedia/category_redirect.py?r1=9692&r2=10485 seems making it not working when I edit Wikimedia Commons. --Zhuyifei1999 (talk) 11:38, 31 May 2013 (UTC)Reply

Sorry, this is an inapropriate bug report. Please give us more information about this issue, e.g. the traceback, your command line and the output of version.py. Btw you may use our bug tracker at sourceforge to report these details. Xqt (talk) 05:05, 1 June 2013 (UTC)Reply
yifei@ubuntu:~/pywikipedia$ python category_redirect.py
No handlers could be found for logger "pywiki"
WARNING: Your account on commons:commons does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Getting 2 pages from commons:commons...
Done checking hard-redirect category pages.
Traceback (most recent call last):
  File "category_redirect.py", line 579, in <module>
    main()
  File "category_redirect.py", line 574, in main
    bot.run()
  File "category_redirect.py", line 409, in run
    prop='info|categoryinfo'):
  File "category_redirect.py", line 266, in query_results
    querydata.update(result['query-continue'][query_type])
NameError: global name 'query_type' is not defined
yifei@ubuntu:~/pywikipedia$ python version.py
Pywikipedia [http] trunk/pywikipedia (r11514, 2013/05/09, 16:42:02, OUTDATED)
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3]
config-settings:
use_api = True
use_api_login = True
unicode test: ok

--Zhuyifei1999 (talk) 06:09, 1 June 2013 (UTC)Reply

ok, thanks for that hint. Xqt (talk) 14:06, 1 June 2013 (UTC)Reply
BTW, I moved my bot to labs, and updated, there's still the error.
zhuyifei1999@tools-login:~/pywikipedia$ python category_redirect.py
No handlers could be found for logger "pywiki"
WARNING: Your account on commons:commons does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Getting 3 pages from commons:commons...
WARNING: Missing namespace in family file commons: namespace['commons'][1198] (it is set to 'Translations')
WARNING: Missing namespace in family file commons: namespace['commons'][1199] (it is set to 'Translations talk')
Retrieving watchlist for commons:commons via API.
Updating page [[Category:Dorpskerk (IJsselmuiden)]] via API
Done checking hard-redirect category pages.
Traceback (most recent call last):
  File "category_redirect.py", line 579, in <module>
    main()
  File "category_redirect.py", line 574, in main
    bot.run()
  File "category_redirect.py", line 409, in run
    prop='info|categoryinfo'):
  File "category_redirect.py", line 266, in query_results
    querydata.update(result['query-continue'][query_type])
NameError: global name 'query_type' is not defined
zhuyifei1999@tools-login:~/pywikipedia$ python version.py
Pywikipedia [http] trunk/pywikipedia (r11602, 2013/06/01, 11:23:55, OUTDATED)
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3]
config-settings:
use_api = True
use_api_login = True
unicode test: ok

--Zhuyifei1999 (talk) 00:44, 2 June 2013 (UTC)Reply

pyrev:10485reverted in pyrev:11610. Xqt (talk) 09:19, 2 June 2013 (UTC)Reply
Thanks. --Zhuyifei1999 (talk) 09:53, 2 June 2013 (UTC)Reply

Another bug

edit

This keeps on coming out when I edit commons on too labs:

zhuyifei1999@tools-login:~$ python ~/pywikipedia/touch.py -page:"Category talk:Icons for motorway descriptions/generic"
No handlers could be found for logger "pywiki"
Getting 1 page from commons:commons...
NOTE: You have new messages on commons:commons
WARNING: Your account on commons:commons does not have a bot flag. Its edits will be visible in the recent changes and it may get blocked.
Sleeping for 4.8 seconds, 2013-06-16 10:03:01
Updating page [[Category talk:Icons for motorway descriptions/generic]] via API
HTTPError: 504 Gateway Time-out
WARNING: Could not open 'http://commons.wikimedia.org/w/api.php'.
Maybe the server is down. Retrying in 1 minutes...

zhuyifei1999@tools-login:~$ python ~/pywikipedia/version.py Pywikipedia [http] trunk/pywikipedia (r11641, 2013/06/11, 13:14:57, ok) Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] config-settings: use_api = True use_api_login = True unicode test: ok

This time I don't know what's wrong. The server is not down since I can still access commons. --Zhuyifei1999 (talk) 04:17, 12 June 2013 (UTC)Reply

Seems that when saving large pages, it always cause that error. --Zhuyifei1999 (talk) 02:19, 16 June 2013 (UTC)Reply

Yes this might be. We have no abilities to fix it. Xqt (talk) 14:44, 19 June 2013 (UTC)Reply

Warteschlange

edit

Hallo xqt. Bei der Pywikipedia-Version, die ich 2012 oder 2013 auf meinem alten PC installiert hatte, gab es eine Warteschlange von 60(?) halbautomatischen Edits, die gefüllt werden konnte. Bei der gestern installierten Version (Core) scheint dies nicht der Fall zu sein, so dass ich schon noch wenigen Edits waren musste, bis diese ausgeführt wurden, um die nächste Änderungsvorschau angezeigt zu erhalten. Kann man dies irgendwo ändern? Im Manual habe ich nichts dazu gefunden. --Leyo 00:03, 9 January 2015 (UTC)Reply

Hi Leyo, welches Script? solve-disambiguation.py?  @xqt 04:05, 9 January 2015 (UTC)Reply
Ich hab' mir obiges Script mal angeschaut und nichts auffälliges gefunden. Es warden bis zu 64 Seiten gesammelt und asynchrony bearbeitet. Kanst Du mal in den Chat #pywikibot connect oder #wikipedia-de-admins connect kommen, damit wir das mal durchgehen. Vielleicht ist ja doch noch irgenwo der Wurm drin.  @xqt 04:50, 9 January 2015 (UTC)Reply
Nein, replace.py. Du scheinst gerade nicht im Chat zu sein. --Leyo 19:26, 9 January 2015 (UTC)Reply
ja, seit halb acht war ich offline. Kannst ja per Gelegenheit nochmal probieren, bin eigentlich häufig anzutreffen. Aber egal: Ich schau mir morgen das Script mal an und geb' Dir Bescheid. Aus dem Stand weiß ich's nicht.  @xqt 20:52, 9 January 2015 (UTC)Reply
Also ich habe das Script mal geprüft, demnach sollte es so funktionieren, wie Du es erwartest. Wir müssten das mal an einem Beispiel durchspielen.  @xqt 10:41, 10 January 2015 (UTC)Reply

Login Pywikipedia

edit

Hallo Xqt,

seit kurzem kann ich mich mit login.py nicht mehr einloggen. Wenn ich login.py unter chdir \pywikipedia (wo ich pywikipedia gespeichert habe) einfüge, kommt nicht einmal eine Fehlermeldung, sondern chdir \pywikipedia wird einfach wiederholt.

Was mache ich falsch?

Gruß, --Holder (talk) 14:17, 4 July 2015 (UTC)Reply

Hallo @Holder: , ich verstehe nicht genau, was Du meinst; Du fügst ein Script ein? Mit welcher Version arbeitest Du den, compat oder core? und was kommt heraus, wenn Du version.py ausführst? Kannst Du mal in den Chat kommen. Ich bin da oft. Ansonsten sind da jayvdb und xzise häufig, die gerne helfen. Gruß  @xqt 19:00, 4 July 2015 (UTC)Reply
Chat, hm, muss mal schauen, ob ich dazu komme.
Wenn ich version.py eingeben kommt folgendes:
Pywikipedia [http] trunk/pywikipedia (r10875, 2013/01/05, 22:45:20)
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
config-settings:
use_api = True
use_api_login = True
unicode test: ok
Vermutlich alles völlig veraltet, oder?
Gruß, --Holder (talk) 17:41, 5 July 2015 (UTC)Reply
Ja sehr. Diese Version kann seit spätesten letzter Woche gar nicht mehr laufen weil sich die API geändert hat. Ich kann da nur raten, den Bot zu aktualisieren und am besten zu core-Version zu wechseln. Die alte compat-Version wird von den Entwicklern nicht mehr unterstützt, läuft aber noch. Grüße  @xqt 21:29, 5 July 2015 (UTC)Reply
Danke, werde ich versuchen, aber vor den Sommerferien wird das nichts mehr. Melde mich evtl. danach wieder. Viele Grüße, --Holder (talk) 20:26, 7 July 2015 (UTC)Reply

pywikibot/bots/xqbot tests

edit

Hi !

I was looking at layout.yaml and saw

  - name: pywikibot/bots/xqbot
    template:
      - name: tox-jessie

but I fail to understand where the tests it runs are actually defined. I guess it will run tox but ... how does it go from the stanza in layout.yaml to running the tox command ? I'm asking because I'd like to prepare tests for a bot I'm writing and would like to follow your example.

Thanks ! Dachary (talk) 08:22, 29 July 2016 (UTC)Reply

welcome.py: problem for zh

edit

Hi Xqt, I wanted to run this script on srwiki. When I wanted to run, I got:

Traceback (most recent call last):
  File "pwb.py", line 263, in <module>
    if not main():
  File "pwb.py", line 256, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 120, in run_python_file
    exec(compile(source, filename, "exec", dont_inherit=True),
  File ".\scripts\welcome.py", line 336
    'zh': u'\n*{{User|%s}} ' + timeselected,
       ^
SyntaxError: invalid syntax
CRITICAL: Closing network session.
<class 'SyntaxError'>

I tryed with copying syntax for enwiki, but no effects. What to I work? I tryed too with -lang:sr but no effects. Zoranzoki21 (talk) 16:10, 13 October 2017 (UTC)Reply

Pastebin Zoranzoki21 (talk) 16:13, 13 October 2017 (UTC)Reply
Script worked normal before my patch, but I no touched parameters for zhwiki in patch. Zoranzoki21 (talk) 16:19, 13 October 2017 (UTC)Reply
Probably you are using an older patchset e.g. this one. I cannot reproduce that failure and the syntax checking is ok:
>>> import pwb, pywikibot as py
>>> from scripts import welcome
>>> 
You should update your bot.  @xqt 12:56, 14 October 2017 (UTC)Reply
Thank you! I downloaded pywikbot from gerrit with git clone and it resolved a problem. Thank you! Zoranzoki21 (talk) 13:28, 14 October 2017 (UTC)Reply

Please review with +2 patch again

edit

HI, can you again add +2 on patch https://gerrit.wikimedia.org/r/#/c/383932/? I removed your vote because change is not deployed. You can see in comment. Zoranzoki21 (talk) 13:04, 15 October 2017 (UTC)Reply

Done.  @xqt 16:48, 15 October 2017 (UTC)Reply
Thank you! Zoranzoki21 (talk) 16:51, 15 October 2017 (UTC)Reply

Non-JSON response

edit

Hi Xqt. Your observation about the put_throttle is right (infact I asked how it could solve the problem), but the script always locks up after 10-15 minutes of work. I have limited experience as a programmer, but that thing sounds like a bug. Any other script runned on bot with more substation works normally. Something is not working well. Bye, --.avgas 07:48, 18 February 2018 (UTC)Reply

I've runned that script in -simulate mode for more than 1 hour without any problems. Looks like an connection problem on your side. The fact is that the received data from server is malformed. For futher exploring the complete log would be helpful. Also run that script in -verbose mode to get additional outputs. The logfile will increase a lot.  @xqt 09:16, 18 February 2018 (UTC)Reply
I runned that script for six hours without any problems.  @xqt 13:53, 18 February 2018 (UTC)Reply

Inactive bot account

edit

Hi. At Project:Requests/User rights/Removal of inactive bot rights (2) there is a proposal to remove the bot rights of inactive bots. Since you appear to be the operator of one of the bots in question, I wanted to draw your attention to the discussion. Please let us know if the rights are still needed (or if they aren't). Thanks, --DannyS712 (talk) 02:47, 29 July 2020 (UTC)Reply

I think I don't need them currently.  @xqt 11:26, 3 October 2020 (UTC)Reply
@Xqt: In that case, would you like me to remove the bot flag from User:Xqbot? DannyS712 (talk) 20:40, 3 October 2020 (UTC)Reply

Help

edit

Hey there, Xqt! :)

I wanted to ask you 2 things. First of all, has the change about summary been deployed yet? I got a lot of emails from the tests but wasn't able to follow them all and I thought I'd take the shortcut by asking here.

Secondly, can you help me with a weird problem I've been having while accessing the REST API with my bot? (Not related to pywikibot per se.) I've created a while loop to send some POST and GET requests in a row with curl in a certain wiki page. The bizarre part is that I get this pattern: 2 iterations of the loop go well and in the 3rd one I get an edit conflict, even though no one is editing that page other than me (other than my bot, better said). And this repeats until the end of the loop. In the end, 1/3 of the total requests hasn't gone through because of having faced "edit conflicts" (HTTP CODE 409). I believe it is related to the id revision parameter. It somehow gets confused and tries to edit an old version and that brings the edit conflict but I can't solve it even if I make the requests go through very slow (1 every 10 minutes, for example), the pattern is always there. The only way for the pattern to change is to make it send the requests without any kind of sleep in between, in which case more than 3/4 of the requests start facing edit conflicts, so it gets worse, 1/3 is the best I can do. Do you have any idea what might be happening given your technical knowledge? What might be sending HTTP 409 codes when in reality there is not really an edit conflict happening? I can provide more information if needed. - Klein Muçi (talk) 11:20, 8 March 2021 (UTC)Reply

During these days, I've tried the summary change many times but nothing happens. Maybe I'm applying it wrong? What I do is, at my user-fixes.py, put this: 'msg': {'_default':'Example text: Lorem ipsum bla bla bla%(description)s',} but I only get the literal string as written for a summary. What am I doing wrong? - Klein Muçi (talk) 02:07, 15 March 2021 (UTC)Reply
Sorry for this late response. The change for the summary message was deployed with release 6.0.0 for weeks ago. Please verify your Pywikibot version.
The second point: HTTP CODE 409 is not an edit conflict but a request conflict:
>>> from http import HTTPStatus
>>> HTTPStatus(409).description
'Request conflict'
This indicates a conflict with the current state of the target resource but I cannot say what this really means. Because this is a server response I guess this has nothing to do with pywikibot. Probably adding a get throttle or increasing put_throttle would help. Look at config2.py for those settings.
Best  @xqt 09:04, 13 April 2021 (UTC)Reply
Thanks for the answer! :)) I think you mean user-config.py, no? There put_throttle is equal to 10. Should I increase it more? I thought the default (10 seconds) was good enough. - Klein Muçi (talk) 11:38, 13 April 2021 (UTC)Reply
The documentation for the settings are in config2.py. The idea for increasing the put throttle is that the server (target resouce) needs some additional time. But this is not sure bu you can try it whether it helps. You may just add an additional option to your command line e.g. -pt:30 and increase the put throttle to 30 seconds. You also may use -minthrottle:5 fro example which slows down read requests from server to 5 seconds. Play with these parameter, probably it helps. Otherwise you have to contact the target resource provider about that http status. Best  @xqt 12:10, 13 April 2021 (UTC)Reply
Okay then. I'll try playing around with those. Thank you! As for contacting the target resource provider... My bot is active on the Albanian Wikipedia and Wikiquote (I'm an admin on those sites). Do you have any idea where who can I contact in these cases? I may need some guidance in regard to accessing the Wikipedia's API in general anyway so... Just for future reference. - Klein Muçi (talk) 12:48, 13 April 2021 (UTC)Reply
I've not glue. Probably wikitech. I am not familar with REST API and Pywikibot does only support the http interface yet (maybe you can contribute some code ;)  @xqt 13:17, 13 April 2021 (UTC)Reply

Hey there! I played around with those values and even the API retry number values. It doesn't seem to make any difference. The pattern is always there and always the same: 2 requests go through, 1 doesn't. I get this message: {"messageTranslations":{"sq":"Konflikt në redaktim.","en":"Edit conflict."},"httpCode":409,"httpReason":"Conflict"} Does it tell you anything? - Klein Muçi (talk) 09:26, 14 April 2021 (UTC)Reply

Today I had some free time and I looked at the verbose mode out of curiosity to compare the requests when they got through and when they didn't.
This is when the request goes through and this is when it doesn't. The cache part looks the most interesting part even though I don't know what it means. (Also some minor changes like cookies, etc.) Please take a look at them whenever you have some free time. Maybe you understand more than I do.
As always the pattern is always 2 go, 1 doesn't.
Also, please take a look here. According to the instructions on that page, error 409 is sent on edit conflict cases. There are no edits happening in that page apart from those that my bot is doing so that leaves the problem to be related with the revision ID. In the way I've set up the script, the latest revision ID is taken automatically by a variable but still gives problems 1/3 of the time. Maybe it's a problem related to caching somehow? - Klein Muçi (talk) 09:06, 24 April 2021 (UTC)Reply

Gerrit

edit

Hi, Xqt. Hope that you are well. Could you, please, resolve the issue of gerrit:676780? The commit has been open for 3 days now without comment from your side. Wishing you the best in your life. Cheers. --Meno25 (talk) 16:55, 9 April 2021 (UTC)Reply

Thank you ❤️ If we were living in the same city, I would have bought you a beer. Much appreciated. Cheers. --Meno25 (talk) 19:17, 10 April 2021 (UTC)Reply
Thanks. I'll drink a beer to you and appreciate your contribs.  @xqt 08:45, 12 April 2021 (UTC)Reply

T267742

edit

Hi, Xqt. Hope that you are doing well. I don't want to take much of your time but I would like to draw your attention to this comment. My understanding is that this bug can be resolved quickly, so, can you resolve it for me? Thank you and best wishes for you always. --Meno25 (talk) 15:24, 18 May 2021 (UTC)Reply

Hi Meno25, I am sorry I tried to find a more general solution for such an exception. Now I've implemented one for this script only. The problem is the lazy parsing of title but any earlier status has deeper impacts. Unfortunately I found a big problem with the implementiation of output cache from compat. It always fails on tests if the testing CPU is highly used phab:T282962 but I haven't found problems for a normal run. Please have a look on it if something looks courious with pywikibot.output and other logger. I think I'll revert it for 6.2 and postpone that to 6.3. Thanks a lot.  @xqt 20:12, 18 May 2021 (UTC)Reply

Pywikibot, Script "category" und Anführungszeichen

edit

Tach, Xqt, nachdem letztens das Problem bei mir lag, frage ich jetzt lieber erstmal: Kann es sein, dass das Skript „category“ nicht mit Anführungszeichen umgehen kann? Mir fiel das im Barwiki auf, aber nicht nur dort gibt es Kategorien mit Doppelpunkten im Namen.

  • pwb category remove -simulate -family:wikipedia -lang:bar -user:SperaviriBot -log:syntaxtest.log -namespace:108 -from:Spruch:Person führte nicht unerwartet zur Fehlermeldung
CRITICAL Exiting due to uncaught exception <class 'ValueError'>
  • […] "-from:Spruch:Person" führte ebenso erwartet zur selben Fehlermeldung. In der commands.log sind die Befehlsaufrufe auch identisch.

Nun aber zu den unerwarteten Ergebnissen:

  • […] "-from:'Spruch:Person'" ergibt
WARNING Moving category page 'Kategorie:'Spruch:Person'' requested, but the page doesn't exist.
  • […] "-from:\"Spruch:Person\"" führt zu
WARNING Moving category page 'Kategorie:"Spruch:Person"' requested, but the page doesn't exist.

Die Kat. ist sehr wohl existent: bar:Kategorie:Spruch:Person.

Eine Anführung um den Parameter wie im zweiten Beispiel, um Leerzeichen in Kategorien abzufangen, stellt dagegen kein Problem dar. — Speravir (talk– 23:08, 10 June 2021 (UTC)Reply

zu -from:Spruch:Person: Spruch:Person ist aber keine Kategorie oder wird nicht als solche erkannt wegen des Namensraum-Präfixes. -from:Category:Spruch:Person sollte dagegen funktionieren.  @xqt 11:37, 16 June 2021 (UTC)Reply
Ja, funktioniert, und zwar auch mit der lokalisierten Bezeichnung (also hier „Kategorie“). Ich denke, darauf sollte in der Doku hingewiesen werden. Sowas wie “In options -from: and -to: for categories containing a colon you must explicitly prepend category: or the localized equivalent” sollte stimmen, oder? — Speravir (talk– 23:45, 30 June 2021 (UTC)Reply
Ich denke ja. Möchtest Du das machen mit der Doku?  @xqt 15:18, 1 July 2021 (UTC)Reply
Upps, vergessen zu antworten: Hier im MediwIki in Manual:Pywikibot könnte ich das sicherlich, in doc: pywikibot anscheinend eher nicht. Offensichtlich ist es ja sogar so, dass man immer das Kategorie-Präfix angeben kann (aufgefallen, als ich unten folgende Warnung zu umgehen versuchte), man das vielleicht eher so umformulieren sollte, dass man es in den Fällen, wo die Kategorie keinen Doppelpunkt enthält, weglassen kann – oder man verlangt explizit das Präfix und verschweigt die Verkürzungsmöglichkeit, lässt sie aber von Entwicklerseite weiterhin stillschweigend zu. Mir fehlt aber auch die Übersicht, ob dazu auch andere Skripte, die sich den Kategorien widmen, ebenso zu berücksichtigen wären. — Speravir (talk– 23:30, 15 July 2021 (UTC)Reply

Anderes Problem oder Problemchen, bewusst erst heute aufgetreten, obwohl ich nun seit einer Weile im barwiki die leeren Kategorien abarbeite:

WARNING: .\scripts\category.py:276: FamilyMaintenanceWarning: Site wikipedia:bar has no language defined in doc_subpages dict in wikipedia_family.py file                                                                                 
  docs = page.site.doc_subpage  # return tuple

Wenn die Meldung bei jeder Bearbeitung aufgetreten wäre, hätte ich sie viel früher bemerkt. — Speravir (talk– 23:30, 15 July 2021 (UTC)Reply

Was meinst Du denn genau? Die /doc-Seite wird ja nur bei Vorlagen benutzt, also nur bei deren Kategorisierung abgefragt. doc_subpages sind im wikipedia_family.py hinterlegt, könnte auch veraltet sein. Was wäre Dein Vorschlag hierzu?  @xqt 15:07, 16 July 2021 (UTC)Reply
Aha, tatsächlich ist hier eine Vorlage betroffen. Mir war nicht klar, dass die Fehlermeldung sich darauf bezieht. Die Vorlage hat gar kein Doc-Unterseite, siehe bar:Vorlog:Info ISO-3166-2:BE (die inexistente Kat. wird über bar:Vorlog:Info ISO-3166-2/Info eingefügt, das kann nicht per Bot korrigiert werden). — Speravir (talk– 21:14, 16 July 2021 (UTC)Reply
Sieh dir bitte mal kurz meine Änderung Special:Diff/4587354/4777461 an. Wenn Du die für in Ordnung hältst, kann man sie dann für Übersetzungen freigeben. Wie gesagt, in doc: pywikibot kann ich aber keine solche Änderung einfügen. — Speravir (talk– 18:32, 24 August 2021 (UTC)Reply

Deprecated-Warnung für logfilecount

edit

Ich vermute, da fehlt etwas an geänderter Dokumentation: Ich erhielt diese Warnung:

_deprecate.py:487: ArgumentDeprecationWarning: config.logfilecount with value -1 is deprecated since release 6.5.0; use any positive number instead.

In der user-config.py steht aber etwas anderes und so wollte ich mich auf die Suche machen, den aktualisierten Text einzufügen. OK, ich hab dann selbst doc: pywikibot.config module gefunden (und das ist in der user-config zu Beginn verlinkt, vielleicht aber nicht in alten Configs?) – Edit: und auch dort steht es noch mit „if logfilecount is -1“ –, nur vorher suchte ich in Manual:Pywikibot bzw. von dort aus in Manual:Pywikibot/Installation (respektive der dt. Übersetzung) – und dort wird auf die nicht mehr existente Datei config2.py verwiesen. Es existiert zwar eine config.py, aber wäre es nicht sinnvoll, auch im Manual auf das pywikibot.config module in den Docs zu verweisen?

Davon völlig unabhängig etwas, das ich schon längst mal anfragen wollte, aber bis eben immer wieder vergessen habe, als es mir wegen der Suche nach einem möglichen Update wieder einfiel: In der core_stable.zip hinkt die Datei HISTORY.rst immer um eine Version zurück (aktuell: V.6.5.0, jüngste Version in der History-Datei: V.6.4.0). Kann man das nicht stattdessen so lösen, dass auch die Änderungen der aktuellen Version dort nachzulesen sind? — Speravir (talk– 20:21, 24 August 2021 (UTC)Reply

user-fixes.py

edit

Hello! :)

I can use -fix:Name as a parameter to call a specific list of fixes from my user-fixes.py file.

Can I use -fix:Name1, Name2, etc. to call some specific lists of fixes from my user-fixes.py file? - Klein Muçi (talk) 12:58, 12 February 2022 (UTC)Reply

Hi Klein Muci,
you can use the -fix command multiple times but the command must be given:
-fix:Name1 -fix:Name2 -fix:"another name"
Best
 @xqt 19:14, 12 February 2022 (UTC)Reply
Thank you! What exactly happens if I use it like you describe? Do all changes get done in 1 single edit per page or does each fix gets done in a row in different edits? Or maybe the first fix is utilized in all pages then the second fix and so on?
Assuming we have -fix:Name1 -fix:Name2 -ns:0 - Klein Muçi (talk) 00:09, 13 February 2022 (UTC)Reply
All fixed are made in one single edit for each page.  @xqt 06:58, 13 February 2022 (UTC)Reply
Thank you! One last question. Is it possible to save your replacements in another file and call them on user-fixes.py? Something like this:
fixes['Name'] =
{
    'regex': True,
	'nocase': True,
    'msg': {},
    'replacements': [NameOfFile.txt]
}
fixes['Name2'] =
{
    'regex': True,
	'nocase': True,
    'msg': {},
    'replacements': [NameOfFile2.txt]
}

etc. Klein Muçi (talk) 10:02, 13 February 2022 (UTC)Reply

No it is not possible. You have to use -pairsfile option to use replacements stored in a file.  @xqt 11:11, 13 February 2022 (UTC)Reply
I've never used that option before. Any practical examples of that written somewhere? I read the explanation here, in the table, but I couldn't understand it well. :/ - Klein Muçi (talk) 11:22, 13 February 2022 (UTC)Reply
-pairsfile option is used if you have a lot of replacements. They all can be stored in a file. For exampe if you have a repace command like
pwb replace foo bar a b one two
to replace foo-> bar a->b one->two, you can create a file and add these lines:
foo
bar
a
b
one
two
 @xqt 12:33, 13 February 2022 (UTC)Reply
I have this script in regard to citation errors:
#!/bin/bash
source $HOME/.bash_profile
python3 /data/project/shared/pywikibot/stable/scripts/replace.py -log -ns:0 -transcludes:Moduli:Citation/CS1 -fix:Gjuhet -fix:Datat -fix:Teknike -summary:"Përmirësime teknike dhe rregullime të gabimeve me referimet: %(description)s" -always
And these lines in my user-fixes.py file:
fixes['Gjuhet'] = {
    'regex': True,
	'nocase': True,
    'msg': {},
    'replacements': [
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)AEBko\ ingeles(\s*[\|\}])", r"\1en-us\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)Aarabeere(\s*[\|\}])", r"\1ar\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)Abasinisch(\s*[\|\}])", r"\1abq-latn\2"),
	... ~40k lines
	]
}
fixes['Datat'] = {
    'regex': True,
	'nocase': True,
    'msg': {},
    'replacements': [
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Jan( +\d{4})", r"\1jan\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Feb( +\d{4})", r"\1shk\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Mar( +\d{4})", r"\1mar\2"),
	...~1k lines
	]
}
fixes['Teknike'] = {
    'regex': True,
	'nocase': True,
    'msg': {},
    'replacements': [
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)booktitle\s*=\s*", r"\1book-title="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)chapterurl\s*=\s*", r"\1chapter-url="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)conferenceurl\s*=\s*", r"\1conference-url="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)contributionurl\s*=\s*", r"\1contribution-url="),
	...~100 lines
	]
}

Can I switch to:
#!/bin/bash
source $HOME/.bash_profile
python3 /data/project/shared/pywikibot/stable/scripts/replace.py -log -ns:0 -transcludes:Moduli:Citation/CS1 -pairsfile:Gjuhet.txt -pairsfile:Datat.txt -pairsfile:Teknike.txt -regex -nocase -summary:"Përmirësime teknike dhe rregullime të gabimeve me referimet: %(description)s" -always
And these 3 .txt files:
Gjuhet.txt
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)AEBko\ ingeles(\s*[\|\}])", r"\1en-us\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)Aarabeere(\s*[\|\}])", r"\1ar\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*language\s*=\s*)Abasinisch(\s*[\|\}])", r"\1abq-latn\2"),
	... ~40k lines
Datat.txt
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Jan( +\d{4})", r"\1jan\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Feb( +\d{4})", r"\1shk\2"),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*(?:access\-?|archive\-?|doi\-broken\-|lay\-|pmc\-embargo\-|publication\-|air\-?)?date\s*=\s*\d{1,2} +)Mar( +\d{4})", r"\1mar\2"),
	...~1k lines
Teknike.txt
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)booktitle\s*=\s*", r"\1book-title="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)chapterurl\s*=\s*", r"\1chapter-url="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)conferenceurl\s*=\s*", r"\1conference-url="),
	(r"(\{\{\s*cit[aeio][^\}]*\|\s*)contributionurl\s*=\s*", r"\1contribution-url="),
	...~100 lines

Klein Muçi (talk) 13:59, 13 February 2022 (UTC)Reply

-pairsfile option can be used only once for each bot run. You cannot call it multiple times and if you do, the last file is used. But you can make a feature request call at Phabricator if this feature is important.
the file content itself must be plain text not tuple like entries:
(\{\{\s*cit[aeio[^\}]*\|\s*)booktitle\s*=\s*
\1book-title=
…  @xqt 20:05, 13 February 2022 (UTC)Reply
Thank you! Straight to the point answer. I'm liking the user-fixes functionality more for the moment so I'm not going through with the request. Thank you one more time for the explanations! :) - Klein Muçi (talk) 23:57, 13 February 2022 (UTC)Reply

Commenting out code

edit

Hello! I have this script:

#!/bin/bash
source $HOME/.bash_profile
python3 /data/project/shared/pywikibot/stable/scripts/replace.py -log -v -ns:0 -fix:1 -fix:2 -fix:3 -family:wikipedia -summary:"%(description)s" -always

I want to test a new fix.

#!/bin/bash
source $HOME/.bash_profile
python3 /data/project/shared/pywikibot/stable/scripts/replace.py -log -v -ns:0 -fix:1 -fix:2 -fix:3 -fix:Test -family:wikipedia -summary:"%(description)s" -always

How can I comment out the 3 other fixes temporarily and only keep fix:Test? - Klein Muçi (talk) 10:56, 18 February 2022 (UTC)Reply

Just
replace.py -log -v -ns:0 -fix:Test -family:wikipedia -summary:"%(description)s" -always -simulate  @xqt 05:52, 22 February 2022 (UTC)Reply
Eh, but that's what I was trying to solve. I didn't want to replace it all and have to write it again after the test is over. But if there's no other way... - Klein Muçi (talk) 11:03, 22 February 2022 (UTC)Reply
Cannot follow. -fix: option takes an dict entry from fixes.py. You don’t have to remove it if you don’t use a fix. And you don’t have to call all fixes if you don’t need one. Keep your 4 fixes inside your user-fixes.py and call that -fix:Test only.  @xqt 16:52, 22 February 2022 (UTC)Reply
The idea is that I have that script saved with those 3 fixes and I didn't want to remove them altogether from the script just for a temporary test of a fourth one because I might forget what I had there. I wanted to comment them out temporarily, execute the script with the fourth one in Toolforge (jsub Name.sh) and after completing its run, uncomment those 3 fixes back and return the script to its previous state. Does that make more sense now? - Klein Muçi (talk) 17:08, 22 February 2022 (UTC)Reply
This is just a command line. Run the test in a separate command task or copy the command script and change the content accordingly.  @xqt 06:36, 24 February 2022 (UTC)Reply
Eh, I'll do that, thank you. - Klein Muçi (talk) 09:34, 24 February 2022 (UTC)Reply

msg parameter

edit

Keeping up with the Pywikibot questions, can you also explain to me how the msg parameter can be utilized in user-fixes.py? I mean all its possible use cases. I understand it adds a summary message but all the examples I see around in Mediawiki of that parameter make use of commas which makes me believe that it is possible to somehow put different summaries for a specific group of replacements? Also in here something gets mentioned about different summaries in different languages or basestrings stored in the i18n subdirectory but I'm not sure what that means in practice or if those possibilities also apply to user-fixes. - Klein Muçi (talk) 11:31, 24 February 2022 (UTC)Reply

Wikimedia Hackathon

edit

Hi! Would you have any interest in hosting a session at the Hackathon about pywikibot? We'd love to have you!

Cheers. HLepp (WMF) (talk) 03:24, 4 May 2022 (UTC)Reply

Hi @HLepp (WMF): Unfortunately I haven't found any useful time slot for CEST.  @xqt 07:42, 13 May 2022 (UTC)Reply
Hi! What time would be your preference? Maybe we can convince others to switch spots with you. HLepp (WMF) (talk) 21:50, 16 May 2022 (UTC)Reply
I added mysellf to the schedule [1]. I hope there is a way to check the online space previously.  @xqt 08:48, 17 May 2022 (UTC)Reply

Pywikibot documentation

edit

Hi! As you know, I've been looking into Pywikibot documentation as part of task T312992. I was wondering if you would be available to answer a few questions that I still have about these docs. I could post them for you here or on Phabricator, but I thought perhaps you would prefer a more synchronous chat, either on IRC or some audio / video service. Please let me know!

Thanks! KBach-WMF (talk) 11:51, 5 September 2022 (UTC)Reply

I am glad to help. Post your questions on the phab tasks. I also will try to be present at libera chat channel #pywikibot. Best  @xqt 13:17, 5 September 2022 (UTC)Reply
Perfect, thank you! KBach-WMF (talk) 13:19, 5 September 2022 (UTC)Reply

omegawiki_family.py

edit

Hi, Xqt. Hope that you are well. Omegawiki (d:Q154436) is a dead link, so, what should we do with omegawiki_family.py? Should we delete it from the "families" folder? Meno25 (talk) 13:00, 18 September 2022 (UTC)Reply

Seems Omega wiki is down for 10 months [2]. I think we can remove it from framework then. Would you like to take over? Here are the references.  @xqt 15:43, 18 September 2022 (UTC)Reply
@SabineWanner: any other suggestions?  @xqt 15:49, 18 September 2022 (UTC)Reply
It has not been down for 10 months. I have been online myself approx. two months ago, before I then was ill. As much as I know there is some problem with the server (cannot be accessed). I already had requests from some people that wanted to edit, but I don't have a clue about the server itself. --SabineWanner (talk) 12:14, 21 September 2022 (UTC)Reply
I just have seen the "down" template here which was 10 months ago. Like you I also didn't not found any connection to the server and omegawiki was reported as dead link. Therefore we removed the family file from the Pywikibot framework. If the server is reachable again the family file can be restored easily. The proposal to have omegawiki to be a wikimedia sister project was closed i.e. declined [3]. Might this be the reason for the server is down? Feel free to create a phab task or leave me a notice in that case. Thanks.  @xqt 15:57, 21 September 2022 (UTC)Reply

report_success question

edit

Hi there! I was wondering if you had any tips to give me on a PWB issue I'm having. I'm running a file upload bot. In order to prevent a specific issue with duplicates, but still ignore other warnings, I have implemented ignore_warnings as an iterable. I learned that this causes the outputs to be only True/False with no possible way to get the full responses. Is there a setting I can add that will report back the result of the action taken, with the page uploaded or the full warning message received? I found phab:T271899 which looks to be describing the issue I am having, but I thought I would check if you have a workaround. Thanks! Dominic (talk) 18:51, 18 November 2022 (UTC)Reply

cosmetic_changes-append

edit

Hi! Someone is asking at translatewiki about the message cosmetic_changes-append. I can see that it was recently changed, and I think that the right thing to do is to update the code, but I might be wrong. Can you please take a look at https://translatewiki.net/wiki/Thread:Support/Pywikibot:Cosmetic_changes-append/en ?

Thanks! Amir E. Aharoni {{🌎🌍🌏}} 11:33, 6 January 2023 (UTC)Reply

Pywikibot 8

edit

Hi, Xqt. Congratulations on publishing the new version Pywikibot 8. I just want to discuss a few issues with you related to the new release:

  1. The link to gitter is not working (gives "{"error":"Not Found"}" response). Should the link be updated or removed?
  2. The repository "pywikibot-i18n" has an old branch "compat" that hasn't been updated for 8 years (since 2015). Should this branch be deleted since compat is no longer supported?
  3. There is an old branch for Pywikibot 7.6. Should this branch be deleted now that Pywikibot 8 is published?

Thank you for your work and best wishes. Meno25 (talk) 14:50, 21 January 2023 (UTC)Reply

Thank you for this comment. I've deleted the old branches (compat and 7.6). Regarding to the gitter link I've to investigate first what this link is good for because I have no glue here. Best  @xqt 15:19, 21 January 2023 (UTC)Reply