[pywikibot] Re: Newbie question: TypeError: 'NoneType' object is not iterable - on exit of pywikibot script

2024-05-31 Thread info
Hi Florian,

no generator was specified. You should choose one of the pagegenerators option 
I guess:
https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.pagegenerators.html#generator-options

> HandleCommonsOnOSMBot(generator=gen_factory.getCombinedGenerator(), **options)
gives just None for the generator attribute.

Best
xqt

> Am 31.05.2024 um 16:36 schrieb tohuuu :
> 
> 
> Hi all,
> 
> on my first steps with Python and Pywikibot, i encounter the following 
> strange error message:
> 
> 2024-05-31 16:23:19__init__.py,  373 in _flush: VERBOSE  
> Dropped throttle(s).
> 2024-05-31 16:23:19http.py,  119 in  flush: VERBOSE  
> Closing network session.
> 2024-05-31 16:23:19http.py,  123 in  flush: VERBOSE  
> Traceback (most recent call last):
>   File "", line 198, in _run_module_as_main
>   File "", line 88, in _run_code
>   File 
> "C:\Users\florian\AppData\Roaming\Python\Python312\Scripts\pwb.exe\__main__.py",
>  line 7, in 
> sys.exit(run())
>  ^
>   File 
> "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py",
>  line 516, in run
> if not execute():
>^
>   File 
> "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py",
>  line 492, in execute
> run_python_file(filename, script_args, module)
>   File 
> "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\scripts\wrapper.py",
>  line 149, in run_python_file
> exec(compile(source, filename, 'exec', dont_inherit=True),
>   File ".\HandleCommonsOnOSMBot.py", line 192, in 
> main()
>   File ".\HandleCommonsOnOSMBot.py", line 188, in main
> HandleCommonsOnOSMBot(generator=gen_factory.getCombinedGenerator(), 
> **options).run()
>   File 
> "C:\Users\florian\AppData\Roaming\Python\Python312\site-packages\pywikibot\bot.py",
>  line 1470, in run
> self.generator = (item for item in self.generator)
>  ^
> TypeError: 'NoneType' object is not iterable
> 2024-05-31 16:23:19http.py,  132 in  flush: CRITICAL 
> Exiting due to uncaught exception TypeError: 'NoneType' object is not iterable
> 2024-05-31 16:23:19http.py,  137 in  flush: VERBOSE  
> Network session closed.
> 
> This error encounters when my script is finished and pywikibot closing the 
> network session. For the complete source code, please see
> 
> https://github.com/tohu/HandleCommonsOnOSMBot/blob/main/HandleCommonsOnOSMBot.py
> 
> I took the part starting with "def main(*args: str) -> None:" from 
> https://doc.wikimedia.org/pywikibot/stable/library_usage.html - maybe this 
> isn't the correct way to use it? Since the bot code works fine, it looks like 
> a minor problem, but i'm curious if i did something wrong.
> 
> Cheers
> 
> Florian
> 
> 
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/BDVKXYTCXTF7CRMD3KTENHEIE2NPQN35/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/7C5Z6LBMN2X2RJRNEDJT46OFFYIT7ZP4/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Path between a category and an article

2024-04-03 Thread info

Hi Binaris,

I think you can use category_graph.py script [1] to find out the category path.

Best
xqt

[1] 
https://doc.wikimedia.org/pywikibot/master/scripts/categories.html#category-graph-script

> Am 03.04.2024 um 17:17 schrieb Bináris :
> 
> 
> Hi,
> 
> given a category c and a page p, p is listed in c.articles(recurse=True)
> But is shouldn't... And I don't know the depth of it.
> Is there a simple way to find a path between them, and guess, why is the page 
> in the category?
> (I spent 10 minutes with manual trying, total fail.)
> 
> --
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/S63JZSM6HUGJLUEPNORIJQR6LUDJW3YV/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/UCT25YMLBBXJZXAW7HS5SJVRGBRVC54G/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Argument to IsRedirectPageError?

2024-04-01 Thread info
You are right Either the documentation or the implementation is wrong. I will 
try to find out what was really meant; maybe the compat release can give a hint.

Thanks for investigating.

xqt 


> Am 31.03.2024 um 17:34 schrieb Roy Smith :
> 
> The docs for BasePage.get() say:
> 
> pywikibot.exceptions.IsRedirectPageError – The page is a redirect. The 
> argument of the exception is the title of the page it redirects to.
> 
> but that doesn't seem to be what's actually happening:
> 
>> from pywikibot import Site, Page
>> from pywikibot.exceptions import IsRedirectPageError
>> 
>> site = Site("en")
>> 
>> page = Page(site, "Template:shortdescription")
>> try:
>>print(page.get())
>> except IsRedirectPageError as ex:
>>print(f"{ex.args=}")
> 
> 
> prints
> 
>> ex.args=(Page('Template:Shortdescription'),)
> 
> Am I just not understanding the doc correctly?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/6YC5X6ZKT5LGQ2BLHDDW7QYE2VPLQLVT/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/BUQFKWAIN2Y47M42NACCZQWAGFWBYYFE/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Title of the article when stopped.

2024-02-21 Thread info
Hi andr_ru,

maybe it is [[es:Ignitia]] who stopped it.

Could you please file a Phabricator task for this issue including your command 
line (and family file if not part of the framework). Possibly we had this 
already with [[en:]] leading to the main page but I am not sure.

Best
xqt



Von meinem iPhone gesendet

> Am 19.02.2024 um 09:26 schrieb andr...@mail.ru:
> 
> Hi.
> 
> I launch it with the command:
> 
> python pwb.py interwiki -start:!
> 
> And the work will stop with the error:
> Error: [[en:]]: The requested page title is empty or contains only the name 
> of a namespace.
> 
> I've searched all over the wiki and can't find what article it's in [[en:]].
> There's a last line on the screen,
> .==Post-processing [[es:Historia y mundo]]== ,
>  but it's not the same article
> 
> How can I find out which article is causing my work to stop?
> -
> in interwiki-dumps/dragonsdogma-es.txt  126 records.
> 
> Log:
> 2024-02-19 11:02:36   interwiki.py, 1431 inpost_processing: INFO 
> ==Post-processing [[es:Ignitia]]==
> 2024-02-19 11:02:36   interwiki.py, 1431 inpost_processing: INFO 
> ==Post-processing [[es:Historia y mundo]]======
> 2024-02-19 11:02:36   interwiki.py, 1431 inpost_processing: INFO 
> ==Post-processing [[es:Historia y mundo]]==
> 2024-02-19 11:02:36 _generators.py,  265 in   __init__: VERBOSE  
> PropertyGenerator: multiple requested query modules support limits; using the 
> first such module 'revisions' of ['revisions', 'info', 'categoryinfo', 
> 'templates', 'langlinks', 'pageprops']
> 2024-02-19 11:02:36 _generators.py,  265 in   __init__: VERBOSE  
> PropertyGenerator: multiple requested query modules support limits; using the 
> first such module 'revisions' of ['revisions', 'info', 'categoryinfo', 
> 'templates', 'langlinks', 'pageprops']
> 2024-02-19 11:02:36 _generators.py,  408 in  _update_limit: DEBUG
> PropertyGenerator: Set query_limit to 5000.
> 2024-02-19 11:02:36 _generators.py,  408 in  _update_limit: DEBUG
> PropertyGenerator: Set query_limit to 5000.
> 2024-02-19 11:02:36 _generators.py,  167 in   preloadpages: INFO 
> Retrieving 50 pages from dragonsdogma:en.
> 2024-02-19 11:02:36 _generators.py,  167 in   preloadpages: INFO 
> Retrieving 50 pages from dragonsdogma:en.
> 2024-02-19 11:02:36   _requests.py,  660 in _get_request_params: DEBUG
> API request to dragonsdogma:en (uses get: False):
> Headers: {'Content-Type': 'application/x-www-form-urlencoded'}
> URI: '/api.php'
> Body: 
> 'prop=revisions%7Cinfo%7Ccategoryinfo%7Ctemplates%7Clanglinks%7Cpageprops=query===5000=5000=%2A=Phantasm%7CEsperaunce%7CPhantom%7CSkeleton%7CSkeleton+Brute%7CBarn%7CEstevon%7CStilettos%7CGolden+Stilettos%7CAneled+Stilettos%7CStage+6%7CPost-Game%7CStage+1%7CA+Soldier%27s+Survey%7CSerenity+Extract%7CVigor+Extract%7CFalchion%7CSpecter%7CFedel%7CFeste%7CBeast-Steak%7CRotten+Beast-Steak%7CGransys+Flamberge%7CFlavian%7CPoison+Arrow%7COil+Arrow%7CThornflower%7CJasper+Blossom%7CLava+Flower%7CCapeflower%7CNoonflower%7CWindmill+Flower%7CGodsthrone+Blossom%7CGrandblossom%7CWilted+Blossom%7CKept+Wilted+Blossom%7CLoneflower%7C%7CStout+Undead%7CFournival%7CWakestone+Shard%7CFredro%7CFire%7CFont+of+Constitution%7CFont+of+Vigor%7CBlack+Eyeglasses%7CDominion+Claw%7CDevil%27s+Nail%7CGarvin%7CSeabird=comment%7Ccontentmodel%7Cflags%7Cids%7Cparsedcomment%7Csha1%7Csize%7Ctags%7Ctimestamp%7Cuser%7Cuserid%7Ccontent%7Croles=userinf
> o=blockinfo%7Chasmsg=5=json'
> 2024-02-19 11:02:36   _requests.py,  660 in _get_request_params: DEBUG
> API request to dragonsdogma:en (uses get: False):
> Headers: {'Content-Type': 'application/x-www-form-urlencoded'}
> URI: '/api.php'
> Body: 
> 'prop=revisions%7Cinfo%7Ccategoryinfo%7Ctemplates%7Clanglinks%7Cpageprops=query===5000=5000=%2A=Phantasm%7CEsperaunce%7CPhantom%7CSkeleton%7CSkeleton+Brute%7CBarn%7CEstevon%7CStilettos%7CGolden+Stilettos%7CAneled+Stilettos%7CStage+6%7CPost-Game%7CStage+1%7CA+Soldier%27s+Survey%7CSerenity+Extract%7CVigor+Extract%7CFalchion%7CSpecter%7CFedel%7CFeste%7CBeast-Steak%7CRotten+Beast-Steak%7CGransys+Flamberge%7CFlavian%7CPoison+Arrow%7COil+Arrow%7CThornflower%7CJasper+Blossom%7CLava+Flower%7CCapeflower%7CNoonflower%7CWindmill+Flower%7CGodsthrone+Blossom%7CGrandblossom%7CWilted+Blossom%7CKept+Wilted+Blossom%7CLoneflower%7C%7CStout+Undead%7CFournival%7CWakestone+Shard%7CFredro%7CFire%7CFont+of+Constitution%7CFont+of+Vigor%7CBlack+Eyeglasses%7CDominion+Claw%7CDevil%27s+Nail%7CGarvin%7CSeabird=comment%7Ccontentmodel%7Cflags%7Cids%7Cparsedcomment%7Csha1%7Csize%7Ctags%7Ctimestamp%7Cuser%7Cuserid%7Ccontent%7Croles=userinf
> o=blockinfo%7Chasmsg=5=json'
> 2024-02-19 11:02:37   _requests.py,  779 in   _rel

[pywikibot] Re: How to add a category to a page

2024-01-15 Thread info
textlib.replaceCategoryLinks() with add_only=True should do the job.BestxqtVon meinem iPhone gesendetAm 04.01.2024 um 13:49 schrieb John :I use a combination of getCategoryLinks() and then replaceCategoryLinks() it updates them in place, or adds them where needed.On Thu, Jan 4, 2024 at 2:58 AM  wrote:Hi,to add a category to several pages, category script can be used. For implementing a function or method, its treat method can be used as templet:https://doc.wikimedia.org/pywikibot/master/_modules/scripts/category.html#CategoryAddBotYou can also use textlib for manipulating templates.Bestxqt Von meinem iPhone gesendetAm 03.01.2024 um 21:02 schrieb Bináris :Thank you! At the end,I wrote to the end. We must care if there is already a \n ath end or not.Ethan N.  ezt írta (időpont: 2024. jan. 3., Sze, 18:47):
Bináris,A nice function for this does not currently exist for Page class. See https://phabricator.wikimedia.org/T325420.I am working on this one so it is in progress. Hopefully this weekend I will finish the initial version of the changes and start the review process. There are several workarounds, one of which is adding to end of text, which you mentioned already. One other workaround is to use textlib.replaceCategoryLinks(). See https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.replaceCategoryLinks.Thanks,Ethan

On Tue, Jan 2, 2024 at 11:45 PM Bináris  wrote:At https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.htmlI only find change_category which requires the old cat to be removed present.But how do I just add a new one w/o changing?OK, I can add it to the end of text, but that is not nice.-- Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OQZ64BNMCU6W5NC2LMXTC74ZAFNS5YLB/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CLHYEALKJVITDYSUTPVSBGKN7PXTZLXY/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MVEZD62WRZRTBKGRANEH52LIJIBXAHBJ/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4SO7UIDITXIST7AT4Z2GBTW5CEDYFYBZ/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to add a category to a page

2024-01-03 Thread info
Hi,to add a category to several pages, category script can be used. For implementing a function or method, its treat method can be used as templet:https://doc.wikimedia.org/pywikibot/master/_modules/scripts/category.html#CategoryAddBotYou can also use textlib for manipulating templates.Bestxqt Von meinem iPhone gesendetAm 03.01.2024 um 21:02 schrieb Bináris :Thank you! At the end,I wrote to the end. We must care if there is already a \n ath end or not.Ethan N.  ezt írta (időpont: 2024. jan. 3., Sze, 18:47):
Bináris,A nice function for this does not currently exist for Page class. See https://phabricator.wikimedia.org/T325420.I am working on this one so it is in progress. Hopefully this weekend I will finish the initial version of the changes and start the review process. There are several workarounds, one of which is adding to end of text, which you mentioned already. One other workaround is to use textlib.replaceCategoryLinks(). See https://doc.wikimedia.org/pywikibot/master/api_ref/textlib.html#textlib.replaceCategoryLinks.Thanks,Ethan

On Tue, Jan 2, 2024 at 11:45 PM Bináris  wrote:At https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.htmlI only find change_category which requires the old cat to be removed present.But how do I just add a new one w/o changing?OK, I can add it to the end of text, but that is not nice.-- Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/YONEOOAH3N2SCACV2Q7QMQGOS3CNBFJA/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OQZ64BNMCU6W5NC2LMXTC74ZAFNS5YLB/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FDJHJJQQQGZHMXA22EHIM5T7B4A3IFCR/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CLHYEALKJVITDYSUTPVSBGKN7PXTZLXY/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Parallel gets?

2023-03-27 Thread info
This is for the page_put_queue [1] which holds the pages which are saved asynchronously. To use it take asynchronous=True parameter for Page.save() [2] or BaseBot.userPut() [3] method. The later sets it if the parameter is not given but always parameter is set to True. There are other methods which are using asynchronous parameter. [4] See [5] for the implementation.Bestxqt[1] https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html#pywikibot.page_put_queue[2] https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.page.html#page.BasePage.save[3] https://doc.wikimedia.org/pywikibot/master/api_ref/bot.html#bot.BaseBot.userPut[4] https://codesearch.wmcloud.org/pywikibot/?q=allow_asynchronous===[5] https://doc.wikimedia.org/pywikibot/master/_modules/page/_decorators.html#_allow_asynchronousAm 28.03.2023 um 00:32 schrieb Roy Smith :Thanks for the replies.  I've got something basically working with concurrent.futures, so I guess I'll go with that.I see there's a max_queue_size setting available in user_config.py.  I assume that is related to one or another of these examples?On Mar 27, 2023, at 5:24 PM, i...@gno.de wrote:Pywikibot uses request for io methods. I had have a look at several similar libraries with asyncio support but none of them were long term supported.It is a good advice to ensure that pages are preloaded. Anyway Pywikibot does not use asyncio (yet) but it used Threads to save pages asynchronously. The common BaseBot.treat() or BaseBot.treat_page() cannot be used asynchronously because it is not Thread safe. You can find concurrent programming examples within the framework.  weblinkchecker for example uses Threads to retrieve web pages in parallel. archivebot is able to process all pages from a generator in parallel using concurrent futures. Other examples with concurrent futures can be found in login script, preload_sites, fixing_redirects and watchlist script.I hope that helps a bitBestxqtAm 27.03.2023 um 22:06 schrieb John :I’ve not checked in the v3+ version but there used to be a preload page generator that batch retrieved stuff from the API. Then pass the preloaded page object on to the parallel processing part.On Mon, Mar 27, 2023 at 3:58 PM Roy Smith  wrote:I need to issue a bunch of Page.get() requests in parallel.  My understanding is that pywikibot uses the requests library which is incompatible with async_io, so that's out.  So what do people use?  Threading?  Or, I see there's an async_io friendly requests port.  Is there a way to make pywikibot use that?___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QDE2AHAX4O6G5YTHLGGKWK5LLKKRYUST/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/AKLSJR5CSLB2RQMT5N2DZ7DYENW4JIXZ/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/F4OKUOJLTXEQ23TAK557U45IUMTTF3A3/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/U46M47IROTE2DDUX2FWHB3JOW4IQWZTA/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/3WUE6BVLR6IJMHCYQJCOON6G5YTKHH4O/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Parallel gets?

2023-03-27 Thread info
Pywikibot uses request for io methods. I had have a look at several similar libraries with asyncio support but none of them were long term supported.It is a good advice to ensure that pages are preloaded. Anyway Pywikibot does not use asyncio (yet) but it used Threads to save pages asynchronously. The common BaseBot.treat() or BaseBot.treat_page() cannot be used asynchronously because it is not Thread safe. You can find concurrent programming examples within the framework.  weblinkchecker for example uses Threads to retrieve web pages in parallel. archivebot is able to process all pages from a generator in parallel using concurrent futures. Other examples with concurrent futures can be found in login script, preload_sites, fixing_redirects and watchlist script.I hope that helps a bitBestxqtAm 27.03.2023 um 22:06 schrieb John :I’ve not checked in the v3+ version but there used to be a preload page generator that batch retrieved stuff from the API. Then pass the preloaded page object on to the parallel processing part.On Mon, Mar 27, 2023 at 3:58 PM Roy Smith  wrote:I need to issue a bunch of Page.get() requests in parallel.  My understanding is that pywikibot uses the requests library which is incompatible with async_io, so that's out.  So what do people use?  Threading?  Or, I see there's an async_io friendly requests port.  Is there a way to make pywikibot use that?___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QDE2AHAX4O6G5YTHLGGKWK5LLKKRYUST/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/AKLSJR5CSLB2RQMT5N2DZ7DYENW4JIXZ/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/F4OKUOJLTXEQ23TAK557U45IUMTTF3A3/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Huwiki has new namespaces today, Pywikibot does not handle them

2023-03-27 Thread info
Another way is to run the cache script as:pwb cache -deleteA third way is to use API_config_expiry as global option:pwb -API_config_expiry:0  

[pywikibot] Re: Versionchanged

2023-03-05 Thread info
8.1.0.dev0 is still the master branch whereas 8.0.1 is the stable branch which was 8.0.0 previously xqt Von meinem iPhone gesendetAm 05.03.2023 um 15:35 schrieb Bináris : ezt írta (időpont: 2023. márc. 3., P, 18:14):It is always the current version when the change was made.But until yesterday the current version was 8.1.0dev0, then it became 8.0.1 which could not been foreseen.
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/3RIKYIPYHANYLHKMX6DYK4RMRBLIW3T7/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FSDRSLXZNRQKU6XHJVDVWFD4H7CLLTDI/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Versionchanged

2023-03-03 Thread info
It is always the current version when the change was made.

Best
xqt

> Am 03.03.2023 um 14:46 schrieb Bináris :
> 
> 
> When you contribute something to the framework, how do you know what version 
> comes to docstring after versionadded or versionchanged?
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/D3OIDQJPFYEPDXZYM4A3YT72JEY4DOZI/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/VAFFHZ3PSMEAZOXHE7Y3UOEXM4AY4BJ2/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Line breaking the cite templates

2023-02-27 Thread info
Hi John,good point. Pywikibot also uses mwpfh or wikitextparser for template parsing. In some situations it can be more useful to use raw data of text parsers due to its hierarchical structure e. g. to repair templates with a lexer.xqtAm 28.02.2023 um 01:41 schrieb John :I use mwparserfromhell for template parsing/formatting.On Mon, Feb 27, 2023 at 11:32 AM  wrote:I don’t know what the bot has to fix and I don’t remember for a script fixing templates.There are only a few functions and methods parsing templates and one to glue the parsing result. Maybe this can help.Bestxqt Am 27.02.2023 um 13:15 schrieb Bináris :No problem, I never used cosmetic changes, but will have a look. I just wanted to know if it is ready or I have to do it. ezt írta (időpont: 2023. febr. 27., H, 12:25):Don’t see the fix but cosmetic changes only for that template. Where was the problem here?Bestxqt Von meinem iPhone gesendetAm 27.02.2023 um 07:46 schrieb Bináris :Do we have a script or fix for breaking the cite templates like this?https://hu.wikipedia.org/w/index.php?title=Cseh_K%C3%A1lm%C3%A1n=prev=25862570-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OOM7BSTDID2GVCFHIWGGAWZASMXFRELL/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4KCH7E53S355WHGIOHQUHIL5HGDUA7RN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CDH5RKZVH5QCQA5SYUIKIMPTXKPJI34T/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/X67DYMLIL5ZXT4ZHNYQDEX7NL4Z7OLAN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/A4FP3DXSPUMZSEVHHZJUSTAB2X4GAM4F/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/ZZ5ZCSLFPWI6XX6ORUCFACFXNSCAWBBR/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Line breaking the cite templates

2023-02-27 Thread info
I don’t know what the bot has to fix and I don’t remember for a script fixing templates.There are only a few functions and methods parsing templates and one to glue the parsing result. Maybe this can help.Bestxqt Am 27.02.2023 um 13:15 schrieb Bináris :No problem, I never used cosmetic changes, but will have a look. I just wanted to know if it is ready or I have to do it. ezt írta (időpont: 2023. febr. 27., H, 12:25):Don’t see the fix but cosmetic changes only for that template. Where was the problem here?Bestxqt Von meinem iPhone gesendetAm 27.02.2023 um 07:46 schrieb Bináris :Do we have a script or fix for breaking the cite templates like this?https://hu.wikipedia.org/w/index.php?title=Cseh_K%C3%A1lm%C3%A1n=prev=25862570-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OOM7BSTDID2GVCFHIWGGAWZASMXFRELL/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4KCH7E53S355WHGIOHQUHIL5HGDUA7RN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/CDH5RKZVH5QCQA5SYUIKIMPTXKPJI34T/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/X67DYMLIL5ZXT4ZHNYQDEX7NL4Z7OLAN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Line breaking the cite templates

2023-02-27 Thread info
Don’t see the fix but cosmetic changes only for that template. Where was the 
problem here?

Best
xqt 

Von meinem iPhone gesendet

> Am 27.02.2023 um 07:46 schrieb Bináris :
> 
> 
> Do we have a script or fix for breaking the cite templates like this?
> https://hu.wikipedia.org/w/index.php?title=Cseh_K%C3%A1lm%C3%A1n=prev=25862570
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OOM7BSTDID2GVCFHIWGGAWZASMXFRELL/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/4KCH7E53S355WHGIOHQUHIL5HGDUA7RN/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Multiple users in user-config.py?

2023-02-26 Thread info
Hi Roy,this is a global option which is handled by config.py directly by reading from sys.argv but does not remove it from that list.To remove it you can use the pwb.py wrapper like pwb  

[pywikibot] Re: Checkuser

2023-02-26 Thread info
Hi,neither checkuser nor checkuserlog of checkuser extension is well documented and there are no generators implemented yet. You have to setup your own generator e.g. useing api.ListGenerator [2] e.g.  gen = api.ListGenerator(listaction='checkuserlog', total=25, site=pywikibot.Site(), culuser='WikiSysop', cultarget=None, culfrom=None)  cul parameters with None can be omitted. Another way it to use APISite._generator but note that this is a hidden method and may be dropped:  site = pywikibot.Site()  gen = site._generator(api.ListGenerator, type_arg='checkuserlog', total=25, culuser='WikiSysop', cultarget=None, culfrom=None)Maybe this APISite method should become a public method.To implement direct APISite methods like APISite.checkuserlog() file a phab task for it.Bestxqt[1] https://www.mediawiki.org/wiki/Extension:CheckUser#CheckUser_and_CheckUserLog_API[2] https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.data.html#data.api.ListGenerator Von: Bináris Gesendet: 23.02.2023 21:06An: Pywikibot discussion list Betreff: [pywikibot] Re: Checkuser   Roy Smith  ezt írta (időpont: 2023. febr. 23., Cs, 20:09):It's based on mwclient instead of pywikibot, but I do have some code that uses the checkuserlog API. Thank you! I don't know mwclient and hate dealing with login, but I will have a look.
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/KRVKAG77VRS2NVJ7T3B2JASXGZWKZXQO/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Multiple users in user-config.py?

2023-02-26 Thread info
Hi,renaming the password cookie file is not a good idea after Pywikibot 8.0.0 was released because each account has its own file. [1]You may have different user config files which can be used with global -config option e.g. -config:mybot_config. [2]This new global option was introduced with Pywikibot 7.7 [3]Bestxqt[1] https://phabricator.wikimedia.org/rPWBCba56084e12a496bbb4f71dfea0fd88a818c18a81[2] https://doc.wikimedia.org/pywikibot/master/global_options.html#global-options​​​[3] https://phabricator.wikimedia.org/rPWBCa02dc8dcf93ebb35e0b24884eddc6a4ff517584a Von: Bináris Gesendet: 24.02.2023 04:27An: Pywikibot discussion list Betreff: [pywikibot] Re: Multiple users in user-config.py?   Roy Smith  ezt írta (időpont: 2023. febr. 24., P, 0:42):My bot needs to be able to run as either of two different accounts depending on the task.  DYKToolsBot for most things, DYKToolsAdminBot for specific tasks that need admin rights.  How do I do this? I just got up to quickly wirite somewhere that we need separate user-fixes.pys per user, best defined in config.py, and this mail waited me here. :-)So we should have per user configs. An ugly workaround by that time what I did with logins: a Windows batch.ren other.lwp temp.lwpren pywikibot.lwp other.lwpren temp.lwp pywikibot.lwp If you start your scripts froma  batch (or Linux script), this is no extra pain with user-config.py. 
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QRXUOHVWW2B7L3AIPUCFCZKAYUQHKEPZ/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Unable to commit

2023-02-20 Thread info
… Sorry the mail was committed by accident…Anyway I would like to recommend TortoiseGit. I’ve wrote a documentation at mediawiki wiki how to use it.Maybe we can organize an online meeting to introduce this way or I could help remote via TeamViewer. How do you find my proposals, how should we proceed? Bestxqt Am 20.02.2023 um 18:11 schrieb i...@gno.de:Hi Binaris,I am with you that gerrit is much more difficult to handle than svn. I remember that bad time after the switch and I had to make a lot of tries and errors and I was about to give up and leave the project.As we met us in Berlin decades ago I think you also was a Windows user and I thought that you was more familiar with git/gerrit than I was it that date.Anyway I have found a nice way to contribute to the gerrit repository: The magic is TortoiseGit, easy to use, graphic UI and some useful Am 20.02.2023 um 14:20 schrieb Bináris :Thank you for the idea! This sounds interesting. But I would have to upload my private key to Toolforge, which sounds bad, wouldn't I?Yusuke Matsubara  ezt írta (időpont: 2023. febr. 20., H, 12:48):Hi Bináris

Can you perhaps push from your toolforge user directory? [1] As a
workaround, something like this might work for you.

1. Download the pywikibot zip to your local environment. Apparently
it's Windows in your case, but it can be anything.
2. Make changes to the files. I assume you can run tests as well.
3. Use ssh to login to toolforge, and use git clone to setup a clone
of the pywikibot git repository in your toolforge user directory.
4. Copy the locally changed files to your toolforge user directory.
(Use a rsync or sftp client.)
5. Back to the toolforge shell, commit the changes to the repository
in your toolforge user directory, and push using git review.

[1] https://wikitech.wikimedia.org/wiki/Portal:Toolforge/Quickstart

# I see the linked phabricator ticket was declined because the
discussion was getting out of scope. I hope this one last message
helps. Otherwise, we probably shouldn't continue talking about
individual setups here as well.

-Yusuke (User:Whym)


On Wed, Feb 15, 2023 at 8:19 PM Bináris  wrote:
>
> Folks, I really made a lot of effort, even asked somebody to help IRL, but I am tired.
>
> I want develop Pywikibot, instead I am struggling with the working environment. Although git is hundred times as complicated as SVN and gerrit is a nightmare, my main problem is with git installing i18n submodule.
> See https://phabricator.wikimedia.org/T329452
>
> It causes two main problems:
>
> I cannot run tests. I have another copy of Pywikibot from downloaded zip, I can run tests there, but the same command fails in git copy.
> I cannot push my commits. For some reason an i18n part is always included which makes Jenkins fail. Now I can remove it after pushing, but Jenkins fails again, see https://gerrit.wikimedia.org/r/c/pywikibot/core/+/888745
>
> Error message: https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doctest-docker/7631/console : FAILURE in 33s
> I am very frustrated and disappointed, but I cannot do anything until T329452 is solved somehow.
>
> --
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MQWDKSWS5LBBEZ4LHOMGAZRKFG3O7OZM/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QLKUHZGPT4FCVE54ZVR7VSBMOE43VIE6/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/RB3QT4VOE3ULBQWW6L3MA7CB77AMYRZF/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/G2W4F6VS2247JLI32N7CPHT47PVY47A3/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Unable to commit

2023-02-20 Thread info
Hi Binaris,I am with you that gerrit is much more difficult to handle than svn. I remember that bad time after the switch and I had to make a lot of tries and errors and I was about to give up and leave the project.As we met us in Berlin decades ago I think you also was a Windows user and I thought that you was more familiar with git/gerrit than I was it that date.Anyway I have found a nice way to contribute to the gerrit repository: The magic is TortoiseGit, easy to use, graphic UI and some useful Am 20.02.2023 um 14:20 schrieb Bináris :Thank you for the idea! This sounds interesting. But I would have to upload my private key to Toolforge, which sounds bad, wouldn't I?Yusuke Matsubara  ezt írta (időpont: 2023. febr. 20., H, 12:48):Hi Bináris

Can you perhaps push from your toolforge user directory? [1] As a
workaround, something like this might work for you.

1. Download the pywikibot zip to your local environment. Apparently
it's Windows in your case, but it can be anything.
2. Make changes to the files. I assume you can run tests as well.
3. Use ssh to login to toolforge, and use git clone to setup a clone
of the pywikibot git repository in your toolforge user directory.
4. Copy the locally changed files to your toolforge user directory.
(Use a rsync or sftp client.)
5. Back to the toolforge shell, commit the changes to the repository
in your toolforge user directory, and push using git review.

[1] https://wikitech.wikimedia.org/wiki/Portal:Toolforge/Quickstart

# I see the linked phabricator ticket was declined because the
discussion was getting out of scope. I hope this one last message
helps. Otherwise, we probably shouldn't continue talking about
individual setups here as well.

-Yusuke (User:Whym)


On Wed, Feb 15, 2023 at 8:19 PM Bináris  wrote:
>
> Folks, I really made a lot of effort, even asked somebody to help IRL, but I am tired.
>
> I want develop Pywikibot, instead I am struggling with the working environment. Although git is hundred times as complicated as SVN and gerrit is a nightmare, my main problem is with git installing i18n submodule.
> See https://phabricator.wikimedia.org/T329452
>
> It causes two main problems:
>
> I cannot run tests. I have another copy of Pywikibot from downloaded zip, I can run tests there, but the same command fails in git copy.
> I cannot push my commits. For some reason an i18n part is always included which makes Jenkins fail. Now I can remove it after pushing, but Jenkins fails again, see https://gerrit.wikimedia.org/r/c/pywikibot/core/+/888745
>
> Error message: https://integration.wikimedia.org/ci/job/pywikibot-core-tox-doctest-docker/7631/console : FAILURE in 33s
> I am very frustrated and disappointed, but I cannot do anything until T329452 is solved somehow.
>
> --
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/MQWDKSWS5LBBEZ4LHOMGAZRKFG3O7OZM/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/QLKUHZGPT4FCVE54ZVR7VSBMOE43VIE6/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgPublic archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/RB3QT4VOE3ULBQWW6L3MA7CB77AMYRZF/To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/BYWHZ3RI7LVXKXOFCMHU3C2WPOMH5VR3/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot.stopme()

2023-02-20 Thread info
Hi Binaris,

stopme() is no longer needed. It is always called when the script terminated or 
if using pywikibot.sleep() with 30 seconds or more or with BaseBot.exit(). It 
is only useful if you run several parallel bot instances. You can call it if 
you have your own wait cycles or long term processing. You don’t need it if 
your script never writes to the wiki.

Best
xqt

> Am 19.02.2023 um 11:00 schrieb Bináris :
> 
> 
> Is pywikibot.stopme() still useful? I don't see it in the scripts.
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> Public archives at 
> https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/N4YTJSVS7FF4ATD7DB7IJ4JHWSCGSHLV/
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/OUGLVI6FDLW5XB7MPW4R4I7TSQ42H5TW/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 8 relase

2023-01-21 Thread info
Hi folks,a new stable release 78 was deployed. It can be used at PAWS as well as at toolforge and can be installed via pip, downloaded from https://pywikibot.org or updated from remote repository. What is new with it?Breaking changesPython 3.5 and 3.6.1 support has beend dropped. mwparserfromhell packages is mandatory, dependencies for other packages was updated. MediaWiki < 1.27 is no longer supported. [1] On the other hand Python 3.12 is supported.Improvements 2FA-login is supported [2]- Sphinx theme was changed to Futo and documentation has been improved- -site:meta or -site:commons are valid short site code commands (instead of -site:meta:meta or -site:commons:commons)- only sections can be copied with generate_user_files [3]- roundrobin_generators [4] is used to combine generators if a limit is given- a cookie file is created for each account for a better support of multiple accounts [5]- federated wikibase is supported [6]For other changes please refer the changelog [7]Have fun.xqt[1] https://doc.wikimedia.org/pywikibot/stable/changelog.html#breaking-changes[2[ https://phabricator.wikimedia.org/T186274[3] https://phabricator.wikimedia.org/T145372[4] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.tools.html#tools.itertools.roundrobin_generators[5] https://phabricator.wikimedia.org/T324000[6] https://phabricator.wikimedia.org/T173195[7] https://doc.wikimedia.org/pywikibot/stable/changelog.html
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/B5EE6WDG557PJK4LDRNKLBM3C3MUKRLS/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Simplifying logging?

2023-01-10 Thread info
Yes, good idea to work on it.BestxqtAm 10.01.2023 um 16:58 schrieb Roy Smith :I've opened https://phabricator.wikimedia.org/T326650 on this.On Jan 4, 2023, at 7:25 PM, Roy Smith <r...@panix.com> wrote:PS, quoting from https://docs.python.org/3.9/howto/logging.html#logging-advanced-tutorial...Note It is strongly advised that you do not add any handlers other than NullHandler to your library’s loggers. This is because the configuration of handlers is the prerogative of the application developer who uses your library. The application developer knows their target audience and what handlers are most appropriate for their application: if you add handlers ‘under the hood’, you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements.On Jan 4, 2023, at 7:14 PM, Roy Smith <r...@panix.com> wrote:Pywikibot, even if you're just using it as a library, configures its own complicated logging structure:   o   "pywiki"   |   Level Level 11   |   Propagate OFF   |   Handler  (INFO)>   |     Level INFO   |     Filter    |     Formatter fmt='%(message)s%(newline)s' datefmt=None   |   Handler  (STDOUT)>   |     Level STDOUT   |     Filter    |     Formatter fmt='%(message)s%(newline)s' datefmt=None   |   Handler  (WARNING)>   |     Level WARNING   |     Formatter fmt='%(levelname)s: %(message)s%(newline)s' datefmt=None   |   |   |   o<--[pywiki.wiki]   |       |   |       o<--"pywiki.wiki.family"   |           Level NOTSET so inherits level Level 11   |Is there any way to make it not do this?  I want to have full control of the logging config in my application.  In particular, I want all the logging to go to my logfile.  Having a library install its own handlers which are hard-wired to a TerminalHandler just complicates that.___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at 
https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/Q4JMIBBJDNNSCECKLFRBV6ERV26RBTGZ/
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Pywikibot documentation

2022-12-23 Thread info
Hi Bináris,yes, the documentation at dwo is 99% from docstrings and readme and other information files. The underlying markup is restructuredtext but sphinx is used to create the final documentation files; it comes with additional roles and elements for reference links, creates table of contents, module index, element index etc. The sphinx documentation can be found at https://www.sphinx-doc.org/en/master/BestxqtAm 21.12.2022 um 15:30 schrieb Bináris :Thank you, I could not follow the details, but anyway, that was a great work.Please help me understand the infrastructure.We have Manual:Pywikibot on mediawiki.org, which is a completely manual work.Quite independently, we have https://doc.wikimedia.org/pywikibot/, which should be partially? completely? automatic. It comes from docstrings of scripts and methods.Is that correct?The syntax in docstrings is strange for me. Where is it described? ezt írta (időpont: 2022. dec. 15., Cs, 18:21):Hi all,our Pywikibot documentation has been revised (thank you KBach).Please visit the new documentation style. Comments are very welcome at https://phabricator.wikimedia.org/T322212 or by replying this mail.- https://doc.wikimedia.org/pywikibot/tests/ the new furo theme with Sphinx 5.3- https://doc.wikimedia.org/pywikibot/master/ the old nature theme with Sphinx 5.3- https://doc.wikimedia.org/pywikibot/stable/ the old nature theme with Sphinx 5.1.1Bestxqt 
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Page views

2022-12-18 Thread info
I don’t see a diagram there:Informace o stránce „Ivan Konstantinovič Matrosov“cs.wikipedia.orgIs it an extension?Did you mean main_authors() Page method?page — MediaWiki Pages — Pywikibot 8.0.0.dev0 documentationdoc.wikimedia.orgBestxqtAm 18.12.2022 um 08:53 schrieb Bináris :At left of articles there is a page information link, which shows recent page views on a diagram.Can I get these page views numerically by Pywikibot?-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error when trying to log in

2022-12-18 Thread info
It is 1.38.4 Am 18.12.2022 um 01:56 schrieb Bináris :What MediaWiki version uses that site? ezt írta (időpont: 2022. dec. 17., Szo, 18:11):
  

  
  
I'm trying to get pywikibot set up for the first time. It's on a Miraheze site and I'm getting this error when I try to log in:---WARNING: Non-JSON response received from server comprehensibleinputwiki:en for urlhttps://comprehensibleinput.miraheze.org/w/api.phpThe server may be down.Status code: 200The text message is:MediaWiki API help - Comprehensible Input Wikidocument.documentElement.className="client-js";RLCONF={"wgBreakFrames":true,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"7a406c0d0d1c2121406e444b","wgCSPNonce":false,"wgCanonicalNamespace":"Special","wgCanonicalSpecialPageName":"ApiHelp","wgNamespaceNumber":-1,"wgPageName":"Special:ApiHelp","wgTitle":"ApiHelp","wgCurRevisionId":0,"wgRevisionId":0,"wgArticleId":0,"wgIsArticle":false,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Special:ApiHelp","wgRelevantArticleId":0,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgNoticeProject":"all",...So it seems that it can access the page, but is not parsing it correctly for some reason. Anyone know what the issue is?  

___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: 2FA

2022-12-17 Thread info
Hi Bináris,Pywikibot master (8.0) does support 2FA. Just login with your sysop account. You will be asked for the password and after that for the 2FA token.⚓ T186274 Enable 2FA normal loginphabricator.wikimedia.orghttps://doc.wikimedia.org/pywikibot/master/api_ref/login.html#login.ClientLoginManagerBestxqtAm 17.12.2022 um 11:30 schrieb Bináris :I wrote a script which requires admin rights. Someone told he couldn't use it because Pywikibot does not supoort 2FA login. Is that correct?-- Bináris
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: What's with the APISite.encodings() magic?

2022-12-11 Thread info

Hi,

It is not a reimplementation of class inheritance. The API method is delegated 
to the Family method for its site code only e.g. site.encodings() calls 
site.family.encodings(site.code).

Best
xqt

> Am 12.12.2022 um 02:50 schrieb Roy Smith :
> 
> I've been beating my head against the wall trying to figure out how to build 
> a Mock of APISite.  If I do the obvious:
> 
>site = mocker.MagicMock(spec=APISite)
> 
> I end up with:
> 
>> AttributeError: Mock object has no attribute 'encodings'
> 
> Yet, if I hand-build a Site object, sure enough it does:
> 
 import pywikibot
 site = pywikibot.Site("en", "wikipedia")
 site.encodings()
> ('utf-8', 'iso-8859-1')
 
> 
> To make a long story short, eventually I found this bit of magic in 
> _basesite.py:
> 
>>def __getattr__(self, attr):
>>"""Delegate undefined methods calls to the Family object."""
>>if hasattr(self.__class__, attr):
>>return getattr(self.__class__, attr)
>>try:
>>method = getattr(self.family, attr)
>>if not callable(method):
>>raise AttributeError
>>f = functools.partial(method, self.code)
>>if hasattr(method, '__doc__'):
>>f.__doc__ = method.__doc__
>>return f
>>except AttributeError:
>>raise AttributeError("{} instance has no attribute '{}'"
>> .format(self.__class__.__name__, attr))
> 
> 
> WTF?  I mean, I see what it's doing, but why go to this level of obfuscation? 
>  It's basically reimplementing class inheritance manually (and in a way which 
> is totally beyond the ability of Mock to understand).
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-29 Thread info
This is Windows driven where .py is associated with Python.exe which was set 
during installation.

