Do you have example code using pywikibot and mwparserfromhell?

Do you have example code using pywikibot and mwparserfromhell?

Your MewBot code doesn't use mwparserfromhell and its template-parsing code is fragile (it will break e.g. with embedded links with | in them).

Benwing (talk)00:18, 6 October 2014

It does, actually. Where is it breaking?

CodeCat00:18, 6 October 2014

I'm looking at the source code you've posted. It's (c) 2013 so maybe you've updated the actual code. There's no import that looks like mwparserfromhell, and you parse templates in getTemplate() in formbot.py using regexps (which will break with embedded templates) and break up params in parseTemplate() using split on '|'.

Benwing (talk)00:22, 6 October 2014

That code is only for the part that creates inflection entries. But I haven't run that in some time, mainly because it's so much work to convert it all to use mwparserfromhell. What I run now is mainly small, purpose-built scripts that are backed by pywikibot, mwparserfromhell and a small support library I wrote.

CodeCat00:24, 6 October 2014

Where is your current code available?

Benwing (talk)00:24, 6 October 2014

It's not available anywhere. Most of it is not worth keeping as it's used once and then deleted.

CodeCat00:27, 6 October 2014

Can you make some code available to me? I'm looking for sample code that uses pywikibot and mwparserfromhell, esp. since the former isn't documented anywhere that I can see. It doesn't matter if it's "temporary" code.

Benwing (talk)00:31, 6 October 2014
Edited by another user.
Last edit: 00:49, 6 October 2014

Ok, I've made some available at User:Benwing/arhead.py. It's the script I used to update the Arabic entries.

CodeCat00:35, 6 October 2014

Thanks. What is blib? Is that a library of yours? Can you make it available? And where is the code that actually calls pywikibot? You import it but don't use it in the little snippet you posted. I'm looking for code that's complete enough that I can modify it to implement something useful. Thanks again.

Benwing (talk)00:50, 6 October 2014

I've included User:Benwing/blib.py now. I only recently converted to the newest version of pywikibot, which may have broken some things that I haven't fixed yet.

CodeCat00:53, 6 October 2014

Thanks again! I'll take a look at it.

Benwing (talk)05:21, 6 October 2014