[00:44:10] [telegram] @RachelFarrand - Goats are on the chopping block in English Wikipedia - https://en.wikipedia.org/wiki/MediaWiki_talk:WikiLove.js [07:08:40] [telegram] 币圈电报微信群炸群、电报群指定群私聊、Twitter/Facebook点赞加粉等 : https://tools-static.wmflabs.org/bridgebot/1d748f1a/file_1220.jpg [14:07:13] [telegram] hello! I'm trying some edits using pywikibot and regex but it seems that I can't use \n\:(A\p{L}*) as code [14:17:43] [telegram] what happens? [14:18:10] [telegram] Traceback (most recent call last): [14:18:10] [telegram] File "C:\Users\galde\core\pwb.py", line 297, in [14:18:12] [telegram] if not main(): [14:18:13] [telegram] File "C:\Users\galde\core\pwb.py", line 292, in main [14:18:15] [telegram] run_python_file(filename, [filename] + args, argvu, file_package) [14:18:16] [telegram] File "C:\Users\galde\core\pwb.py", line 96, in run_python_file [14:18:18] [telegram] main_mod.__dict__) [14:18:19] [telegram] File ".\scripts\replace.py", line 1211, in [14:18:21] [telegram] main() [14:18:22] [telegram] File ".\scripts\replace.py", line 1160, in main [14:18:24] [telegram] replacement.compile(regex, flags) [14:18:25] [telegram] File ".\scripts\replace.py", line 266, in compile [14:18:27] [telegram] self._compile(use_regex, flags) [14:18:28] [telegram] File ".\scripts\replace.py", line 304, in _compile [14:18:30] [telegram] super(Replacement, self)._compile(use_regex, flags) [14:18:31] [telegram] File ".\scripts\replace.py", line 252, in _compile [14:18:33] [telegram] self.old_regex = re.compile(self.old_regex, flags) [14:18:34] [telegram] File "C:\Python37-32\lib\re.py", line 234, in compile [14:18:36] [telegram] return _compile(pattern, flags) [14:18:37] [telegram] File "C:\Python37-32\lib\re.py", line 286, in _compile [14:18:39] [telegram] p = sre_compile.compile(pattern, flags) [14:18:40] [telegram] File "C:\Python37-32\lib\sre_compile.py", line 764, in compile [14:18:42] [telegram] p = sre_parse.parse(p, flags) [14:18:43] [telegram] File "C:\Python37-32\lib\sre_parse.py", line 930, in parse [14:18:45] [telegram] p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0) [14:18:46] [telegram] File "C:\Python37-32\lib\sre_parse.py", line 426, in _parse_sub [14:18:48] [telegram] not nested and not items)) [14:18:49] [telegram] File "C:\Python37-32\lib\sre_parse.py", line 816, in _parse [14:18:51] [telegram] p = _parse_sub(source, state, sub_verbose, nested + 1) [14:18:52] [telegram] File "C:\Python37-32\lib\sre_parse.py", line 426, in _parse_sub [14:18:54] [telegram] not nested and not items)) [14:18:58] [telegram] ah, the Unicode classes... I think there's another python regex module that supports those [14:20:26] [telegram] Galder You can test your regex in https://regex101.com/ (choose Python for your flavour in the sidebar) [14:21:05] [telegram] https://pypi.org/project/regex/ seems to be what I'm thinking of [14:21:34] [telegram] Wouldn't that require changing how pywikibot itself handles regex? Could get complicated quickly (re @Nikki: https://pypi.org/project/regex/ seems to be what I'm thinking of) [14:21:59] [telegram] the regex is correct, but pywikibot can't handle the \p{L} part [14:22:47] [telegram] is there another pywikibot? I've only used it by loading it in my own scripts [14:22:56] [telegram] or it could be as simple as changing import re to import as re in a strategic place, i don't know how intercompatible that is [14:24:10] [telegram] either way it says "This regex implementation is backwards-compatible with the standard ‘re’ module, but offers additional functionality." so I assume you can just "re" with "regex" after installing it [14:28:08] [telegram] so... do I need to install something? [14:31:38] [telegram] because updating regex didn't work [14:39:15] [telegram] I can make it by hand using \n\:(A[a-záéíóúàèìòùſ]*), but this is not the best solution [14:40:32] [telegram] if you want to use the regex module, you'd need to install it, yes. I can't really help with that though, I'm not at the computer and I'm also not that familiar with python [14:51:56] [telegram] I saw that! It’s so sad. 🐐 (re @fuzheado: @RachelFarrand - Goats are on the chopping block in English Wikipedia - https://en.wikipedia.org/wiki/MediaWiki_talk:WikiLove.js) [15:40:56] [telegram] pip install regex should install the module, and then the script can import regex [16:22:55] [telegram] I have taken a bold stand - I saw that! It’s so sad. 🐐 (re @RachelFarrand: I saw that! It’s so sad. 🐐) [16:23:12] [telegram] I have taken a bold stand - 🐐- https://en.wikipedia.org/w/index.php?title=MediaWiki_talk:WikiLove.js&diff=986720653&oldid=986619884&diffmode=source (re @RachelFarrand: I saw that! It’s so sad. 🐐) [16:40:43] [telegram] hahahhhahahah!! "Can you milk cats? Do cats provide fibers and textiles for Brooklyn hipsters? Can they methodically clear unwanted vegetation? Do they comically faint when scared? There should be a place in this world for both cats and goats. Hircine and caprine are right on the cusp of being household words." You make some very excellent points [17:02:23] [telegram] No! (re @edoderoo: pip install regex should install the module, and then the script can import regex) [17:04:10] [telegram] What exactly are you typing? (re @Galder: No!) [17:04:50] [telegram] Pip install regex. But the error remains [17:05:37] [telegram] I can insert the special characters I have in the text, but for Wikimedia it would be especially important to have all kind of characters included [17:06:41] [telegram] What are you typing to get the error, what are you running? [17:24:49] [telegram] This (re @Galder: hello! I'm trying some edits using pywikibot and regex but it seems that I can't use \n\:(A\p{L}*) as code) [17:25:40] [telegram] that is not a command Galder. are you just typing \n\:(A\p{L}*) in the command prompt? [17:26:29] [telegram] Pwb.py replace.py -regex -file:xxxx [17:26:59] [telegram] And then when asked the previous line [17:32:49] [telegram] then, if you edit replace.py you should be good [17:33:30] [telegram] line 144 should read import regex as re currently it should just be import re https://gerrit.wikimedia.org/g/pywikibot/core/+/HEAD/scripts/replace.py#144 [17:34:14] [telegram] you must install regex with pip install regex before, but you said that is done. (re @Galder: Pip install regex. But the error remains) [17:43:41] [telegram] Thanks (re @chicocvenancio: line 144 should read import regex as re currently it should just be import re https://gerrit.wikimedia.org/g/pywikibot/core/+/HEAD/scripts/replace.py#144) [17:44:07] [telegram] you're welcome [17:45:48] [telegram] This should be in a terminal, not in your python script (re @edoderoo: pip install regex should install the module, and then the script can import regex) [22:18:20] [telegram] \n\:(A[^\s]*) [22:18:21] [telegram] That probably works (re @Galder: I can make it by hand using \n\:(A[a-záéíóúàèìòùſ]*), but this is not the best solution)