Von meinem iPhone gesendet

> Am 29.11.2022 um 16:38 schrieb Bináris :
> 
> 
> Thank you!
> How does pwb work for you without .py?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-29 Thread info
I created T324000 for cookie improvements.

Best
xqt 


> Am 28.11.2022 um 21:52 schrieb Bináris :
> 
> 
> I made a workaround so that I don't heve to log in all the time. :-)
> swap.bat is:
> ren other.lwp temp.lwp
> ren pywikibot.lwp other.lwp
> ren temp.lwp pywikibot.lwp
> del temp.lwp
> 
> So I have to type swap and everything is fine. But I still don't know if I 
> have to use both accounts in one script. In compat there was a sysopname in 
> config, and it automatically switched to that if it was needed.
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: pywikibot is making a mockery of my tests

2022-11-28 Thread info
Just an idea but I haven’t verified: BaseSite has a __getattr__ method defined 
which delegates methods to its Family class. Maybe mock.patch has a side effect 
which leads to that behaviour you described due to this method. To verify you 
could comment out this method and test again.

Best
xqt

> Am 29.11.2022 um 02:49 schrieb Roy Smith :
> 
> 
> I've got:
> 
> platform darwin -- Python 3.9.13, pytest-7.2.0, pluggy-1.0.0
> rootdir: /Users/roy/dev/dyk-tools, configfile: src/pages/pytest.ini
> plugins: mock-3.10.0, socket-0.5.1
> 
> 
> When I run the following:
> 
> def test_ip(mocker):
> mock_IPv4Address = mocker.patch('ipaddress.IPv4Address', autospec=True)
> ip = mock_IPv4Address('1.2.3.4')
> assert mock_IPv4Address.xxyyzz
> 
> 
> def test_site(mocker):
> mock_Site = mocker.patch('pywikibot.Site', autospec=True)
> site = mock_Site('en', 'wikipedia')
> assert site.xxyyzz
> 
> 
> test_ip() fails, as I expect it to, with AttributeError: Mock object has no 
> attribute 'xxyyzz'.  But, test_site() passes.  WTF?  Why does it not also 
> fail with the same error?
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-28 Thread info
Thank you for this example. I’ll have a look on this issue and will try to find 
a solution.

Best
xqt

Von meinem iPhone gesendet

> Am 28.11.2022 um 20:38 schrieb Bináris :
> 
> 
> 
> Yes. BinBot is the bot account and Bináris is the admin account. The second 
> login throws out the previous one. Respectively:
> 
> c:\Pywikibot>python pwb.py -user:Bináris login -all
> ERROR: wikipedia:* is not a valid site, please remove it from your user-config
> Password for user Bináris on wikipedia:hu (no characters will be shown):
> Logging in to wikipedia:hu as Bináris
> Logged in on wikipedia:hu as Bináris.
> 
> c:\Pywikibot>python pwb.py -user:BinBot login -all
> ERROR: wikipedia:* is not a valid site, please remove it from your user-config
> Password for user BinBot on wikipedia:hu (no characters will be shown):
> Logging in to wikipedia:hu as BinBot
> Logged in on wikipedia:hu as BinBot.
> 
> c:\Pywikibot>python pwb.py -nolog -user:Bináris userpageprotect.py
> pywikibot.exceptions.UserRightsError: User "None" does not have required user 
> right "protect"
> CRITICAL: Exiting due to uncaught exception  'pywikibot.exceptions.UserRightsError'>
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Logins

2022-11-28 Thread info
They are stored in pywikibot.lwp file in the config.datafilepath. Have you used 
the -user option together with login e.g.

pwb -user:Foo login -all

?

Best
xqt


> Am 28.11.2022 um 11:41 schrieb Bináris :
> 
> 
> Where are the logins stored? In compat they had an obvious directory. Now I 
> searched it a lot, but did not find.
> 
> Whenever I run login.py, the previous account is thrown out, so I cannot 
> comfortably use two accounts. Is it on purpose?
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Do I need pwb.py?

2022-11-17 Thread info
Hi Binaris,I’ll to investigate into this matter this weekend. Following some ideas:Seems the config.log variable isn’t an empty list. Refer my other may to figure it out.You 2nd example does not work because version script does not use handleargs. To use global args you have to use global options with the pwb wrapper:pwb -nolog version You can also play with logfile settings.config — Pywikibot Config File — Pywikibot 8.0.0.dev0 documentationdoc.wikimedia.orgNumeric config options can be given as global option, e.g.pwb -logfilesize:256 -logfilecount:0 touch -page:user:xqtDoes it help?Note: these setting is for each script because logs are written per script name.Have you ever cleared the api cache? It may need a lot of space if accumulated over months. Did you ever run Pywikibot tests? tests have its own api cache. Check your installed site packages:pip freezeMaybe there are some you don’t need and space can be freed. For example wikitextparser is not necessary if you have mwparserfromhell installed.BestxqtAm 17.11.2022 um 09:14 schrieb Bináris :To the prevoius:The snake bites its own tail, we say here.There are a lot of logging errors because the script could not log the previous error. But it should not have logged anything, only perform a task, and write on screen and modify a page on wiki. In MY script nothing uses the device.
___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Do I need pwb.py?

2022-11-16 Thread info
Hi Bináris,

using the pwb.py wrapper is optional but you can call a script directly without 
it. There are a few advantages:

1. You don’t have to give script path where the script resides. You can give 
some user script paths in your user-config.py, it also searches for scripts in 
scripts/user scripts/ and scripts/ and finally in Pywikibot/scripts/ folder.
2. Scripts can be found even there is a spelling mistake in the script name you 
typed in. For example try pwb hello :)
3. The pwb.py checks wether your Python version is high enough.
4. The wrapper also validates dependencies and their version.
5. It provides all global options even your script does not use 
pywikibot.handleargs(). This may be useful e.g. to set different sites with, 
different user accounts with your script, run the script in simulation without 
api write, use a different user-config.py file. Also all numeric (and boolean) 
config values can be set as global option.

There is no disadvantage known when using it.

Best
xqt

> Am 16.11.2022 um 23:13 schrieb Bináris :
> 
> 
> Hi,
> I write scripts, mostly for temporary tasks. I understand, that pwb.py 
> handles arguments and logs and finds my script in /scripts/userscripts.
> Most of these scripts don't excpect arguments, the task is wired in. So is 
> there any advantage of using pwb.py in this case?
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: The bot is not working

2022-11-09 Thread info
Hi, I wasn’t able to reproduce this issue:pwb redirect do -site:wikisource:heworks as expected. Was it perhaps a temporary issue?BestxqtAm 09.11.2022 um 11:11 schrieb ישראל קלר :ERROR: Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\site\_basesite.py", line 192, in __getattr__    method = getattr(self.family, attr)AttributeError: 'Family' object has no attribute '_namespaces'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\tools\__init__.py", line 726, in wrapper    return getattr(obj, cache_name)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\site\_basesite.py", line 200, in __getattr__    raise AttributeError("{} instance has no attribute '{}'"AttributeError: APISite instance has no attribute '_namespaces'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\data\api\_requests.py", line 681, in _http_request    response = http.request(self.site, uri=uri,  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\comms\http.py", line 233, in request    r = fetch(baseuri, headers=headers, **kwargs)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\comms\http.py", line 399, in fetch    callback(response)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\comms\http.py", line 272, in error_handling_callback    raise FatalServerError(str(response))pywikibot.exceptions.FatalServerError: HTTPSConnectionPool(host='he.wikisource.org', port=443): Max retries exceeded with url: /w/api.php?action="" (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\site\_basesite.py", line 192, in __getattr__    method = getattr(self.family, attr)AttributeError: 'Family' object has no attribute '_namespaces'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\tools\__init__.py", line 726, in wrapper    return getattr(obj, cache_name)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\site\_basesite.py", line 200, in __getattr__    raise AttributeError("{} instance has no attribute '{}'"AttributeError: APISite instance has no attribute '_namespaces'. Did you mean: 'namespaces'?During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pwb.py", line 39, in     sys.exit(main())  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pwb.py", line 35, in main    runpy.run_path(str(path), run_name='__main__')  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 289, in run_path    return _run_module_code(code, init_globals, run_name,  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 96, in _run_module_code    _run_code(code, mod_globals, init_globals,  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code    exec(code, run_globals)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\scripts\wrapper.py", line 516, in     main()  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\scripts\wrapper.py", line 500, in main    if not execute():  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\scripts\wrapper.py", line 487, in execute    run_python_file(filename, script_args, module)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\scripts\wrapper.py", line 147, in run_python_file    exec(compile(source, filename, 'exec', dont_inherit=True),  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\scripts\redirect.py", line 742, in     main()  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\scripts\redirect.py", line 733, in main    if gen_factory.namespaces:  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\pagegenerators\_factory.py", line 191, in namespaces    self.site.namespaces.resolve(self._namespaces))  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\tools\__init__.py", line 728, in wrapper    val = fn(obj)  File "C:\Users\IMOE001\Downloads\pywikibot-master\pywikibot-master\pywikibot\site\_basesite.py", 

[pywikibot] Re: How to analyze block logs?

2022-11-01 Thread info
Btw the quarry url can be passed as pagegenerators -url option:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.pagegenerators.html?highlight=pagegenerators#generator-optionshttps://phabricator.wikimedia.org/T239436xqtAm 02.11.2022 um 02:57 schrieb i...@gno.de:Hi Roy,this is great. And It would be nice to have a Pywikibot interface to quarry I think.xqtAm 02.11.2022 um 02:29 schrieb i...@gno.de:Hi,I think blocks() can be used:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._generators.GeneratorsMixin.blocksbut there is no possibility for expiry filtering and you have to do it with the query result.Maybe MySQL or SPARQL gives a way but I am not familiar wir it:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.data.html#module-dataBestxqtAm 01.11.2022 um 23:54 schrieb John :Nothing currently exists, but should be fairly easy using a log parser and a local database.On Tue, Nov 1, 2022 at 5:39 PM Bináris  wrote:Hi,I want to write a script that monitors block logs or the list of active blocks for a certain reason (open proxy), and warns me if a block expires soon.Warning may be written either to a noticeboard or a mailing list, the main thing is to find them.Rationale: we give 1 year block for proxies, but after expiration they are likely to be still open, and need revision.Do we have a clever tool for this? How would you begin the task?-- Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to analyze block logs?

2022-11-01 Thread info
Hi Roy,this is great. And It would be nice to have a Pywikibot interface to quarry I think.xqtAm 02.11.2022 um 02:29 schrieb i...@gno.de:Hi,I think blocks() can be used:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._generators.GeneratorsMixin.blocksbut there is no possibility for expiry filtering and you have to do it with the query result.Maybe MySQL or SPARQL gives a way but I am not familiar wir it:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.data.html#module-dataBestxqtAm 01.11.2022 um 23:54 schrieb John :Nothing currently exists, but should be fairly easy using a log parser and a local database.On Tue, Nov 1, 2022 at 5:39 PM Bináris  wrote:Hi,I want to write a script that monitors block logs or the list of active blocks for a certain reason (open proxy), and warns me if a block expires soon.Warning may be written either to a noticeboard or a mailing list, the main thing is to find them.Rationale: we give 1 year block for proxies, but after expiration they are likely to be still open, and need revision.Do we have a clever tool for this? How would you begin the task?-- Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: How to analyze block logs?

2022-11-01 Thread info
Hi,I think blocks() can be used:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._generators.GeneratorsMixin.blocksbut there is no possibility for expiry filtering and you have to do it with the query result.Maybe MySQL or SPARQL gives a way but I am not familiar wir it:https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.data.html#module-dataBestxqtAm 01.11.2022 um 23:54 schrieb John :Nothing currently exists, but should be fairly easy using a log parser and a local database.On Tue, Nov 1, 2022 at 5:39 PM Bináris  wrote:Hi,I want to write a script that monitors block logs or the list of active blocks for a certain reason (open proxy), and warns me if a block expires soon.Warning may be written either to a noticeboard or a mailing list, the main thing is to find them.Rationale: we give 1 year block for proxies, but after expiration they are likely to be still open, and need revision.Do we have a clever tool for this? How would you begin the task?-- Bináris
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org

___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: FlaggedPagesGenerator

2022-10-17 Thread info
Hi Binaris,

I fear that extension is not implemented yet. Flagged revisions is no longer 
activated on new Wikis I guess. Anyway your suggestion looks important.

https://phabricator.wikimedia.org/T57081

Best
xqt

Von meinem iPhone gesendet

> Am 17.10.2022 um 20:56 schrieb Bináris :
> 
> 
> Hi,
> 
> I am new to core.
> Is there currently any possibility to work only on flagged pages?
> https://en.wikipedia.org/wiki/Wikipedia:Flagged_revisions / 
> https://de.wikipedia.org/wiki/Hilfe:Gesichtete_Versionen
> 
> It would be useful to work only on currently flagged or currently unflagged 
> versions. For the flagged versions, a command line switch is useful for not 
> programmers.
> 
> Rationale:
> When unflagged versions are edited by bots, the diff to check can be messy, 
> and users are angry with bot owners.
> Alhough some changes (i.e. spelling corrections) are necessary, fore example 
> cosmetic changes could be prohibited by communities on unflagged pages.
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: New Pywikibot 7.7 release

2022-10-12 Thread info
Hi Binaris, 

Yes, that is surely wrong. Current master as well as stable branch are 
available as nightly dump at https://pywikibot.org

Thank you.
Regard
xqt



Von meinem iPhone gesendet

> Am 12.10.2022 um 08:30 schrieb Bináris :
> 
> 
> On the page https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation
> may the warning " The last version of the zip-file is currently (14 July 
> 2022) broken, it contains __metadata__.py instead of version string." be 
> removed?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.7 release

2022-09-28 Thread info
Hi all,a new stable release 7.7 was deployed. It can be used at PAWS as well as at toolforge and can be installed via pip, downloaded from https://pywikibot.org or updated from remote repository. What is new with it?- the topmost 5 authors based on the current text proportion can be found with Page.main_authors() method- categories can be preloaded with APISite.preload.pages() [2]- with global -config option the user-config.py filename can be changed; this is usefull to have different settings e.g. different bot accounts- APISite.page_from_repository() is able to get a page located at the repository itself instead of raising NotImplementedError [4]- a new script "create_isbn_edition" was added, contributed by Geert Van Pamel; thanks a lot for that. [5]- with -async option login utility scripts runs faster in concurrent tasks [6]- archivebot.py script has been improved. -async option runs the bot in concurrent task which is up to ten times faster; with -sort option the archive can be sorted by latest timestamp; unsigned threads are archived with the following thread- Watchlist of watchlist.py script is retrieved faster in concurrent tasks.Refer the changelog for other changes: [7]This is the last stable release supporting Python 3.5 Recently only 0.6% had used this Python version. The next Pywikibot release 8 is under development and needs at least Python 3.6.1.Bestxqt[1] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.page.html#page._toolforge.WikiBlameMixin[2] htps://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._generators.GeneratorsMixin.preloadpages[3] https://doc.wikimedia.org/pywikibot/stable/global_options.html#global-options[4] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._apisite.APISite.page_from_repository[5] https://doc.wikimedia.org/pywikibot/stable/scripts/wikibase.html#create-isbn-edition-script-description[6] https://doc.wikimedia.org/pywikibot/stable/utilities/scripts_ref.html#login-script[7] https://doc.wikimedia.org/pywikibot/stable/changelog.html
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: authenticate as bot and sysop

2022-09-08 Thread info
Hi,I have shown several ways to determine the user account to be used with my previous mail. Your workarround is interesting: instead of having different directories to specify the user-config.py file it c/would be usefull to have an option like -config to specify the user config file name directly like -config:myconfig or -config:myotherconfig.py. What do you think about this proposal?Greetingsxqt Von: Johnuniq Gesendet: 08.09.2022 11:19An: Kopie: Pywikibot discussion list Betreff: Re: [pywikibot] Re: authenticate as bot and sysop I did not do anything clever. I just copied user-config.py from thepywikibot directory[1] to my own directory. I did that twice, usingdifferent names like user-config-one.py and user-config-two.py. Then Iedited the two files to how I wanted. Each had a different userconfigured for the same family and language. Then I put a very simplescript (shell/batch/Python, whatever is easy) in a PATH directory.Before running my pywikibot script, I would run the simple script tocopy the appropriate config file to the pywikibot directory. I wouldthen run the pywikibot login script to login, then run my bot program.I did not need to do that often, and I did not need to change usersoften, so it was not difficult to take those extra steps.[1] https://www.mediawiki.org/wiki/Manual:Pywikibot/user-config.pyOn Thu, Sep 8, 2022 at 5:58 PM  wrote: Sorry I cannot follow this approach. Can you explain?>> Best>> xqt> Von: Johnuniq > Gesendet: 08.09.2022 09:23> An: Pywikibot discussion list > Betreff: [pywikibot] Re: authenticate as bot and sysop>> > how You use different configs in the same script?>> In my case, I would first run a script to select which user I needed> and that script copied the appropriate user-config file. After that, I> would run a second script that used pywikibot. I have not tried> YiFei Zhu's solution.> ___> pywikibot mailing list -- pywikibot@lists.wikimedia.org> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: authenticate as bot and sysop

2022-09-08 Thread info
Several methods to use multiple bot accountsDue to T71283 sysop account setting was given up with release 3.0.20200111. On the other hand you may have multiple bot accounts, e.g. onw for production system and one for test purposes. And none of them may be part of the sysop group. How can you use different accounts?The central settings of pywikibot are made in config.py and there may be a user-config.py which is able to override the default setting in config.py. The minimum settings of user-config.py is the default family where the bot is running and the bot account related to this family. This is made by the following entry:mylang = 'cs'family = 'wikipedia'usernames['wikipedia']['cs'] = 'Test1'where mylang and family determines the site, and usernames determines a account name for specific sites.Pywikibot provides global options which are able to override (user-)config settings. [1] The most commen options are -lang and -family to change the default site a bot is working on. With Pywikibot release 5.2 a -site option was added to determine the site directly.In the same way as the default site can be overridden by these options given above, there is a -user option to override the user account given with user-config.py.Finally there is another global option -dir which can change the directory where to read the user-config.py file; this enables to have several config files to be chosen.All global options are available with scripts shipped with Pywikibot framework. Just call: Global options can also be used with you privat scripts if the pywikibot.handle_args function [2] is used. If you don't want to use this argument parser you can use the "magic" pwb wrapper script [3]. All you have to do is to call you script via this wrapper script:pwb   Now we have two ways using multiple accounts running a script:# Use global -user option like  -user:# create a user-config.py for each account within a sub folder (or elsewhere) and use -dir option like  -dir:By the way you don't need to have a user-config.py file to run Pywikibot[4]. If you have installed Pywikibot s a site-package (pip install pywikibot), user-config.py is deactivated by default but there is a code entry point script pwb.exe which acts as the pwb wrapper described above and with the documentation below.A third way is to pass the user name to the pywikibot.Site() constructor likesite = pywikibot.Site(user=) [5]I hope this helps a bit.Bestxqt[1] https://doc.wikimedia.org/pywikibot/stable/global_options.html[2] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html?highlight=handle_args#pywikibot.handle_args[3] https://doc.wikimedia.org/pywikibot/stable/utilities/scripts_ref.html#module-pwb[4] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.config.html?highlight=pywikibot_no_user_config[5] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.Site Von: Erik Sommer Gesendet: 05.09.2022 16:14An: Betreff: [pywikibot] authenticate as bot and sysop Hi list,I operate currently a bot on the German Wikisource. The bot was granted both groups, admin and bot. It is intended to be used as automated protection bot. I'm having trouble to put the right credentials in my user-config.py.It is currently coded like following pseudo-code:# -*- coding: utf-8 -*-

family = 'wikisource'
mylang = 'de'
usernames['wikisource']['de'] = '**'

authenticate['de.wikisource.org'] = (*.)
the problem with this is that the framework only detect my bot as bot not as sysadmin. Groups taken from the debugging output: ['bot', '*', 'user', 'autoconfirmed']What do I have to add to my config, that the bot also get picket up as sysadmin? I already read (https://www.mediawiki.org/wiki/Manual:Pywikibot/user-config.py) but doesn't make sense for me. It will not change anything if add the botname a second time to the usernames dictionary.Best RegardsErik Sommer
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: authenticate as bot and sysop

2022-09-08 Thread info
<<< text/html; charset=utf-8: Unrecognized >>>
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: authenticate as bot and sysop

2022-09-08 Thread info
Sorry I cannot follow this approach. Can you explain?BestxqtVon: Johnuniq Gesendet: 08.09.2022 09:23An: Pywikibot discussion list Betreff: [pywikibot] Re: authenticate as bot and sysop > how You use different configs in the same script?In my case, I would first run a script to select which user I neededand that script copied the appropriate user-config file. After that, Iwould run a second script that used pywikibot. I have not triedYiFei Zhu's solution.___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.6 release

2022-08-21 Thread info
Hi all,a new stable release Pywikibot 7.6 was deployed. What is new with it?- pcmwiki, guvwikt, bjnwikt and vikidia:oc is supported- itertools.pairwise was backported from Python 3.10- a restartable GeneratorWrapper was added[1]. It is used with Eventstreams, APIGenerator, QueryGenerator, GoogleSearchPageGenerator and PetScanPageGenerator.- the module index documentation was expanded [2]Refer the full changelog for other changes. [3]Be aware that use of Python 3.5 is deprecated and will be dropped soon with Pywikobot 8. [4]Bestxqt[1] https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.tools.html#tools.collections.GeneratorWrapper[2] https://doc.wikimedia.org/pywikibot/stable/py-modindex.html[3] https://doc.wikimedia.org/pywikibot/stable/changelog.html[4] https://phabricator.wikimedia.org/T301908(needs some additional time for postmerge) 
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.5 release

2022-07-22 Thread info
Hi all,a new stable release Pywikibot 7.5 was deployed. What is new with it?- blkwiki is supported- a new time module was added [1]- Fully ISO8601 and POSIX format support with Timestamp [2]- wbparsevalue API support was added [3]- harvest_template script was improved and supports time values [4] and reciprocal claims [5]- the misbehaviour of Python 3.9+ when interrupt the asyncronous put queue was fixed [6]Refer the changelog for other changes. [7]Be aware that use of Python 3.5 is deprecated and will be dropped with Pywikobot 8. [8]Bestxqt[1] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#module-pywikibot.time[2] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.Timestamp[3] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._datasite.DataSite.parsevalue[4] https://phabricator.wikimedia.org/T66503[5] https://phabricator.wikimedia.org/T173238[6] https://phabricator.wikimedia.org/T311076[7] https://doc.wikimedia.org/pywikibot/stable/changelog.html[8] https://phabricator.wikimedia.org/T301908
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.4 release

2022-06-27 Thread info
Hi all,a new stable release Pywikibot 7.4 was deployed yesterday. What is new with it?- the pypi package also supports built (wheel) distribution [1]- api write actions was updated- a memento module was added to fix the memento_client package [2]- Flow board topic continuation of iterating reverse was fixed [3]- login.py and preload_sites are utility scripts now [4]Refer the changelog for other changes. [5]Be aware that use of Python 3.5 is deprecated and will be dropped with Pywikobot 8. [6]There is a misbehaviour found with  Python 3.9 and newer: If you interrupt a script with KeyboardInterrupt (Strg-C), all pages which are in the asyncroneous put queue are lost. The fix [7] comes with Pywikibot 7.5.Bestxqt[1] PEP 427 – The Wheel Binary Package Format 1.0 | peps.python.org[2] https://phabricator.wikimedia.org/T185561[3] https://phabricator.wikimedia.org/T138323[4] https://doc.wikimedia.org/pywikibot/stable/utilities/scripts_ref.html#module-pywikibot.scripts[5] https://doc.wikimedia.org/pywikibot/stable/changelog.html[6] https://phabricator.wikimedia.org/T301908[7] https://gerrit.wikimedia.org/r/c/pywikibot/core/+/807423
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.3 release

2022-05-21 Thread info
Hi all,a new stable release Pywikibot 7.3 has been deployed yesterday. What is new with it?- kcg-wiki is supported- pagegenerators.GeneratorFactory provides an is_preloading attribute if pages are preloades. Refer [1] how to use it.- counter statistics are printed for all counters (T307834) [2]- Prioritize -namespaces options in pagegenerators.handle_args (T222519) [3]. It is recommended to use pg.handle_args instead of pg.handle_arg. Probably the latter will be dropped.- A tiny cache wrapper was added to hold results of parameterless methods and properties [4]- Short creation of a site like pywikibot('commons') or pywikibot('meta') [5]- pywikibot.exception() prints the traceback by default (T306762) [6]Bestxqt[1] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.pagegenerators.GeneratorFactory.is_preloading[2] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.bot.BaseBot.counter[3] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.pagegenerators.GeneratorFactory.handle_args[4] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.tools.html#pywikibot.tools.cached[5] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.Site[6] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot.exception
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Getting the tag of edits shown by user.contributions()

2022-05-21 Thread info

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/_generators.html#GeneratorsMixin.usercontribs

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#collections.Counter

Best
xqt

> Am 22.05.2022 um 02:48 schrieb i.hate.spam.mail.h...@gmail.com:
> Hi,
> 
> I have this piece of code that counts edits:
> 
> from pywikibot import Site, User
> 
> user = User(Site("en"), input('Enter user name: '))
> counts = {}
> for page, oldid, ts, comment in user.contributions(9):
>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])
> 
> My question is how to see the tags in edits. It seems that .contributions() 
> does not return the tags.
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Adding text in predefined locations

2022-05-04 Thread info

extract_sections may be helpful here:

https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html?highlight=extract_sections#pywikibot.textlib.extract_sections

Best
xqt

Von meinem iPhone gesendet

> Am 05.05.2022 um 00:40 schrieb John :
> 
> 
> I know there was code for that in the old 1.0 release. Let me dig it up
> 
>> On Wed, May 4, 2022 at 6:23 PM Strainu  wrote:
>> 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
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.2 release

2022-04-27 Thread info
Hi all,a new stable release Pywikibot 7.2 has been deployed today.What is new with this release?Improvements:- The logging system was rewritten. All parameters except of the first are keyword only parameter now, the usage of positional arguments is deprecated. pywikibot.info() is an alias for pywikibot.output to be compliant with the Python logging system. To write a newline you may use pywikibot.into() (or pywikibot.output()) without any msg parameter; the msg parameter can also be omitted with pywikibot.stdout(). The layer parameter is now optinal for pywikibot.debug. It also works with other logging functions. Refer [1] for additional informations.- A new and easier color format was implemented; Instead of 'This is a\03{green}colored{default} text' you can write 'This is a <>colored<> text'.This makes colors in format string much easier like 'This is a <<{color}>>{color} colored<> text'.format(color='green') which produces 'This is a green colored text' where 'geen colored' is printed in green. The tools.formatter.color_format() functions is deprecated now.-  Lexeme support for Lexicographical data was implemented.- use BaseBot attributes use_redirect and use_disambigs to filter processing of redirects or disambigs Refer [2] for further informationOther changes:All archived scripts were removed; create a Phabricator task to restore some Deprecations:- pagegenerators.XMLDumpOldPageGenerator has been deprecated. Use XMLDumpPageGenerator wit content=True insteadBugfixes:- Several bugfixes and other improvements were made with this release too. Refer the changelog [3] for the complete list of changes.Announcements/RfC:- Toolforge is going to have Python 3.7 and 3.9 available in May. I propose to drop Python 3.5 support after that with Pywikibot 8 because there are a lot of disadvantages and problems with this release. Refer [4] for this task- a general theme is that the ApiResult arrays have a lot of metadata especially for Wikibase items. MediaWiki API has introduced a formatversion 2 which simplifies the data exchange a lot. Therefore MediaWiki support for 1.23 - 1.26 has to be dropped (with Pywikibot 8) [5]Bestxqt[1] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html?highlight=logging#module-pywikibot.logging[2] https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html?highlight=use_disambigs#pywikibot.bot.BaseBot.use_disambigs[3] https://doc.wikimedia.org/pywikibot/stable/changelog.html[4] https://phabricator.wikimedia.org/T301908[5] https://phabricator.wikimedia.org/T306637
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] New Pywikibot 7.1 release

2022-03-26 Thread info
Hi all,a new stable release Pywikibot 7.1 has been deployed. What is new with this release?Improvements:- guwwiki and shnwikivoyage are supported- FilePage has a new property file_is_used to determine whether a file is used on a the given site- TextExtracts extension is supported. It can be used with Page.extract() or Site.extract method- Page.get_parsed_page is a public method now- Site.simple_request is a public method now- deletetalk parameteris enabled for the delete API (page.delete() and Site.delete)- contextlib.redirect_stdout() and contextlib.redirect_stderr() now works with terminal interface- -cosmetic_changes (-cc) option allows to assign the value directly instead of toggle it, e.g. -cc:on- tools.strtobool() was implemented due to :pep:`632` and is used by the implementation aboveBugfixes:- nested templates are taken in to account with MultiTemplateMatchBuilder, used by template.py and cosmetic changes- The "in" operator always return whether the siteinfo contains the key even it is not cachedDeprecations:- get_redirect parameter of Page.getOldVersion() has been deprecated; it was never functional- win32_unicode is used with with Python 3.5 only and will be removend in Pywikibot 8Bestxqt
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: API error modification-failed Error

2022-03-07 Thread info

Hi Ugo,

this is an API warning and not a Pywikibot issue. Seems the 
wikibase-validator-bad-prefix info message is not localised via translatewiki. 
I propose to file a bug at Phabricator.

xqt



> Am 06.03.2022 um 22:49 schrieb Ugo Chima :
> 
> 
> Hello everyone,
> Please I get this error while running scripts 
> WARNING: API error modification-failed: ⧼wikibase-validator-bad-prefix⧽
> 
> Please what is the cause of this? and what is the possible fix for it?
> 
> Thank you in anticipation.
> 
> Chima
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: NotImplementedError: page_from_repository method

2022-02-27 Thread info
You can’t run that script on a Wikibase, you have to run it on a client.

Von meinem iPhone gesendet

> Am 27.02.2022 um 21:34 schrieb Ugo Chima :
> 
> 
> Thanks once again,
> But what method should I use then, because I know that this happens on 
> wikidata so I believe it can happen external as well.
> 
> How do I do it sir?
> 
>> On Sun, Feb 27, 2022, 16:12  wrote:
>> Hi Chima, 
>> 
>> your local Wiki seem to be a Wikibase and as the exception suggest the 
>> method is not defined for this site type.
>> 
>> Best
>> xqt 
>> 
 Am 26.02.2022 um 17:13 schrieb Ugo Chima :
 
>>> 
>>> Hi Xqt
>>> 
 On Thu, Feb 24, 2022, 08:02 Ugo Chima  wrote:
 Hello Xqt,
 Thank you for replying,
 Yes, site:lang isn't valid, I am actually not running it from 
 wikidata:wikidata, it's on another wiki, and I'm running it locally from 
 my PC.
 
 Thanks 
 
 Chima.
 
> On Thu, Feb 24, 2022, 05:06  wrote:
> Hi Chima,
> 
> site:lang is not a valid site. I would expect wikidata:wikidata in the 
> exception message. What is your command line and on which site are you 
> running the script? 
> 
> Best
> xqt
> 
>>> Am 24.02.2022 um 02:35 schrieb Ugo Chima :
>>> 
>> 
>> Good morning everyone
>> Please anyone have any Idea why I receive this error 
>> "NotImplementedError: page_from_repository method is not implemented for 
>> Wikibase site:lang"  when running the newitem.py script?
>> 
>> Chima.
>> 
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: NotImplementedError: page_from_repository method

2022-02-27 Thread info
Hi Chima, 

your local Wiki seem to be a Wikibase and as the exception suggest the method 
is not defined for this site type.

Best
xqt 

> Am 26.02.2022 um 17:13 schrieb Ugo Chima :
> 
> 
> Hi Xqt
> 
>> On Thu, Feb 24, 2022, 08:02 Ugo Chima  wrote:
>> Hello Xqt,
>> Thank you for replying,
>> Yes, site:lang isn't valid, I am actually not running it from 
>> wikidata:wikidata, it's on another wiki, and I'm running it locally from my 
>> PC.
>> 
>> Thanks 
>> 
>> Chima.
>> 
>>> On Thu, Feb 24, 2022, 05:06  wrote:
>>> Hi Chima,
>>> 
>>> site:lang is not a valid site. I would expect wikidata:wikidata in the 
>>> exception message. What is your command line and on which site are you 
>>> running the script? 
>>> 
>>> Best
>>> xqt
>>> 
> Am 24.02.2022 um 02:35 schrieb Ugo Chima :
> 
 
 Good morning everyone
 Please anyone have any Idea why I receive this error "NotImplementedError: 
 page_from_repository method is not implemented for Wikibase site:lang"  
 when running the newitem.py script?
 
 Chima.
 
 ___
 pywikibot mailing list -- pywikibot@lists.wikimedia.org
 To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: New Pywikibot 7 stable release

2022-02-24 Thread info

Seems this mail hasn’t passed.

xqt

> Am 19.02.2022 um 18:48 
> 
>  
>  
> Hi Maarten,
> 
> I've restored all removed pagegenerators functions.
> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html#pywikibot.pagegenerators.AllpagesPageGenerator
> Other functions may follow possibly in such a way I examined already.
> 
> 
> > I think I'm only using the site object directly in some horrible hacks to 
> > work around the lack of structured data on Commons support in Pywikibot.
> 
> Structured Data was enabled with this patch
> https://gerrit.wikimedia.org/r/c/pywikibot/core/+/627243
> T223820 is still open. Not sure what is remainting to do there. But also 
> "some horrible hacks to work around" would possibly help. Could you point it 
> out?
> 
> > Just like page being the central point of entry from doing things with 
> > pages, I see the pagegenerators as the central point of entry to getting a 
> > set of pages. Site functions shouldn't be used directly. 
> I don't fully agree because a site can also be seen as a central point to 
> work on. For example mwclient package is site oriented and Pywikibot looks 
> more like a network: 
> https://doc.wikimedia.org/pywikibot/master/index.html#framework-modules-overview
>  I think we can be flexible enough to provide different approaches. I am 
> working on a site.Page() constructor method right now which is also able to 
> upcast the correspondig BasePage class in 
> https://gerrit.wikimedia.org/r/c/pywikibot/core/+/763753
> 
> > Downside is that we won't have any documentation for these generators at ...
> Must be defined in the rst file then.
> 
> > Maybe middle ground to have a function that gives all the parameters to the 
> > site function using **kwargs ?
> Obviously this is appropriate, see 
> https://phabricator.wikimedia.org/rPWBCd7719950d651277955ed804ad85fb729fcc5c1f8
>  as a sample.
> 
> > Have we ever tried cross-referencing
> Yes we do that a lot, mostly automatically by type hints. But it can be 
> improved anyway.
> 
> 
> Best
> xqt
> Von: Maarten Dammers 
> Gesendet: 14.02.2022 22:19
> An: 
> Betreff: [pywikibot] Re: New Pywikibot 7 stable release
>  
> Hi Xqt,
> 
> On 13-02-2022 21:53, i...@gno.de wrote:
>> 
>> Hi Maarten,
>>  
>> thank you for you feedback. There is the same "redundancy" in some Page 
>> methods which calls the corresponding site method and I wouldn’t drop one 
>> over the other. Page methods have a higher tier than Site methods which 
>> calls api functions and finally the comms functions.
> Exactly. I think I'm only using the site object directly in some horrible 
> hacks to work around the lack of structured data on Commons support in 
> Pywikibot.
> 
>>  
>> pagegenerators implements generators and filters for command line options 
>> and provides additional page generators which are outside of site methods 
>> like multiple site generators and other stuff.
>>  
>> But I don’t see any advantage using the same functionality from 
>> pagegenerators module over those site methods who are called by that 
>> function. The (now removed) functions had the form
>>  
>>   def this_generator(total=None, site=None)
>>  if not site: site = Pywikibot.Site()
>>  site.this(total=total)
>>  
>> There is a disadvantage in that sense that site must not be determined and 
>> another disadvantage that most site parameters were not provided with the pg 
>> function.
>>  
>> Can you tell me your POV about advantage/disadvantage of those pg function?
> Just like page being the central point of entry from doing things with pages, 
> I see the pagegenerators as the central point of entry to getting a set of 
> pages. Site functions shouldn't be used directly. The pagegenerators should 
> invoke the needed code mostly from site, but maybe from other parts. I 
> recognize the problem of the missing generators and missing parameters.
>> 
>>  
>> There are about 50 generator functions in site.GeneratorMixin but pg had 
>> only a few of them.
>>  
>> I made a proposal in 
>> https://gerrit.wikimedia.org/r/c/pywikibot/core/+/762132 which would 
>> implement all site generators as pagegenerators function. Is this in your 
>> sense? Unfortunately this only works with Python 3.7+ and needs some 
>> additional work for older Pythons.
> Thanks for having a look at this. Interesting idea to create the generators 
> like this. Would fix the example at 
> https://www.mediawiki.org/wiki/Manual:Pywikibot/pagegenerators.py#Calls_from_another_script
>  . Downside is that we won't have any documentation for these generators at 
> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html#module-pywikibot.pagegenerators
>  . Maybe middle ground to have a function that gives all the parameters to 
> the site function using **kwargs ? Bit like we do in page at places like 
> https://doc.wikimedia.org/pywikibot/master/_modules/pywikibot/page.html#BasePage.watch
>  . Does make me wonder how to link that with 
> 

[pywikibot] Re: NotImplementedError: page_from_repository method

2022-02-23 Thread info
Hi Chima,

site:lang is not a valid site. I would expect wikidata:wikidata in the 
exception message. What is your command line and on which site are you running 
the script? 

Best
xqt

> Am 24.02.2022 um 02:35 schrieb Ugo Chima :
> 
> 
> Good morning everyone
> Please anyone have any Idea why I receive this error "NotImplementedError: 
> page_from_repository method is not implemented for Wikibase site:lang"  when 
> running the newitem.py script?
> 
> Chima.
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Bulk uploads to Commons using PWB and data_ingestion script. Is it possible?

2022-02-15 Thread info

there was no trouble with it and now you are prepared for the next failure 

Best
xqt

> Am 15.02.2022 um 10:54 schrieb Ian Watt :
> 
> Hi xqt
> 
> Apologies. This fell off my radar. 
> 
> With Pattypan becoming available again, it meant that the familiar route to 
> uploading images was again available. So, trying to script something to 
> upload 4000+ images in an unfamiliar environment (PWB) was no longer 
> necessary.
> 
> I hope that I didn’t put you to to much trouble!
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: New Pywikibot 7 stable release

2022-02-13 Thread info

Hi Maarten,

thank you for you feedback. There is the same "redundancy" in some Page methods 
which calls the corresponding site method and I wouldn’t drop one over the 
other. Page methods have a higher tier than Site methods which calls api 
functions and finally the comms functions.

pagegenerators implements generators and filters for command line options and 
provides additional page generators which are outside of site methods like 
multiple site generators and other stuff.

But I don’t see any advantage using the same functionality from pagegenerators 
module over those site methods who are called by that function. The (now 
removed) functions had the form

  def this_generator(total=None, site=None)
 if not site: site = Pywikibot.Site()
 site.this(total=total)

There is a disadvantage in that sense that site must not be determined and 
another disadvantage that most site parameters were not provided with the pg 
function.

Can you tell me your POV about advantage/disadvantage of those pg function?

There are about 50 generator functions in site.GeneratorMixin but pg had only a 
few of them.

I made a proposal in https://gerrit.wikimedia.org/r/c/pywikibot/core/+/762132 
which would implement all site generators as pagegenerators function. Is this 
in your sense? Unfortunately this only works with Python 3.7+ and needs some 
additional work for older Pythons.

Best
xqt

> Am 13.02.2022 um 14:40 schrieb Maarten Dammers :
> 
> 
> Hi Xqt,
> 
> I don't agree with the removal of the generators that someone decided to 
> deprecate [1]. We always had the principle that pagegenerators is the point 
> of entry to get pages to work on. The pagegenerators are a (thin) layer of 
> abstraction so that you don't have to directly use function in the site 
> objects. With this removal you're breaking one of the very fundamental 
> functions and principles of our framework. 
> 
> Why did you remove it? Any arguments beside than the incorrect argument that 
> it's redundant? 
> Was the deprecation and removal discussed somewhere? Can't find it on this 
> list.
> 
> Maarten
> 
> [1] 
> https://gerrit.wikimedia.org/r/c/pywikibot/core/+/761395/5/pywikibot/pagegenerators.py
> 
>> On 12-02-2022 13:31, i...@gno.de wrote:
>> 
>> Hi all,
>> 
>> a new stable release Pywikibot 7 will be deployed at the end of this month.
>> There are a lot important points with this release, currently implemented in 
>> master branch:
>> 
>> 
>> Python Plattform:
>> -
>> 
>> Pywkibot support of Python 3.5.0 - 3.5.2 will be dropped. The minimum 
>> plattform
>> required is Python 3.5.3 which is preinstalled at toolforge. On the other 
>> hand
>> Pywikibot also works with new Python 3.11.0a and *new* supports PyPy 3. Most
>> used plattform measured by PyPy download statistic is Python 3.8 (T266984). 
>> For
>> developers I highly propose to use Python 3.10 due to "Better error messages"
>> (https://docs.python.org/3.10/whatsnew/3.10.html#better-error-messages).
>> 
>> 
>> Framework Scripts:
>> --
>> 
>> The both scripts generate_family_file and generate_user_files were moved 
>> from 
>> framework root directory to pywikibot/scripts folder. The two scripts shell 
>> and
>> version were moved from scripts folder to pywikibot/scripts. This arrangement
>> was necessary to implement a code entry point for Pywikibot site-package. 
>> Possibly you have to change the path environment setting to use these 
>> scripts.
>> But all of them are still available through the pwb.py wrapper script.
>> 
>> 
>> Linux:
>> --
>> 
>> Scripts hash bang was changed from python to python3. This enables to invoke
>> scripts without preleading interpreter.
>> 
>> 
>> PAWS:
>> -
>> 
>> Pywikibot 7 is a stable release and becomes the Pywikibot framework base on
>> PAWS.
>> 
>> 
>> Toolforge:
>> --
>> 
>> After deployment of Pywikibot 7 this stable release will be available under
>> /shared/pywikibot/stable and the current master can be accessed under
>> /shared/pywikibot/core. The pwb.py wrapper script can be used at Tooforge
>> and the similar script search is functional.
>> https://doc.wikimedia.org/pywikibot/master/utilities/index.html#module-pwb
>> 
>> 
>> MediaWiki:
>> --
>> 
>> No changes was made for supporting MediaWiki releases. Pywikibot 7 supports
>> MediaWiki 1.23-1.37. For current MediaWiki release 1.37 the minimum Pywikibot
>> version must be 6.6.1. MW 1.19 requires PWB 5 and MW 1.14 requires PWB 4.
>> (https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility)
>> 
>> 
>> Pywikibot site-package (PyPi):
>> --
>> 
>> Installing Pywikibot as a site package (pip install pywikibot==7.0) comes 
>> with
>> many innovations. pywikibot i18n messages bundle is available. Framework 
>> scripts listed above can be used with Pywikibot 7.The pwb wrapper script is 
>> the
>> code entry point to invoke these scripts:
>> pwb [global options]  [script options|global options]
>> 

[Pywikipedia-announce] [pywikibot] New Pywikibot 7 stable release

2022-02-12 Thread info
Hi all,a new stable release Pywikibot 7 will be deployed at the end of this month.There are a lot important points with this release, currently implemented in master branch:Python Plattform:-Pywkibot support of Python 3.5.0 - 3.5.2 will be dropped. The minimum plattformrequired is Python 3.5.3 which is preinstalled at toolforge. On the other handPywikibot also works with new Python 3.11.0a and *new* supports PyPy 3. Mostused plattform measured by PyPy download statistic is Python 3.8 (T266984). Fordevelopers I highly propose to use Python 3.10 due to "Better error messages"(https://docs.python.org/3.10/whatsnew/3.10.html#better-error-messages).Framework Scripts:--The both scripts generate_family_file and generate_user_files were moved from framework root directory to pywikibot/scripts folder. The two scripts shell andversion were moved from scripts folder to pywikibot/scripts. This arrangementwas necessary to implement a code entry point for Pywikibot site-package. Possibly you have to change the path environment setting to use these scripts.But all of them are still available through the pwb.py wrapper script.Linux:--Scripts hash bang was changed from python to python3. This enables to invokescripts without preleading interpreter.PAWS:-Pywikibot 7 is a stable release and becomes the Pywikibot framework base onPAWS.Toolforge:--After deployment of Pywikibot 7 this stable release will be available under/shared/pywikibot/stable and the current master can be accessed under/shared/pywikibot/core. The pwb.py wrapper script can be used at Tooforgeand the similar script search is functional.https://doc.wikimedia.org/pywikibot/master/utilities/index.html#module-pwbMediaWiki:--No changes was made for supporting MediaWiki releases. Pywikibot 7 supportsMediaWiki 1.23-1.37. For current MediaWiki release 1.37 the minimum Pywikibotversion must be 6.6.1. MW 1.19 requires PWB 5 and MW 1.14 requires PWB 4.(https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility)Pywikibot site-package (PyPi):--Installing Pywikibot as a site package (pip install pywikibot==7.0) comes withmany innovations. pywikibot i18n messages bundle is available. Framework scripts listed above can be used with Pywikibot 7.The pwb wrapper script is thecode entry point to invoke these scripts:pwb [global options]  [script options|global options]Pywikibot Tests:Pywikibot CI tests were moved from Travis to GitHub action. There are twoactions implemented. The first runs up tp 20 workers in parallel and does themost tests whereas the second only runs login/logout tests but there are noparallel task which would lead to failures due to not logged-in test account.Module Changes:---Support for API:Redirects was added in site and page module. User.is_locked()and APISite.is_locked() were added to determine whether a given user or user idis locked globally. The cached output functionality from compat release wasre-implemented.families:Allow family files reside in `families` folder in base_dir by default. This is important if Pywikibot is used as a site-package. generate_family_file usesthis new place to save the family file. Wikihow family file was added.i18n module:bundles() yields message bundle names or Path objects; known_languages() givesall languages we have localizations for.page module:isStaticRedirect() also considers transcluded __STATICREDIRECT__.put() and change_category() now has a show_diff parameter. User.is_blocked()can also detect range blocks.proofreadpage:Wikimedia OCR engine is supported.site module:APISite.get_globaluserinfo() method was added to retrieve globaluserinfo.New "maxlimit" property was added to determine the limits for API loads.textlib module:textlib comes with to_latin_digits() function as counterpart ofto_local_digits() and case_escape() which gives an escaped regex patterndepending on 'first-letter' case.tools module:intersect_generators was rewritten which makes it running up to 10’000 times faster.Scripts Changes:Scripts descriptions can be viewed athttps://doc.wikimedia.org/pywikibot/master/scripts/index.htmlConfigParserBot is provided for several scripts. Any option can be set withinscripts.ini file.https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html#pywikibot.bot.ConfigParserBotadd_text scripts provided -create and -createonly options. A CleanBot was addedin category script which can be invoked by clean action option. It removesredundant grandchildren categories. The fixing_redirect script uses concurrent.futures to retrieve redirect targets; this decreases processing timeby 90% if solving moved pages is enabled.Deprecations:-Most of the deprecated code parts were removed to start with a new proper andmaintainable code without budensome overhead. The deprecations must be solvedif you have your own code based on Pywikibot before you upgrade to the newrelease. Refer 

[pywikibot] New Pywikibot 7 stable release

2022-02-12 Thread info
Hi all,a new stable release Pywikibot 7 will be deployed at the end of this month.There are a lot important points with this release, currently implemented in master branch:Python Plattform:-Pywkibot support of Python 3.5.0 - 3.5.2 will be dropped. The minimum plattformrequired is Python 3.5.3 which is preinstalled at toolforge. On the other handPywikibot also works with new Python 3.11.0a and *new* supports PyPy 3. Mostused plattform measured by PyPy download statistic is Python 3.8 (T266984). Fordevelopers I highly propose to use Python 3.10 due to "Better error messages"(https://docs.python.org/3.10/whatsnew/3.10.html#better-error-messages).Framework Scripts:--The both scripts generate_family_file and generate_user_files were moved from framework root directory to pywikibot/scripts folder. The two scripts shell andversion were moved from scripts folder to pywikibot/scripts. This arrangementwas necessary to implement a code entry point for Pywikibot site-package. Possibly you have to change the path environment setting to use these scripts.But all of them are still available through the pwb.py wrapper script.Linux:--Scripts hash bang was changed from python to python3. This enables to invokescripts without preleading interpreter.PAWS:-Pywikibot 7 is a stable release and becomes the Pywikibot framework base onPAWS.Toolforge:--After deployment of Pywikibot 7 this stable release will be available under/shared/pywikibot/stable and the current master can be accessed under/shared/pywikibot/core. The pwb.py wrapper script can be used at Tooforgeand the similar script search is functional.https://doc.wikimedia.org/pywikibot/master/utilities/index.html#module-pwbMediaWiki:--No changes was made for supporting MediaWiki releases. Pywikibot 7 supportsMediaWiki 1.23-1.37. For current MediaWiki release 1.37 the minimum Pywikibotversion must be 6.6.1. MW 1.19 requires PWB 5 and MW 1.14 requires PWB 4.(https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility)Pywikibot site-package (PyPi):--Installing Pywikibot as a site package (pip install pywikibot==7.0) comes withmany innovations. pywikibot i18n messages bundle is available. Framework scripts listed above can be used with Pywikibot 7.The pwb wrapper script is thecode entry point to invoke these scripts:pwb [global options]  [script options|global options]Pywikibot Tests:Pywikibot CI tests were moved from Travis to GitHub action. There are twoactions implemented. The first runs up tp 20 workers in parallel and does themost tests whereas the second only runs login/logout tests but there are noparallel task which would lead to failures due to not logged-in test account.Module Changes:---Support for API:Redirects was added in site and page module. User.is_locked()and APISite.is_locked() were added to determine whether a given user or user idis locked globally. The cached output functionality from compat release wasre-implemented.families:Allow family files reside in `families` folder in base_dir by default. This is important if Pywikibot is used as a site-package. generate_family_file usesthis new place to save the family file. Wikihow family file was added.i18n module:bundles() yields message bundle names or Path objects; known_languages() givesall languages we have localizations for.page module:isStaticRedirect() also considers transcluded __STATICREDIRECT__.put() and change_category() now has a show_diff parameter. User.is_blocked()can also detect range blocks.proofreadpage:Wikimedia OCR engine is supported.site module:APISite.get_globaluserinfo() method was added to retrieve globaluserinfo.New "maxlimit" property was added to determine the limits for API loads.textlib module:textlib comes with to_latin_digits() function as counterpart ofto_local_digits() and case_escape() which gives an escaped regex patterndepending on 'first-letter' case.tools module:intersect_generators was rewritten which makes it running up to 10’000 times faster.Scripts Changes:Scripts descriptions can be viewed athttps://doc.wikimedia.org/pywikibot/master/scripts/index.htmlConfigParserBot is provided for several scripts. Any option can be set withinscripts.ini file.https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.html#pywikibot.bot.ConfigParserBotadd_text scripts provided -create and -createonly options. A CleanBot was addedin category script which can be invoked by clean action option. It removesredundant grandchildren categories. The fixing_redirect script uses concurrent.futures to retrieve redirect targets; this decreases processing timeby 90% if solving moved pages is enabled.Deprecations:-Most of the deprecated code parts were removed to start with a new proper andmaintainable code without budensome overhead. The deprecations must be solvedif you have your own code based on Pywikibot before you upgrade to the newrelease. Refer 

[pywikibot] Re: pywikibot vs mwclient?

2022-02-06 Thread info
Pywikibot was developed since 2003; a rewrite was made 2013. It comes with a 
bulk of ready to use scripts, high level bot templates for very fast 
development of own bot scripts.

Pywikibot has global command line options for settings, which can be used for 
all script through the pwb wrapper script, command line options for page 
generators and filters which is implemented for most scripts shipped with it 
and can be used for own scripts. Most scripts can be configured via config file 
instead of command options (config web pages is under construction) 

Don’t care a lot about API request, retries of connections, error handling, 
throttling of put requests and let the framework do the job. MediaWiki pages 
can be written asynchronous to fasten up scripts by default. Eventstreams 
(sseclient), sql and sparql queries are implemented. This enables scripts to 
interact immediately if required.

Pywikibot 7 as a site-package comes with a code entry point, i18n, utility 
scripts and own family files folder.

Pywikibot supports MW 1.23-1.37 and Python 3.5.3-3.11 and PyPy.

See also:

https://www.mediawiki.org/wiki/Manual:Creating_a_bot#Python

https://doc.wikimedia.org/pywikibot/master/index.html

https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility

Best
xqt

> Am 06.02.2022 um 18:00 schrieb Amir Sarabadani :
> 
> 
> I was around when there were some discussions (and meetings) to make these 
> libraries converge (in 2015).
> 
> mediawiki utilities (https://github.com/mediawiki-utilities) are a set of 
> components each separate in its own repo and follow better software 
> engineering principles such as decoupling to make them easier to maintain. 
> And given that they are smaller with smaller functionalities, meaning more 
> secure for production environments (e.g. you just need a tiny code for 
> production, you'd use that instead). But that also means it's not very much 
> suitable for a general bot operator. The plan was basically to make pywikibot 
> replace its internal codes with mw util libraries and basically provide a 
> bundle (plus the scripts).
> 
> For lots of reasons, this didn't happen and now we are left with two 
> competing frameworks (obligatory link https://xkcd.com/927/)
> 
> HTH
> 
>> On Sun, Feb 6, 2022 at 3:48 PM Huji Lee  wrote:
>> For one thing, pywikibot also comes with a collection of applications (such 
>> as replace.py for quickly replacing text across pages, etc.) as well as 
>> helpers (e.g. a series of pagegenerators that make it easy for you to get a 
>> list of pages to work on).
>> 
>> For another, myclient is not as actively maintained and developed as 
>> pywikibot (which itself is maintained by only a very small group of really 
>> interested people). mwclient was last updated in Sep 2021 I think, whereas 
>> pywikibot has updates as of this month.
>> 
>> Simply put: mwclient is just a Python SDK wrapped around MW API, but 
>> pywikibot is an actual framework.
>> 
>>> On Sun, Feb 6, 2022 at 9:38 AM Roy Smith  wrote:
>>> I've been using mwclient for eons.  I'm wondering if it's worth my 
>>> switching to pywikibot.  What's different/better about pywikibot that would 
>>> justify the switch?  Is pywikibot a fork of mwclient or a clean start?
>>> 
>>> I found some comparisons on 
>>> https://www.mediawiki.org/wiki/API:Client_code#Python, but most of that 
>>> hasn't been updated in years.
>>> 
>>> 
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> 
> 
> -- 
> Amir (he/him)
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Bulk uploads to Commons using PWB and data_ingestion script. Is it possible?

2022-01-29 Thread info
Hi Ian,

a real test would be fine and enough for me. There are automatic tests for the 
code. You can copy the script from here [1]. To prevent real changes you may 
use the -simulate option when calling the script.

Best 
xqt

[1] 
https://gerrit.wikimedia.org/r/plugins/gitiles/pywikibot/core/+/8b024efbe6d29a2f2c34a0771e572e1539e06859/scripts/data_ingestion.py


> Am 29.01.2022 um 18:00 schrieb Ian Watt :
> 
> Hi xqt
> 
> Thanks for doing that. 
> 
> Do you mean review it from a code-review standpoint? Perhaps I over-stated my 
> Python competence!? 
> 
> Of do you mean try to test the script from a real-world attempt to upload 
> files with it? I guess I’d need to download the file as it is amended (some 
> sort of git pull? ) and set it in my version of PWB on my computer?
> 
> Sorry if this sounds ignorant! 
> 
> Ian
> 
> 
> Ian Watt
> ianw...@gmail.com
> 
> 
> 
>> On 28 Jan 2022, at 13:38, i...@gno.de wrote:
>> 
>> Hi Ian,
>> 
>> I’ve recovered this script. Are you able to review it? [1]
>> There is a known issue due to a wrong migration from compat to core but the 
>> script should work anyway.
>> 
>> Best
>> xqt
>> 
>> 
>> [1] https://gerrit.wikimedia.org/r/c/pywikibot/core/+/757889
>> 
 Am 28.01.2022 um 11:15 schrieb Ian Watt :
 
>>> Thank you, xqt
>>> 
>>> That’s really helpful. 
>>> 
>>> Ian
>>> 
>>> 
>>> Ian Watt
>>> ianw...@gmail.com
>>> 
>>> 
>>> 
 On 28 Jan 2022, at 06:13, i...@gno.de wrote:
 
 Hi Ian,
 
 data_ingestion.py is still available but is not tested. There might be 
 some breaking changes since 5.6 and 7.0 which can cause the script failing.
 
 Either you have to pretend the archive folder when calling the script or 
 add the path to user_script_paths in your user-config.py [1].
 
 You cannot go back to an older Pywikibot version (pre 6.0) because 
 Pywikibot 6.6.1 is required for the current MW release used at commons. [2]
 
 Possibly I find some time to recover the script shortly.
 
 Best
 xqt
 
 
 [1] 
 https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.config.html?highlight=config#external-script-path-settings
 
 [2] https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility
 
 
 
>> Am 27.01.2022 um 17:07 schrieb Ian Watt :
>> 
> Hi,
> 
> I’m assisting our local Museums and Galleries on a project to open up 
> around 4,000 images as CC-0) via Commons. We picked a bad time to do it 
> (Pattypan being borked).
> 
> I’m a PyWikiBot noob - although I have some long-term familiarity with 
> Python. I’m trying to work out if using PWB might be a route to get these 
> images onto Commons. 
> 
> I have both downloaded image files and URLs which I can point a script at 
> - as well as good metadata for them. 
> 
> I’ve been looking at pre-canned PWB scripts and see that data_ingestion 
> *might* do the trick. 
> 
> I see that it is in /scripts/archive/
> 
> Is this still a viable script - or is it deprecated in some way? 
> 
> Does anyone have a guide for using it beyond the comments at the top of 
> the script? 
> 
> I had a look at /tests/data/csv_ingestion.csv and it looks kind of bare - 
> as I’d expect more fields etc.  I’d rather construct something more like 
> the metadata fields that I’d use with Patypan if using that - rather than 
> be faced with 4,000 files uploaded and have to add metadata to them in a 
> separate process or *shudder* manually. 
> 
> Any suggestions (including ‘don’t do this’) with explanations would be 
> welcome please. 
> 
> Many thanks
> 
> Ian
> 
> Ian Watt
> ianw...@gmail.com
> 
> 
> watty62 
> 
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
 ___
 pywikibot mailing list -- pywikibot@lists.wikimedia.org
 To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>> 
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Bulk uploads to Commons using PWB and data_ingestion script. Is it possible?

2022-01-28 Thread info
Hi Ian,

I’ve recovered this script. Are you able to review it? [1]
There is a known issue due to a wrong migration from compat to core but the 
script should work anyway.

Best
xqt


[1] https://gerrit.wikimedia.org/r/c/pywikibot/core/+/757889

> Am 28.01.2022 um 11:15 schrieb Ian Watt :
> 
> Thank you, xqt
> 
> That’s really helpful. 
> 
> Ian
> 
> 
> Ian Watt
> ianw...@gmail.com
> 
> 
> 
>> On 28 Jan 2022, at 06:13, i...@gno.de wrote:
>> 
>> Hi Ian,
>> 
>> data_ingestion.py is still available but is not tested. There might be some 
>> breaking changes since 5.6 and 7.0 which can cause the script failing.
>> 
>> Either you have to pretend the archive folder when calling the script or add 
>> the path to user_script_paths in your user-config.py [1].
>> 
>> You cannot go back to an older Pywikibot version (pre 6.0) because Pywikibot 
>> 6.6.1 is required for the current MW release used at commons. [2]
>> 
>> Possibly I find some time to recover the script shortly.
>> 
>> Best
>> xqt
>> 
>> 
>> [1] 
>> https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.config.html?highlight=config#external-script-path-settings
>> 
>> [2] https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility
>> 
>> 
>> 
 Am 27.01.2022 um 17:07 schrieb Ian Watt :
 
>>> Hi,
>>> 
>>> I’m assisting our local Museums and Galleries on a project to open up 
>>> around 4,000 images as CC-0) via Commons. We picked a bad time to do it 
>>> (Pattypan being borked).
>>> 
>>> I’m a PyWikiBot noob - although I have some long-term familiarity with 
>>> Python. I’m trying to work out if using PWB might be a route to get these 
>>> images onto Commons. 
>>> 
>>> I have both downloaded image files and URLs which I can point a script at - 
>>> as well as good metadata for them. 
>>> 
>>> I’ve been looking at pre-canned PWB scripts and see that data_ingestion 
>>> *might* do the trick. 
>>> 
>>> I see that it is in /scripts/archive/
>>> 
>>> Is this still a viable script - or is it deprecated in some way? 
>>> 
>>> Does anyone have a guide for using it beyond the comments at the top of the 
>>> script? 
>>> 
>>> I had a look at /tests/data/csv_ingestion.csv and it looks kind of bare - 
>>> as I’d expect more fields etc.  I’d rather construct something more like 
>>> the metadata fields that I’d use with Patypan if using that - rather than 
>>> be faced with 4,000 files uploaded and have to add metadata to them in a 
>>> separate process or *shudder* manually. 
>>> 
>>> Any suggestions (including ‘don’t do this’) with explanations would be 
>>> welcome please. 
>>> 
>>> Many thanks
>>> 
>>> Ian
>>> 
>>> Ian Watt
>>> ianw...@gmail.com
>>> 
>>> 
>>> watty62 
>>> 
>>> 
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Bulk uploads to Commons using PWB and data_ingestion script. Is it possible?

2022-01-27 Thread info
Hi Ian,

data_ingestion.py is still available but is not tested. There might be some 
breaking changes since 5.6 and 7.0 which can cause the script failing.

Either you have to pretend the archive folder when calling the script or add 
the path to user_script_paths in your user-config.py [1].

You cannot go back to an older Pywikibot version (pre 6.0) because Pywikibot 
6.6.1 is required for the current MW release used at commons. [2]

Possibly I find some time to recover the script shortly.

Best
xqt


[1] 
https://doc.wikimedia.org/pywikibot/master/api_ref/pywikibot.config.html?highlight=config#external-script-path-settings

[2] https://www.mediawiki.org/wiki/Manual:Pywikibot/Compatibility



> Am 27.01.2022 um 17:07 schrieb Ian Watt :
> 
> Hi,
> 
> I’m assisting our local Museums and Galleries on a project to open up around 
> 4,000 images as CC-0) via Commons. We picked a bad time to do it (Pattypan 
> being borked).
> 
> I’m a PyWikiBot noob - although I have some long-term familiarity with 
> Python. I’m trying to work out if using PWB might be a route to get these 
> images onto Commons. 
> 
> I have both downloaded image files and URLs which I can point a script at - 
> as well as good metadata for them. 
> 
> I’ve been looking at pre-canned PWB scripts and see that data_ingestion 
> *might* do the trick. 
> 
> I see that it is in /scripts/archive/
> 
> Is this still a viable script - or is it deprecated in some way? 
> 
> Does anyone have a guide for using it beyond the comments at the top of the 
> script? 
> 
> I had a look at /tests/data/csv_ingestion.csv and it looks kind of bare - as 
> I’d expect more fields etc.  I’d rather construct something more like the 
> metadata fields that I’d use with Patypan if using that - rather than be 
> faced with 4,000 files uploaded and have to add metadata to them in a 
> separate process or *shudder* manually. 
> 
> Any suggestions (including ‘don’t do this’) with explanations would be 
> welcome please. 
> 
> Many thanks
> 
> Ian
> 
> Ian Watt
> ianw...@gmail.com
> 
> 
> watty62 
> 
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Deprecation policy?

2021-12-20 Thread info
Hi folks,regarding to your contributions and comments here some thoughts:Currently Python 3.5.0+ is supported with stable version. With Pywikibot 7.0 Python version 3.5.0 - 3.5.2 are no longer supported due insufficient import support and other problems which could not be solved easily. [1] On the other hand pywikibot 7.0 comes wit PyPy support and Python 3.11. I've migrated most tests from TRAVIS to github actions and added tests for thoses versions and btw for MacOS too.Both Python 3.5 and 3.6 have exceeded their end of life [2] and it would be appropriate to change to 3.6+ support only because this release comes with important release highlights (f-string literals, variable annotations, asyncronous generators and comprehensions, order-preserving dicts and keyword arguments, simpler customization of class creation, path-like objects, default utf-8 support with Windows. Unfortunately Toolforge does not support it.I am mainly fine with Strainu's recommendation about dropping Python version support which was:- two years after official support has ended- one year after Toolforge moved to a newer Python version- the percentage of users of a version goes under 5%But I think this policy should also take into account that some outdated Python version may hinder further development and forcing a higher bugfix release is necessary in some cases. [1] For example Python 3.5 support ended in September 2020 but is is not appropriate to wait until September 2022 to desupport all releases. Python 3.5.2 was released in June 2016 and I think its support can be safely be dropped 5 years later if it is not used on Toolforge and their usage is below 1%.I postponed the deployment of Pywikibot 7.0 several times. Anyway it comes with several improvements [3]. An important change is support generate_user_files and generate_family_file helper scripts with site-package [4] as well as shell and version scripts. This is a first step to support external scripts with the pwb wrapper script which is now a site package code entry point. Refer the doc for other more or less important changes.On the other hand a lot of code cleanups were made in 7.0. Yes I think a lot of code cleanups were to fast in past which sometimes gave only 3 months of deprecation warnings. This should be changed with semantic versioning and old code should be kept for a longer time. But having a long deprecation period is not always feasible. For example removing the threadedhttp module and returning a Resonse object with http.requests() in Pywikibot 6.0 or bot option handling change in Pywikibot 5.0 came with new designs and I don't see a feasible way to support several implementations in parallel for years; this would be too time consuming for developing and debugging, too error-prone having such mixed code, difficult and expensive for testing, especially when there are only a few developers.I don't think that the deprecation period is really important but I learned it might be important not to have code changes every month; this is the main reason to change to semantic versioning after Pywikibot 6.4. For example deprecations introduced with 7.0 will not be removed earlier than with Pywikibot 9.0 which probably comes in 2023.Some other ideas and proposals: There is a maintenance script "update_script" originally implemented to support compat to core changes. This could be expanded to support version code changes too; helping hands are welcome. We have a stable branche preferable for production systems but testing the master branch with real data and applications is very welcome. Finally update the framework if appropriate or necessary but always refer the documentation about possible breaking changes and run your script before an update and pay attention about deprecation warnings which are always FutureWarnings and aren't suppressed by default anymore. You may use the -simulate option for those tests. If your script does not use handle_args command line parser, the -simulate option can always be used through the pwb wrapper: python pwb.py -simulate  .That's for now. Thank you for your kind attention. And sorry for some trouble described lately.Bestxqt[1] https://phabricator.wikimedia.org/T286867[2] https://endoflife.date/python[3] https://doc.wikimedia.org/pywikibot/master/changelog.html#improvements-and-bugfixes[4] https://phabricator.wikimedia.org/T107629[5] https://doc.wikimedia.org/pywikibot/master/changelog.html#deprecationsVon: Kunal Mehta Gesendet: 15.11.2021 09:36An: Betreff: [pywikibot] Re: Deprecation policy? Hi,On 11/13/21 11:07 AM, Huji Lee wrote:> The Pywikibot project is barely maintained; a small community of> interested folks are pushing it forward, and most code gets merged> without review. Thanks for pointing this out, my feeling is that this is really theunderlying issue here. Keeping deprecated features around for a longtime has a cost, and we might not have enough active developers to pay it.I am very grateful to the people who are keeping 

[pywikibot] Re: Error on PWB

2021-12-03 Thread info
Hi Joseph,

is it your private wikibase family?
Perhaps it is this issue then:

https://phabricator.wikimedia.org/T288724

Best xqt

> Am 03.12.2021 um 17:29 schrieb Ugo Chima :
> 
> Joseph
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Using noreferences.py within PAWS ipynb

2021-11-29 Thread info
Hi GoEThe,

I’ve seen you are importing the the NoReferencesBot but you does not use it. 
addReferences() is not a function but a class method. You have either to 
localise the framework script (or open a Phabricator task for it) or you have 
to subclass the bot if the behaviour is very different from the generic script. 
Override the affected methods if necessary. 

Refer the doc: 
https://doc.wikimedia.org/pywikibot/master/scripts/scripts.html?highlight=addreferences#scripts.noreferences.NoReferencesBot.addReferences

For further questions do not hesitate to ask.

Best
xqt

> Am 29.11.2021 um 17:24 schrieb goethe.w...@gmail.com:
> 
> Hi,
> 
> I am trying to build a script to add a reference to a few hundred articles on 
> pt.wikipedia. I would like to use the noreferences.py script that is part of 
> core, to add a reference section in the same run, if it is not already 
> present in the article.
> I have tried to import the script, the NoReferencesBot class, but I must be 
> doing something wrong. It says that the function hasn't been defined.
> 
> You can check what I have been trying to do here: 
> https://public.paws.wmcloud.org/User:GoEThe/IUCN%20status.ipynb
> 
> Any help will be greatly appreciated!
> 
> Regards,
> GoEThe
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Please help

2021-08-20 Thread info
Hi Ugo,could you please either update the current Pywikibot master which tells the installed setuptools version or use the following code snippet to get it:  from setuptools Import __version__ as v  print(v)What is your installed setuptools then?Bestxqt Von: Ugo Chima Gesendet: 20.08.2021 11:13An: Pywikibot discussion list Betreff: [pywikibot] Re: Please help It didn't work, I even unstalled it with pip first before installing it again with pip3 but it still says the same thing. On Thu, Aug 19, 2021 at 3:07 PM Andre Engels  wrote:Possibly you have to run pip3 rather than pip. Pip probably installs it for Python 2 rather than Python 3 which you are probably using. On Sat, 14 Aug 2021, 18:41 Ugo Chima,  wrote:Whenever I try using the bot it says "The 'setuptools>=20.2; python_version >= "3.6"' distribution was not found and is required by the applicationA package necessary for pywikibot is missing.Please update required module with:    pip install "setuptools>=20.2""I ran the pip install "setuptools>=20.2" command and it keeps saying this NB: I have recently run the "pip install -r requirements.txt" too___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org___pywikibot mailing list -- pywikibot@lists.wikimedia.orgTo unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: python pwb.py replace.py not working

2021-08-17 Thread info
I think this is already solved with https://gerrit.wikimedia.org/r/c/pywikibot/core/+/709124Anyway it is always important to Show Python and Pywikibot versions if reporting a bug.Bestxqt Von: klaus.sei...@arcor.deGesendet: 17.08.2021 10:51An: Basudev Krishna ,Pywikibot discussion list Betreff: AW: [pywikibot] Re: python pwb.py replace.py not working  Hi Basudev,please file this issue to phabricator bug tracker.It is important to know which Python release and Pywikibot version are you using. Otherwise it might be impossible to help.Surely this problam is related to type annotation which can fail for Python < 3.5.2 but we are working on it.Bestxqt Von: Basudev Krishna Gesendet: 14.08.2021 16:18An: Pywikibot discussion list Betreff: [pywikibot] Re: python pwb.py replace.py not working Traceback (most recent call last):  File "/data/data/com.termux/files/home/pywikibot/pwb.py", line 249, in     import pywikibot as pwb  File "/data/data/com.termux/files/home/pywikibot/pywikibot/__init__.py", line 37, in     from pywikibot.bot import (  File "/data/data/com.termux/files/home/pywikibot/pywikibot/bot.py", line 1239, in     class BaseBot(OptionHandler):  File "/data/data/com.termux/files/home/pywikibot/pywikibot/bot.py", line 1395, in BaseBot    func: Callable[..., Any], *args: Any,TypeError: list expected at most 1 argument, got 2Error in atexit._run_exitfuncs:Traceback (most recent call last):  File "/data/data/com.termux/files/home/pywikibot/pywikibot/comms/http.py", line 88, in flush    log('Closing network session.')  File "/data/data/com.termux/files/home/pywikibot/pywikibot/logging.py", line 183, in log    logoutput(text, decoder, newline, VERBOSE, **kwargs)  File "/data/data/com.termux/files/home/pywikibot/pywikibot/logging.py", line 76, in logoutput    _init()  File "/data/data/com.termux/files/home/pywikibot/pywikibot/logging.py", line 35, in _init    init_routine()  File "/data/data/com.termux/files/home/pywikibot/pywikibot/tools/_deprecate.py", line 487, in wrapper    return obj(*new_args, **new_kwargs)  File "/data/data/com.termux/files/home/pywikibot/pywikibot/bot.py", line 359, in init_handlers    module_name = calledModuleName()  File "/data/data/com.termux/files/home/pywikibot/pywikibot/bot.py", line 843, in calledModuleName    return Path(pywikibot.argvu[0]).stemAttributeError: module 'pywikibot' has no attribute 'argvu' On Sat, Aug 14, 2021, 8:18 PM Basudev Krishna  је написао/ла:Traceback (most recent call last):  File "/data/data/com.termux/files/home/vikaspy/pwb.py", line 399, in     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     main()  File "./scripts/replace.py", line 929, in main    single_summary = i18n.twtranslate(  File 

[pywikibot] Re: EntityTypeUnknownError on Wikidata

2021-08-12 Thread info
Hi,

looks like
https://phabricator.wikimedia.org/T242083
and it occurred when wikibase had high traffic.

Best
xqt

> Am 12.08.2021 um 20:26 schrieb Zoran Dori :
> 
> 
> Hi,
> today my brain is doing very good job. :D
> 
> There is a task about this. https://phabricator.wikimedia.org/T288724
> 
> Best regards,
> Zoran Dori
> MediaWiki developer
> 
> 
> 
> 
> zorandori4...@gmail.com
> 
> www.wikiteq.com
> 
> 
> 
> 
> 
> чет, 12. авг 2021. у 20:13 Andre Engels  је написао/ла:
>> Since a few hours, running my bot on Wikidata I am getting the following 
>> error:
>> 
>> (snip)
>>   File "/home/ae1101/bot/pywikibot/page/__init__.py", line 3900, in __init__
>> ns = site.item_namespace
>>   File "/home/ae1101/bot/pywikibot/site/_datasite.py", line 91, in
>> item_namespace
>> self._item_namespace = self.get_namespace_for_entity_type('item')
>>   File "/home/ae1101/bot/pywikibot/site/_datasite.py", line 80, in
>> get_namespace_for_entity_type
>> .format(self, entity_type))
>> pywikibot.exceptions.EntityTypeUnknownError: DataSite("wikidata",
>> "wikidata") does not support entity type "item"
>> CRITICAL: Exiting due to uncaught exception > 'pywikibot.exceptions.EntityTypeUnknownError'>
>> 
>> Apparently something has changed in the site, but I have no idea what to 
>> do...
>> 
>> -- 
>> André Engels, andreeng...@gmail.com
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Help please 

2021-07-10 Thread info
Hi, 

this is not a script but a package which can be used by your own script. But 
probably a good reason to reimplement Pywikibot compat’s spellchecker with it

Best
xqt

> Am 10.07.2021 um 06:51 schrieb Basudev Krishna :
> 
> 
> Hi help please,
>  I can use all of the Mediawiki Python bot Script but I can't use any other 
> custom script.
> 
> https://github.com/fsondej/autocorrect
> 
> I want to use this script but can't, I'm use to termux
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: ​import pywikibot

2021-06-28 Thread info
Hi,

your Pywikibot looks outdated. Either setup a user-config.py like the sample 
here [1] or update your Pywikibot; never Version does not require it but it is 
recommended.

Best
xqt

[1] 
https://gerrit.wikimedia.org/r/plugins/gitiles/pywikibot/core/+/15ca230277dcb55526e345ff0692eda0e777bff7/user-config.py.sample


> Am 27.06.2021 um 20:58 schrieb ישראל קלר :
> 
> 
> 
> Hello, I wrote "import pywikibot", and that was the result. What to do?
> Traceback (most recent call last):
>   File "", line 1, in 
>   File 
> "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\__init__.py",
>  line 26, in 
> from pywikibot.bot import (
>   File 
> "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\bot.py", 
> line 106, in 
> from pywikibot import config2 as config
>   File 
> "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\config2.py",
>  line 383, in 
> base_dir = get_base_dir()
>   File 
> "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\config2.py",
>  line 375, in get_base_dir
> raise RuntimeError(exc_text)
> RuntimeError: No user-config.py found in directory 'C:\\Users\\user'.
>   Please check that user-config.py is stored in the correct location.
>   Directory where user-config.py is searched is determined as follows:
>  
> Return the directory in which user-specific information is stored.
>  
> This is determined in the following order:
>  1.  If the script was called with a -dir: argument, use the directory
>  provided in this argument.
>  2.  If the user has a PYWIKIBOT_DIR environment variable, use the value
>  of it.
>  3.  If user-config is present in current directory, use the current
>  directory.
>  4.  If user-config is present in pwb.py directory, use that directory
>  5.  Use (and if necessary create) a 'pywikibot' folder under
>  'Application Data' or 'AppData\Roaming' (Windows) or
>  '.pywikibot' directory (Unix and similar) under the user's home
>  directory.
>  
> Set PYWIKIBOT_NO_USER_CONFIG=1 to disable loading user-config.py or
> install pywikibot as a site-package.
>  
> @param test_directory: Assume that a user config file exists in this
> directory. Used to test whether placing a user config file in this
> directory will cause it to be selected as the base directory.
> 
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Replace multiple template names per page

2021-06-11 Thread info
Perhaps the doc need a hint for it?

Best
Xqt

> Am 10.06.2021 um 12:17 schrieb MarcoAurelio :
> 
> Hi,
> 
>> El lun, 7 jun 2021 a las 17:43,  escribió:
>> 
>> You also can give pairs of templates with template.py I think
>> 
>> Best
>> xqt
>> 
> 
> Tested that and indeed passing pairs of templates is supported (I
> thought only one pair was) and remplaces them all in just one edit.
> 
> Thanks!
> 
> Best regards, M.
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: delete.py

2021-06-11 Thread info

Either you have no ‘delete' right or you aren’t logged in or you are logged 
with a different user. Check it with the shell:

>>> site = Pywikibot.Site()
>>> site.has_right('delete')

Should be True

Best
xqt 

> Am 11.06.2021 um 14:13 schrieb ישראל קלר :
> 
> 
> I sysop there. What could be the problem?
> בברכה, ישראל.
> 
> 
> ‫בתאריך יום ה׳, 10 ביוני 2021 ב-22:58 מאת ‪rubin.happy‬‏ 
> <‪rubin.ha...@gmail.com‬‏>:‬
>> Hey.
>> 
>> Do you have an admin flag there? Not places templates when it is not 
>> possible to delete.
>> 
>> rubin16
>> 
>> Чт, 10 июня 2021 г. в 22:23, ישראל קלר :
>>> Hello, I tried to run the delete.py bot in hewikisource, but instead of 
>>> deleting the pages the bot added {{delete}}. what can we do?
>>> 
>>> [https://he.wikisource.org/w/index.php?title=%D7%91%D7%99%D7%90%D7%95%D7%A8:%D7%99%D7%A8%D7%95%D7%A9%D7%9C%D7%9E%D7%99_%D7%9E%D7%90%D7%99%D7%A8_%D7%91%D7%A8%D7%9B%D7%95%D7%AA/%D7%A4%D7%A8%D7%A7_%D7%90_%D7%94%D7%9C%D7%9B%D7%94_%D7%93=386861=1096867=1096464=source]
>>> 
>>> בברכה,
>>> ישראל קלר.
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Replace multiple template names per page

2021-06-07 Thread info
You also can give pairs of templates with template.py I think

Best 
xqt


> Am 07.06.2021 um 17:34 schrieb MarcoAurelio :
> 
> Hello Bináris,
> 
> Thanks for your reply.
> 
> Yes, I thought first about the bash/shell file with a bunch of
> template.py commands but like you said, it's not very elegant as I
> understand it would require several edits per page (one for each
> template that requires a replacement).
> 
> I'll try the replace.py way configuring a series of user-fixes for said 
> project.
> 
> Best regards, M.
> 
>> El lun, 7 jun 2021 a las 16:34, Bináris () escribió:
>> 
>> 
>> 
>> MarcoAurelio  ezt írta (időpont: 2021. jún. 7., H, 
>> 16:18):
>>> 
>>> (e.g. just replace the template name leaving brakets
>>> and parameters untouched i.e. {{template|1=parameter}}).
>> 
>> 
>> This is the easiest case if only the template names change and there are no 
>> nested templates. That's what replace.py is for.
>> 
>> A fix r'\{\{oldtemplate(\|.*?)\}\}', r'{{newtemplate\1}}' should do the work.
>> A less elegant trick, if your problem is, that template.py should be run 
>> several times: put the commands in a batch file / bash script.
>> 
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error while transferring images with imagetransfer.py

2021-06-06 Thread info
Hi

> Am 06.06.2021 um 18:34 schrieb Zoran Dori :
> 
> Hello,
> thank you very much for making the patch.
> 
> I can't test it anymore, but it looks good to me.
> 
> BTW, what do you think about my suggestion? 
> https://phabricator.wikimedia.org/T284373#7136264
> 

About the NoPageError? It is a good proposal. Can you create a task for it?

Best
xqt 

> Best regards,
> Zoran
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Error while transferring images with imagetransfer.py

2021-06-06 Thread info
Hi Zoran.I uploaded a patch which solved that issue of T284373.Can you review it?Bestxqthttps://phabricator.wikimedia.org/T284373https://gerrit.wikimedia.org/r/c/pywikibot/core/+/698322/ Von: Zoran Dori Gesendet: 05.06.2021 17:49An: Pywikibot discussion list Betreff: [pywikibot] Error while transferring images with imagetransfer.py Hi,I have a problem with transferring images with the imagetransfer.py script on PAWS in part when it finds a possible duplicate. See Pastebin: https://pastebin.com/QyL6n77d Best regards,Zoran
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-03 Thread info

Hi,

> Am 03.06.2021 um 11:22 schrieb Bináris :
> 
> OK, I am going to start with that, and thank you very much!
> To convert my own replace.py is much easier than to add all features to 
> community version.
> Now I have to return from far, far to understand the new concepts and being a 
> developer again.

I would be really happy. 

> 
> Additionally, I failed to install Python 3.9 on my Win7, it requires >=8.1. 
> No I am installing 3,7 and I hope it will be supported for a long time.

EOL date is in two years. Possibly you have Windows XX then. :-D


> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-03 Thread info

Oh there are a lot of other issues too by I guess you are familiar enough with 
that stuff.

Best
xqt

> Am 03.06.2021 um 11:24 schrieb Bináris :
> 
> 
> 
> 
>  ezt írta (időpont: 2021. jún. 3., Cs, 11:20):
>> Hi Binaris,
>> 
>> btw compat is for Python 2 only. 
>> 
> Hi,
> no problem with that, I have to add some parentheses and remove u from front 
> of strings.I use both Python branches (2 now only for compat).
> 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-03 Thread info



> Am 03.06.2021 um 07:40 schrieb Bináris :
> 
> 
> 
> 
>  ezt írta (időpont: 2021. jún. 2., Sze, 23:05):
>> Please be aware that other csrf tokens will be removed with mw 1.37 an can 
>> lead the compat release to fail.
> Thank you!  When is 1.37 due?

Current release of Wikimedia cluster is 1.37.0.-wmf.7 and you should expect 
problems with old tokens soon if you still are using compat release.

I have restored the compat2core script which can be used for the conversion. I 
propose to use both releases for your production system, compat and core. You 
can install also two Pythons and you can use the py launcher with windows to 
select which Python to be runned. Convert each script from compat to core step 
by step and do not hesitate ask (me) for any help. I did the same in past; now 
all my scripts are converted. 

Best
xqt

> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-02 Thread info
Please be aware that other csrf tokens will be removed with mw 1.37 an can lead 
the compat release to fail.

Best
xqt



> Am 02.06.2021 um 22:55 schrieb i...@gno.de:
> 
> Hi,
> 
> yes there is a manual about this:
> 
> https://www.mediawiki.org/wiki/Manual:Pywikibot/compat-to-core_conversion
> 
> The compat2core script was archived in meantime but it can still be used. It 
> also can restored to the supported scripts. Pleas also use the task noted 
> there for any help.
> 
> Best
> xqt 
> 
>>> Am 02.06.2021 um 16:20 schrieb Bináris :
>>> 
>> 
>> Is there a manual to rewrite comat scripts to Pywikibot?
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-02 Thread info
Hi,

yes there is a manual about this:

https://www.mediawiki.org/wiki/Manual:Pywikibot/compat-to-core_conversion

The compat2core script was archived in meantime but it can still be used. It 
also can restored to the supported scripts. Pleas also use the task noted there 
for any help.

Best
xqt 

> Am 02.06.2021 um 16:20 schrieb Bináris :
> 
> 
> Is there a manual to rewrite comat scripts to Pywikibot?
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-02 Thread info
Hi Binaris,

login2.py wasn’t shipped with compat. The login implementation looks like 
MediaWiki 1.27 and the current one has changed a lot. Probably it does not work 
anymore with compat.

Best
xqt 

Von meinem iPhone gesendet

> Am 02.06.2021 um 07:14 schrieb Bináris :
> 
> 
> Hi John,
> I used a login2.py I am not sure it is my former experiment or an official 
> script. 
> With login.py it is 
> Traceback (most recent call last):
>   File "C:\Pywikipediacompat\login.py", line 480, in 
> main()
>   File "C:\Pywikipediacompat\login.py", line 475, in main
> loginMan.login()
>   File "C:\Pywikipediacompat\login.py", line 349, in login
> cookiedata = self.getCookie(api)
>   File "C:\Pywikipediacompat\login.py", line 263, in getCookie
> self.site._token[index] = data['login']['lgtoken'] + "+\\"
> KeyError: 'lgtoken'
> 
> And with login2:
> Traceback (most recent call last):
>   File "C:\Pywikipediacompat\login2.py", line 496, in 
> main()
>   File "C:\Pywikipediacompat\login2.py", line 491, in main
> loginMan.login()
>   File "C:\Pywikipediacompat\login2.py", line 365, in login
> cookiedata = self.getCookie(api)
>   File "C:\Pywikipediacompat\login2.py", line 213, in getCookie
> result = data['query']['tokens']['logintoken']
> KeyError: 'tokens'
> 
> NB login.py definitely gives this answer for the CORRECT password only. 
> Otherwise it runs without error and says:
> Login failed. Wrong password or CAPTCHA answer?
> 
> John  ezt írta (időpont: 2021. jún. 1., K, 21:51):
>> What error message are you getting? I patched that locally when it happened 
>> and I cannot reference a clean copy of compat any more. Knowing the error 
>> would let me narrow it down.
>> 
>>> On Tue, Jun 1, 2021 at 3:38 PM Bináris  wrote:
>>> Thank you, that was not quite the asnwer I hoped.
>>> I have many own extensions to replace.py, but I appreciate your effort, and 
>>> I wll try to write a list with the standard features.
>>> Yes, this is the only reason I have Python 2.
>>> 
>>>  ezt írta (időpont: 2021. jún. 1., K, 19:57):
 
 Hi Binaris, 
 
 I remember there was an issue but I am not able to investigate into this 
 matter. The compat branch is very outdated and does only support Python 2. 
 My Python developing version is 3.9, the production system runs with 3.7 
 and for some reason I have also 3.5 installed which is the default 
 environment on tools. 
 
 The only way I can support you is to re-implement the missing 
 functionality. Where is the lag in core? What are you missing?
 
 Best
 xqt
 
 > Am 01.06.2021 um 08:51 schrieb Bináris :
 > 
 > 
 > Hi folks,
 > 
 > I remember that a point the login process of compat was broken, and 
 > developers told they didn't bother any more to correct it. [1]
 > I intensively used compat, because the new replace.py is not in the 
 > vicinity of my compat version.
 > But last year there was a problem where all bots were forcedly logged 
 > out, and now I cannot use my bot.
 > 
 > Has anything happened since [1]? Or can you give me any hint, how to 
 > begin to solve it on my own?
 > 
 > -- 
 > Bináris
 > ___
 > pywikibot mailing list -- pywikibot@lists.wikimedia.org
 > To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
 ___
 pywikibot mailing list -- pywikibot@lists.wikimedia.org
 To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>>> 
>>> 
>>> -- 
>>> Bináris
>>> ___
>>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
>> ___
>> pywikibot mailing list -- pywikibot@lists.wikimedia.org
>> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
> 
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Login with compat

2021-06-01 Thread info

Hi Binaris, 

I remember there was an issue but I am not able to investigate into this 
matter. The compat branch is very outdated and does only support Python 2. My 
Python developing version is 3.9, the production system runs with 3.7 and for 
some reason I have also 3.5 installed which is the default environment on 
tools. 

The only way I can support you is to re-implement the missing functionality. 
Where is the lag in core? What are you missing?

Best
xqt

> Am 01.06.2021 um 08:51 schrieb Bináris :
> 
> 
> Hi folks,
> 
> I remember that a point the login process of compat was broken, and 
> developers told they didn't bother any more to correct it. [1]
> I intensively used compat, because the new replace.py is not in the vicinity 
> of my compat version.
> But last year there was a problem where all bots were forcedly logged out, 
> and now I cannot use my bot.
> 
> Has anything happened since [1]? Or can you give me any hint, how to begin to 
> solve it on my own?
> 
> -- 
> Bináris
> ___
> pywikibot mailing list -- pywikibot@lists.wikimedia.org
> To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Re: Thank you Xqt

2021-05-10 Thread info
Hello all,thank you very much for the kind words.There are so many ideas but so less time.But some of them will become true.Here some important changes coming soon:- Async chunck Uploads was implemented, contribs by Zhuyifei1999 and InductiveLoad)- After a very long time compat's output cache is in review now.- An advanced RLock will be implemented which has a locked() method like in threading.Lock and a count property which gives the current lock LevelThank you for watching me ;)Bestxqt Von: Huji Lee Gesendet: 08.05.2021 21:32An: Pywikibot discussion list Betreff: Re: [pywikibot] Thank you Xqt Congrats!PS: Don't ever leave us! On Sat, May 8, 2021 at 11:17 AM Bináris  wrote:Ooohyeee! Congratulations and big, big, big thank you! And also thanks to Legotkm for noticing it.___pywikibot mailing listpywikibot@lists.wikimedia.orghttps://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list -- pywikibot@lists.wikimedia.org
To unsubscribe send an email to pywikibot-le...@lists.wikimedia.org


[pywikibot] Pywikibot.6.1.0

2021-04-18 Thread info
Hi folks,a new stable release 6.1.0 was published yesterday. There are some important points with this release:Dependencies---Either mwparserfromhell or wikitextparser package are strictly recommended. They will become mandatory with the next release. Please follow the instructions if you get a FutureWarning due to this issue. The reason is that there are many bugs with nested templates and the current behaviour is a regression against old compat (1.0) release formerly known as trunk release. But the old implementation had some bugs too and there is no reason to reinvent the wheel. Therefore a MediaWiki Markup parser will be used in future and our regex implementation will be dropped. (T106763)Vulnerability was found in Pillow which is used by our GUI userinterface. Therefore Python 3.5 has to be dropped for this code parts. If you are useing Python 3.5 is recommended to update your Python anyway because Python 3.5 has reached it's life cycle.But there is no plan to drop Python 3.5 yet. But be aware that more and more packages does not support it any longer.Release 1.0.0 of PyMySQL is supported with Pywikibot.Bugfixes and impovementsBaseBot.treat() may process items other than a Page object. A sample can be shown in patrol.py were a dict is assigned to bot.treat_page_type.API:Revisiondelete is supported with Site.deleterevs().Site.deletepage() was renamed to delete(). It is able to delete an old Image if a file idis give with oldimage parameter. Refer API:delete and the doc string for further Information.Code cleanupsSome code cleanups were made. Refer HISTORY.rst and ROADMAP for them.See https://github.com/wikimedia/pywikibot/blob/master/ROADMAP.rst and https://github.com/wikimedia/pywikibot/blob/master/HISTORY.rstA lot of thanks to all who have contributed new code or reviewed proposed changed.By the way I reworked the documentation a bit: https://doc.wikimedia.org/pywikibot/master/index.htmlI added a new Pywikibot logo on it and hope you like it.Thank you all. Comments are welcome.Bestxqt 


___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] i18n files and pip

2021-02-28 Thread info
Solution submitted. Will upload it to pypi shortly. Thanks to Merlijn for 
review.

Best
xqt 

> Am 28.02.2021 um 12:18 schrieb i...@gno.de:
> 
> I opened T275981 for it.
> 
> Best
> xqt 
> 
>>> Am 27.02.2021 um 14:27 schrieb Merlijn van Deen (valhallasw) 
>>> :
>>> 
>> 
>> Hi André,
>> 
>> Looking at 
>> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/i18n.py#L6, it 
>> sounds to me like in principe the core Pywikibot code should never call 
>> i18n.*.
>> 
>> There are currently a few places where this _does_ happen:
>> 
>> * pagegenerators.py, which uses a fallback in case i18n data is not 
>> available: 
>> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/pagegenerators.py#L641
>>  -- so these are OK.
>> * page/__init__.py calls twtranslate in:
>>   1) the cosmetic changes fallback. This one is a little difficult to fix -- 
>> maybe it should fall back to a hardcoded English string in case i18n is not 
>> available? 
>>   2) the touch method. The method should probably require summary to be 
>> passed as part of the method signature. The corresponding script 
>> scripts/touch.py / scripts/newitem.py can then do the i18n lookup.
>>... in principle, we could also just use a hardcoded summary and not 
>> bother translating. After all, touch is supposed to not modify the text and 
>> therefore the edit summary _shouldn't be visible_...
>> 
>> Indeed the other approach would be to bundle a subset of i18n data with the 
>> framework (these are all in scripts/i18n/pywikibot). However the loading 
>> setup is a little bit complex due to the data being json files that could be 
>> in a (zipped) Python package...
>> 
>> Cheers,
>> Merlijn
>> 
>> 
>>> On Thu, 25 Feb 2021 at 14:30, André Costa  wrote:
>>> 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.co...@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 ;)
>>> ___
>>> pywikibot mailing list
>>> pywikibot@lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>> ___
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] i18n files and pip

2021-02-28 Thread info
I opened T275981 for it.

Best
xqt 

> Am 27.02.2021 um 14:27 schrieb Merlijn van Deen (valhallasw) 
> :
> 
> 
> Hi André,
> 
> Looking at 
> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/i18n.py#L6, it 
> sounds to me like in principe the core Pywikibot code should never call 
> i18n.*.
> 
> There are currently a few places where this _does_ happen:
> 
> * pagegenerators.py, which uses a fallback in case i18n data is not 
> available: 
> https://github.com/wikimedia/pywikibot/blob/master/pywikibot/pagegenerators.py#L641
>  -- so these are OK.
> * page/__init__.py calls twtranslate in:
>   1) the cosmetic changes fallback. This one is a little difficult to fix -- 
> maybe it should fall back to a hardcoded English string in case i18n is not 
> available? 
>   2) the touch method. The method should probably require summary to be 
> passed as part of the method signature. The corresponding script 
> scripts/touch.py / scripts/newitem.py can then do the i18n lookup.
>... in principle, we could also just use a hardcoded summary and not 
> bother translating. After all, touch is supposed to not modify the text and 
> therefore the edit summary _shouldn't be visible_...
> 
> Indeed the other approach would be to bundle a subset of i18n data with the 
> framework (these are all in scripts/i18n/pywikibot). However the loading 
> setup is a little bit complex due to the data being json files that could be 
> in a (zipped) Python package...
> 
> Cheers,
> Merlijn
> 
> 
>> On Thu, 25 Feb 2021 at 14:30, André Costa  wrote:
>> 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.co...@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 ;)
>> ___
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


[pywikibot] New Pywikibot stable release 6.0

2021-02-01 Thread info
Hi folks,

a new stable release 6.0 will be deployed soon. There are some important points 
with this release, currently implemented in master branch:


Breaking changes:

- Support for MediaWiki < 1.23 will been dropped after fandom wikis updated 
most platforms to MW 1.33. (T268979)


- comms.requests returns a requests.Response object instead of plain text. 
Normally this does not care because comms.requests result is passed through 
data.api anyway. But this changes enables to use a lot of requests 
functionality like exception handling, json conversion, encodings and we have 
access to headers response and others. Thanks to Mpaa who made a lot of commits 
to get the this done.


- config.db_hostname was renamed to db_hostname_format to  take into account 
that replicas hosts got redesigned and may have different host names.


- APISite.loadimageinfo no longer returns any content; it just loads it to the 
instance cache.


- A lot of scripts will be moved to archive folder (T223826). They are still 
usable if you add 'scripts.archive' to user_script_paths variable in 
cuser-config.py but they aren't actively maintained. Please visit 
https://phabricator.wikimedia.org/T223826 and mark scripts you need. After 
moving to archive, just open a task to recover a script to be developed 
further. Currently archived scripts (featured.py and cfd.py) will be removed.


Other changes:

- Load time of Wikibase access to SiteLinks will be decreased a lot. Currently 
retrieving data from an ItemPage needs upto 6 minutes; after that change it 
might be only seconds. Using toJSON() method to a SiteLinkCollection will still 
need time to create the data dict. You may use a maintenance script 
"preload_pages.py" to optimize you bot in this special case.


Refer https://github.com/wikimedia/pywikibot/blob/master/ROADMAP.rst for the 
full changelog of the current release and 
https://github.com/wikimedia/pywikibot/blob/master/HISTORY.rst for all release 
changes.

A lot of thanks to all who have contributed new code or reviewed proposed 
changed. Also thanks for all reported bugs, improvement proposals and feature 
request. Thanks using Pywikibot.

Thanks for participating to "2020 Coolest Tool Award Winner": 
https://meta.wikimedia.org/wiki/Coolest_Tool_Award.

Thank you all

xqt
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] ImageTransfer script

2020-10-12 Thread info
Could you file a task at Phabricator please.

xqt

> Am 10.10.2020 um 11:45 schrieb John Bray :
> 
> No idea about the api as manual upload works.
> 
> I've decided that using the maintenance script 'php importImages.php
> --source-wiki-url="http://oldwiki/; 2' works well enough, as I've lost
> confidence in ImageTransfer.
> 
>> On Fri, 9 Oct 2020 at 19:19,  wrote:
>> 
>> Hi John,
>> 
>> the bot found an api error with code uploaddisabled and the given info 
>> message. This is on the site side and there is nothing on pywikibot side 
>> what can be done I guess.
>> 
>> The deprecation warning does not care yet. Normally you should not see it by 
>> the default configuration. This warnings are shown on debug level only. But 
>> you should care about FutureWarnings on your on your own scripts. These 
>> warnings indicate a method or class to be removed but not earlier than the 
>> over next release.
>> 
>> Best
>> xqt
>> 
>>>> Am 09.10.2020 um 16:58 schrieb John Bray :
>>> 
>>> I want to do a controlled transfer of parts of one wiki to another.
>>> For the files I've transferred the images directory, but the metadata
>>> for the File:Happy.jpg page is missing, so I thought I'd try
>>> https://www.mediawiki.org/wiki/Manual:Pywikibot/imagetransfer.py
>>> 
>>> I've got a page list with pwb.py listpages -ns:File -start
>>> -format:"{page.title}" > Files.list, but when try to transfer the
>>> pages with
>>> 
>>> pwb.py imagetransfer -v File:Happy.jpeg -tofamily:newwiki
>>> Python 2.7.17 (default, Jul 20 2020, 15:37:01)
>>> [GCC 7.5.0]
>>> 
>>> 0. Found image: [[File:Happy.jpeg]]
>>> Found 1 oldwiki:en-gb processes running, including this one.
>>> 
>>> Found 1 newwiki:en-gb processes running, including this one.
>>> 
>>> WARNING: /home/john/bin/pywikibot/core/scripts/imagetransfer.py:143:
>>> DeprecationWarning: pywikibot.page.FilePage.fileUrl is deprecated for
>>> 4 years and 4 months; use get_
>>> file_url instead.
>>> url = sourceImagePage.fileUrl().encode('utf-8')
>>> 
>>> URL should be: http://oldwiki.priory/images/1/1/Happy.jpeg
>>> WARNING: /data/priory1/home/john/bin/pywikibot/core1/pywikibot/page.py:2605:
>>> DeprecationWarning: pywikibot.page.FilePage.getFileVersionHistory is
>>> deprecated for 5 years
>>> and 11 months; use FilePage.get_file_history() instead.
>>> for info in self.getFileVersionHistory():
>>> 
>>> WARNING: url as string is deprecated. Use an iterable instead.
>>> Logging in to newwiki:en-gb as John@johnbot
>>> Should be logged in now
>>> ERROR: Upload error: Local file uploads are disabled on newwiki:en-gb.
>>> Dropped throttle(s).
>>> Closing network session.
>>> Network session closed.
>>> 
>>> So I checked newwiki/LocalSettings.php, and it has $wgEnableUploads = true;
>>> 
>>> Is there something I'm missing to get the image uploaded, and does the
>>> 5 year DeprecationWarning mean this script is unsupported, so should
>>> be avoided?
>>> 
>>> ___
>>> pywikibot mailing list
>>> pywikibot@lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>> 
>> 
>> ___
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
> 
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot


___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] ImageTransfer script

2020-10-09 Thread info
Hi John,

the bot found an api error with code uploaddisabled and the given info message. 
This is on the site side and there is nothing on pywikibot side what can be 
done I guess.

The deprecation warning does not care yet. Normally you should not see it by 
the default configuration. This warnings are shown on debug level only. But you 
should care about FutureWarnings on your on your own scripts. These warnings 
indicate a method or class to be removed but not earlier than the over next 
release.

Best
xqt

> Am 09.10.2020 um 16:58 schrieb John Bray :
> 
> I want to do a controlled transfer of parts of one wiki to another.
> For the files I've transferred the images directory, but the metadata
> for the File:Happy.jpg page is missing, so I thought I'd try
> https://www.mediawiki.org/wiki/Manual:Pywikibot/imagetransfer.py
> 
> I've got a page list with pwb.py listpages -ns:File -start
> -format:"{page.title}" > Files.list, but when try to transfer the
> pages with
> 
> pwb.py imagetransfer -v File:Happy.jpeg -tofamily:newwiki
> Python 2.7.17 (default, Jul 20 2020, 15:37:01)
> [GCC 7.5.0]
> 
> 0. Found image: [[File:Happy.jpeg]]
> Found 1 oldwiki:en-gb processes running, including this one.
> 
> Found 1 newwiki:en-gb processes running, including this one.
> 
> WARNING: /home/john/bin/pywikibot/core/scripts/imagetransfer.py:143:
> DeprecationWarning: pywikibot.page.FilePage.fileUrl is deprecated for
> 4 years and 4 months; use get_
> file_url instead.
> url = sourceImagePage.fileUrl().encode('utf-8')
> 
> URL should be: http://oldwiki.priory/images/1/1/Happy.jpeg
> WARNING: /data/priory1/home/john/bin/pywikibot/core1/pywikibot/page.py:2605:
> DeprecationWarning: pywikibot.page.FilePage.getFileVersionHistory is
> deprecated for 5 years
> and 11 months; use FilePage.get_file_history() instead.
> for info in self.getFileVersionHistory():
> 
> WARNING: url as string is deprecated. Use an iterable instead.
> Logging in to newwiki:en-gb as John@johnbot
> Should be logged in now
> ERROR: Upload error: Local file uploads are disabled on newwiki:en-gb.
> Dropped throttle(s).
> Closing network session.
> Network session closed.
> 
> So I checked newwiki/LocalSettings.php, and it has $wgEnableUploads = true;
> 
> Is there something I'm missing to get the image uploaded, and does the
> 5 year DeprecationWarning mean this script is unsupported, so should
> be avoided?
> 
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot


___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


[pywikibot] New Pywikibot release 5.0

2020-10-04 Thread info
Hi folks,

a new stable release 5.0 will be deployed soon. There are some important points 
with this release:

- Support for MediaWiki < 1.19 has been dropped. Support for LTS 1.19 and above 
will be kept until fandom wikis were updated

- A lot of methods and classes which are deprecated for 5 years and more were 
removed. This includes all textlib functions which must be imported from 
textlib now and are no longer accessable directly from pywikibot module. The 
removal was announced previously by a FutureWarning. Please check your code, 
take attention to FutureWarning hints and refer the roadmap where other changed 
are announced.

- Deprecated script options were removed and are no longer functional.

Other changes:

- The -help option does show global options anymore. You get them via 
-help:global or by the pwb.py wrapper script pwb -help. By the way the pwb.py 
wrapper is able to ignore misspellings for script calls bot also can handle all 
global options even a user script does not call the handle_args() function e.g. 
to change the default lang code and family. Refer pwb.py (without parameters) 
to see the usage.

- APISite.recentchanges() does no longer accept positional arguments

- The new method Page.get_best_claim () retrieves the preferred Claim of a 
property referring to the given page

- BasePage.has_deleted_revisions() method was added deleted revs can be 
retrieved without the deletedhistory right

- Siteinfo.get() loads data via API instead from cache if expiry parameter is 
True

- Wikibase entities are loaded when necessary

- some circular imports are solved

refer https://github.com/wikimedia/pywikibot/blob/master/ROADMAP.rst for the 
full changelog after

https://gerrit.wikimedia.org/r/c/pywikibot/core/+/630579 has been merged.

There are some outstanding bugfixes and improvements waiting for review at 
gerrit; see if you can help.

Best

xqt
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] Contributing to pywikibot

2020-08-28 Thread info
Hi Vivek and Arshdeep Singh,

your are very welcomed to contribute to pywikibot.

For the first steps follow these links YiFei Zhu mentioned below. There are 
related links for commit access, tutorials using our gerrit code review 
workflow, and coding style guides.

You may find some "good first task" [1] at [2] which are suitable for new 
developers. Maybe you can start with [3]. There are a lot of remaining scripts 
to be converted.

By the way it is not needed to have a developer account to contribute your 
code. A Gerrit patch uploader [4] is also available.

Finally do not hesitiate to ask for any help.
Thank you both for your interest for participating.

Best
xqt

[1] https://phabricator.wikimedia.org/tag/good_first_task/
[2] https://phabricator.wikimedia.org/maniphest/query/j9Pm7b1huLhN/#R
[3] https://phabricator.wikimedia.org/T257399
[4] https://www.mediawiki.org/wiki/Gerrit_patch_uploader

> YiFei Zhu  hat am 27. August 2020 um 23:53 
> geschrieben:
> 
> 
> This is all documented [1][2]. Feel free to ask if you have more
> specific questions, such as "How do I find bugs? How do I fix this bug
> / add this feature? Why is this done this way? How do I send patches?"
> etc.
> 
> YiFei Zhu
> 
> [1] https://www.mediawiki.org/wiki/Manual:Pywikibot/Development
> [2] https://github.com/wikimedia/pywikibot/blob/master/README.rst
> 
> On Thu, Aug 27, 2020 at 1:36 PM Vivek  wrote:
> >
> > On Tue, 25 Aug 2020 at 20:28, Vivek  wrote:
> > >
> > > Hello,
> > > I am Vivek malhan from India, I have intermediate experience with
> > > python. I wish to be part of this team and contribute to this
> > > pywikibot project. Please guide me how I can do the same.
> > > Thanks and Regards.
> > ping.
> >
> > --
> > Vivek Malhan
> > Active javaScript developer
> > https://github.com/VivekMalhan666
> > https://bethenewwyou.wordpress.com/
> > https://gdy.club/m3
> >
> > --
> >
> > ___
> > pywikibot mailing list
> > pywikibot@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/pywikibot
> 
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot

___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] replaceCategoryLinks fails with “Invalid argument type '' in Page initializer: B”

2020-08-23 Thread info
Again me. 

The breaking change was made unintentionally in 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/498727/
but solved a lot of problems of mixed used with Python 2 and 3. Refer the 
comments on bottom of that patch for further information.

Sorry for this. I would be glad if I could help you.

xqt 


> Am 23.08.2020 um 10:07 schrieb i...@gno.de:
> 
> 
> I meant:
> 
> from __future__ import unicode_literals
> 
> xqt
> 
>>> Am 23.08.2020 um 10:05 schrieb i...@gno.de:
>>> 
>> 
>> Digging a bit more. I guess you are still using Python 2. There was a change 
>> made in 3.0.30190430 due to T219095 which expects unicode strings for 
>> categoryFormat but 'B' is a str in Python 2. Either you have to use the u 
>> prefix like u'B' or you have to add this line on top of your scripts:
>> 
>> from __future__ Import unicode_literals
>> 
>> By the way the last release supporting Python 2 is 3.0.20200703.
>> 
>> Best
>> xqt
>> 
 Am 23.08.2020 um 08:38 schrieb i...@gno.de:
 
>>> Hi Jean-Frederic,
>>> 
>>> strings are allowed for the textlib.categoryFormat. But are you trying to 
>>> run pywikibot 4.0+ with Python 2? The related code line is
>>> xqt e4115af 2020-07-24 11:31:05 +0200   [diff] [blame]  1539
>>> if isinstance(category, str)
>>> Obviously this check fails for your given 'B'.
>>> 
>>> Best
>>> xqt
>>> 
> Am 22.08.2020 um 14:32 schrieb Maarten Dammers :
> 
 
 Hi Jean-Frédéric,
 
 I see new_categories = ["B"] in your code. I believe this should be a list 
 of Category objects, not a list of strings.
 
 Maarten
 
 On 19-08-2020 21:48, Jean-Frédéric wrote:
> Hi,
> 
> In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
> 
> Upgrading to latest version leads to two of my unit tests to fail [2]
> (I’m not 100% sure, but I do believe the same errors popped up last time 
> I tried upgrading in August 2019.)
> 
> The unit tests are at [3], the method tested at [4], and the stack trace 
> at [5].
> 
> I have been digging a bit in the git history to understand what happened 
> between August 2018 and August 2019 / August 2020 in textlib but nothing 
> jumped.
> 
> Would anyone know what the change is caused by, and how I should update 
> my code?
> 
> Thanks!
> 
> [1] https://phabricator.wikimedia.org/diffusion/THER/
> [2] 
> https://integration.wikimedia.org/ci/job/labs-tools-heritage-tox-docker/509/console
> [3] 
> https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_categorization.py$87-103
> [4] 
> https://phabricator.wikimedia.org/diffusion/THER/browse/master/erfgoedbot/categorize_images.py$252-264
> [5] Stack trace:
> ```
>   File "/src/erfgoedbot/categorize_images.py", line 263, in 
> replace_default_cat_with_new_categories_in_image_text
> page_text_without_base_category, new_categories, addOnly=True)
>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
> line 1459, in replaceCategoryLinks
> new_cats = categoryFormat(new, insite=site)
>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
> line 1552, in categoryFormat
> category = pywikibot.Category(category)
>   File 
> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
> line 1819, in wrapper
> return obj(*__args, **__kw)
>   File 
> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
> line 2879, in __init__
> Page.__init__(self, source, title, ns=14)
>   File 
> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
> line 1819, in wrapper
> return obj(*__args, **__kw)
>   File 
> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
> line 2392, in __init__
> super(Page, self).__init__(source, title, ns)
>   File 
> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
> line 221, in __init__
> .format(type(source), source))
> Error: Invalid argument type '' in Page initializer: B
> ```
> --
> Jean-Frédéric
> 
> 
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
 ___
 pywikibot mailing list
 pywikibot@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] replaceCategoryLinks fails with “Invalid argument type '' in Page initializer: B”

2020-08-23 Thread info

I meant:

from __future__ import unicode_literals

xqt

> Am 23.08.2020 um 10:05 schrieb i...@gno.de:
> 
> 
> Digging a bit more. I guess you are still using Python 2. There was a change 
> made in 3.0.30190430 due to T219095 which expects unicode strings for 
> categoryFormat but 'B' is a str in Python 2. Either you have to use the u 
> prefix like u'B' or you have to add this line on top of your scripts:
> 
> from __future__ Import unicode_literals
> 
> By the way the last release supporting Python 2 is 3.0.20200703.
> 
> Best
> xqt
> 
>>> Am 23.08.2020 um 08:38 schrieb i...@gno.de:
>>> 
>> Hi Jean-Frederic,
>> 
>> strings are allowed for the textlib.categoryFormat. But are you trying to 
>> run pywikibot 4.0+ with Python 2? The related code line is
>> xqt  e4115af 2020-07-24 11:31:05 +0200   [diff] [blame]  1539
>> if isinstance(category, str)
>> Obviously this check fails for your given 'B'.
>> 
>> Best
>> xqt
>> 
 Am 22.08.2020 um 14:32 schrieb Maarten Dammers :
 
>>> 
>>> Hi Jean-Frédéric,
>>> 
>>> I see new_categories = ["B"] in your code. I believe this should be a list 
>>> of Category objects, not a list of strings.
>>> 
>>> Maarten
>>> 
>>> On 19-08-2020 21:48, Jean-Frédéric wrote:
 Hi,
 
 In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
 
 Upgrading to latest version leads to two of my unit tests to fail [2]
 (I’m not 100% sure, but I do believe the same errors popped up last time I 
 tried upgrading in August 2019.)
 
 The unit tests are at [3], the method tested at [4], and the stack trace 
 at [5].
 
 I have been digging a bit in the git history to understand what happened 
 between August 2018 and August 2019 / August 2020 in textlib but nothing 
 jumped.
 
 Would anyone know what the change is caused by, and how I should update my 
 code?
 
 Thanks!
 
 [1] https://phabricator.wikimedia.org/diffusion/THER/
 [2] 
 https://integration.wikimedia.org/ci/job/labs-tools-heritage-tox-docker/509/console
 [3] 
 https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_categorization.py$87-103
 [4] 
 https://phabricator.wikimedia.org/diffusion/THER/browse/master/erfgoedbot/categorize_images.py$252-264
 [5] Stack trace:
 ```
   File "/src/erfgoedbot/categorize_images.py", line 263, in 
 replace_default_cat_with_new_categories_in_image_text
 page_text_without_base_category, new_categories, addOnly=True)
   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
 line 1459, in replaceCategoryLinks
 new_cats = categoryFormat(new, insite=site)
   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
 line 1552, in categoryFormat
 category = pywikibot.Category(category)
   File 
 "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
 line 1819, in wrapper
 return obj(*__args, **__kw)
   File 
 "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
 line 2879, in __init__
 Page.__init__(self, source, title, ns=14)
   File 
 "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
 line 1819, in wrapper
 return obj(*__args, **__kw)
   File 
 "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
 line 2392, in __init__
 super(Page, self).__init__(source, title, ns)
   File 
 "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
 line 221, in __init__
 .format(type(source), source))
 Error: Invalid argument type '' in Page initializer: B
 ```
 --
 Jean-Frédéric
 
 
 ___
 pywikibot mailing list
 pywikibot@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/pywikibot
>>> ___
>>> pywikibot mailing list
>>> pywikibot@lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] replaceCategoryLinks fails with “Invalid argument type '' in Page initializer: B”

2020-08-23 Thread info

Digging a bit more. I guess you are still using Python 2. There was a change 
made in 3.0.30190430 due to T219095 which expects unicode strings for 
categoryFormat but 'B' is a str in Python 2. Either you have to use the u 
prefix like u'B' or you have to add this line on top of your scripts:

from __future__ Import unicode_literals

By the way the last release supporting Python 2 is 3.0.20200703.

Best
xqt

> Am 23.08.2020 um 08:38 schrieb i...@gno.de:
> 
> Hi Jean-Frederic,
> 
> strings are allowed for the textlib.categoryFormat. But are you trying to run 
> pywikibot 4.0+ with Python 2? The related code line is
> xqt   e4115af 2020-07-24 11:31:05 +0200   [diff] [blame]  1539
> if isinstance(category, str)
> Obviously this check fails for your given 'B'.
> 
> Best
> xqt
> 
>>> Am 22.08.2020 um 14:32 schrieb Maarten Dammers :
>>> 
>> 
>> Hi Jean-Frédéric,
>> 
>> I see new_categories = ["B"] in your code. I believe this should be a list 
>> of Category objects, not a list of strings.
>> 
>> Maarten
>> 
>> On 19-08-2020 21:48, Jean-Frédéric wrote:
>>> Hi,
>>> 
>>> In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
>>> 
>>> Upgrading to latest version leads to two of my unit tests to fail [2]
>>> (I’m not 100% sure, but I do believe the same errors popped up last time I 
>>> tried upgrading in August 2019.)
>>> 
>>> The unit tests are at [3], the method tested at [4], and the stack trace at 
>>> [5].
>>> 
>>> I have been digging a bit in the git history to understand what happened 
>>> between August 2018 and August 2019 / August 2020 in textlib but nothing 
>>> jumped.
>>> 
>>> Would anyone know what the change is caused by, and how I should update my 
>>> code?
>>> 
>>> Thanks!
>>> 
>>> [1] https://phabricator.wikimedia.org/diffusion/THER/
>>> [2] 
>>> https://integration.wikimedia.org/ci/job/labs-tools-heritage-tox-docker/509/console
>>> [3] 
>>> https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_categorization.py$87-103
>>> [4] 
>>> https://phabricator.wikimedia.org/diffusion/THER/browse/master/erfgoedbot/categorize_images.py$252-264
>>> [5] Stack trace:
>>> ```
>>>   File "/src/erfgoedbot/categorize_images.py", line 263, in 
>>> replace_default_cat_with_new_categories_in_image_text
>>> page_text_without_base_category, new_categories, addOnly=True)
>>>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
>>> line 1459, in replaceCategoryLinks
>>> new_cats = categoryFormat(new, insite=site)
>>>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
>>> line 1552, in categoryFormat
>>> category = pywikibot.Category(category)
>>>   File 
>>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
>>> line 1819, in wrapper
>>> return obj(*__args, **__kw)
>>>   File 
>>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>>> line 2879, in __init__
>>> Page.__init__(self, source, title, ns=14)
>>>   File 
>>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
>>> line 1819, in wrapper
>>> return obj(*__args, **__kw)
>>>   File 
>>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>>> line 2392, in __init__
>>> super(Page, self).__init__(source, title, ns)
>>>   File 
>>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>>> line 221, in __init__
>>> .format(type(source), source))
>>> Error: Invalid argument type '' in Page initializer: B
>>> ```
>>> --
>>> Jean-Frédéric
>>> 
>>> 
>>> ___
>>> pywikibot mailing list
>>> pywikibot@lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>> ___
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] replaceCategoryLinks fails with “Invalid argument type '' in Page initializer: B”

2020-08-23 Thread info
Hi Jean-Frederic,

strings are allowed for the textlib.categoryFormat. But are you trying to run 
pywikibot 4.0+ with Python 2? The related code line is
xqt e4115af 2020-07-24 11:31:05 +0200   [diff] [blame]  1539
if isinstance(category, str)
Obviously this check fails for your given 'B'.

Best
xqt

> Am 22.08.2020 um 14:32 schrieb Maarten Dammers :
> 
> 
> Hi Jean-Frédéric,
> 
> I see new_categories = ["B"] in your code. I believe this should be a list of 
> Category objects, not a list of strings.
> 
> Maarten
> 
> On 19-08-2020 21:48, Jean-Frédéric wrote:
>> Hi,
>> 
>> In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
>> 
>> Upgrading to latest version leads to two of my unit tests to fail [2]
>> (I’m not 100% sure, but I do believe the same errors popped up last time I 
>> tried upgrading in August 2019.)
>> 
>> The unit tests are at [3], the method tested at [4], and the stack trace at 
>> [5].
>> 
>> I have been digging a bit in the git history to understand what happened 
>> between August 2018 and August 2019 / August 2020 in textlib but nothing 
>> jumped.
>> 
>> Would anyone know what the change is caused by, and how I should update my 
>> code?
>> 
>> Thanks!
>> 
>> [1] https://phabricator.wikimedia.org/diffusion/THER/
>> [2] 
>> https://integration.wikimedia.org/ci/job/labs-tools-heritage-tox-docker/509/console
>> [3] 
>> https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_categorization.py$87-103
>> [4] 
>> https://phabricator.wikimedia.org/diffusion/THER/browse/master/erfgoedbot/categorize_images.py$252-264
>> [5] Stack trace:
>> ```
>>   File "/src/erfgoedbot/categorize_images.py", line 263, in 
>> replace_default_cat_with_new_categories_in_image_text
>> page_text_without_base_category, new_categories, addOnly=True)
>>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
>> line 1459, in replaceCategoryLinks
>> new_cats = categoryFormat(new, insite=site)
>>   File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py", 
>> line 1552, in categoryFormat
>> category = pywikibot.Category(category)
>>   File 
>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
>> line 1819, in wrapper
>> return obj(*__args, **__kw)
>>   File 
>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>> line 2879, in __init__
>> Page.__init__(self, source, title, ns=14)
>>   File 
>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py", 
>> line 1819, in wrapper
>> return obj(*__args, **__kw)
>>   File 
>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>> line 2392, in __init__
>> super(Page, self).__init__(source, title, ns)
>>   File 
>> "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py", 
>> line 221, in __init__
>> .format(type(source), source))
>> Error: Invalid argument type '' in Page initializer: B
>> ```
>> --
>> Jean-Frédéric
>> 
>> 
>> ___
>> pywikibot mailing list
>> pywikibot@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/pywikibot
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


Re: [pywikibot] Getting started with pywikibot

2020-08-17 Thread info
Hi Larry,

there are two way to use Pywikibot as a side package:
1. add a user-config.py in your /variant folder. A minimal sample can be found 
at 
https://gerrit.wikimedia.org/r/plugins/gitiles/pywikibot/core/+/88f22977fd186d888c4d9e8cbac11d76e87bd607/user-config.py.sample
2. or set a PYWIKIBOT_NO_USER_CONFIG environment variable to 1 or 2 to ignore 
user-config settings

The pwb.py script wrapper (as well as the generate_... scripts are available in 
directory mode only. You can get it including predefined scripts from nightly 
https://pywikibot.toolforge.org/ or as git repository from gerrit or from 
github clone https://github.com/wikimedia/pywikibot

Adding pwb.py and generate_user_files.py/generate_family_file.py to side 
oackage is still under development 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/560057

Seem our documentation is insufficient, sorry for that. If you have further 
questions do not hesitate to ask.

Best

xqt
> Am 17.08.2020 um 21:41 schrieb Larry Martell :
> 
> We have an internal wiki and I want to use pywikibot to get some data
> from it. Installed it from pip but when I import it I get:
> 
 import pywikibot
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "/usr/local/lib/python3.7/site-packages/pywikibot/__init__.py",
> line 25, in 
>from pywikibot.bot import (
>  File "/usr/local/lib/python3.7/site-packages/pywikibot/bot.py", line
> 105, in 
>from pywikibot import config2 as config
>  File "/usr/local/lib/python3.7/site-packages/pywikibot/config2.py",
> line 373, in 
>base_dir = get_base_dir()
>  File "/usr/local/lib/python3.7/site-packages/pywikibot/config2.py",
> line 367, in get_base_dir
>raise RuntimeError(exc_text)
> RuntimeError: No user-config.py found in directory '/vagrant'.
> 
> Looking here 
> https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation#Configure_Pywikibot
> 
> I see a reference to pwb.py, but that does not exist in
> /usr/local/lib/python3.7/site-packages/pywikibot.
> 
> What am I missing here?
> 
> Thanks!
> 
> ___
> pywikibot mailing list
> pywikibot@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
___
pywikibot mailing list
pywikibot@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot


  1   2   >