I don't know how to edit the code. I'm a user of the existing scripts, with no changes.


I run my bot form WMFLabs.


Regards


Hercule




De : pywikibot <pywikibot-bounces@lists.wikimedia.org> de la part de Dalba <dalba.wiki@gmail.com>
Envoyé : mardi 29 mai 2018 16:42
À : Pywikibot discussion list
Objet : Re: [pywikibot] Bug on cosmetic changes
 
Seems like another bug. I'm not a python2 user and not sure why the code is
trying to convert the text to byte-string there. Could you try applying the
following change and see what happens?

--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -659,7 +659,7 @@ class CosmeticChangesToolkit(object):
                for template in skip_templates[self.site.code]:
                    skip_regexes.append(
                        re.compile(r'\{\{\s*%s\s*\}\}' % template, re.I))
-        stripped_text = str(text)
+        stripped_text = text
            for reg in skip_regexes:
                stripped_text = reg.sub(r'', stripped_text)

On Tue, May 29, 2018 at 6:40 PM Hercule Antoine<hercule.wikipedia@gmail.com>
wrote:

> I made an update of my pywikibot-core repository ( /usr/bin/git pullall)
and now I have an error when editing my User page for tests :

> Exception in thread Put-Thread:
> Traceback (most recent call last):
>      File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>        self.run()
>      File "/usr/lib/python2.7/threading.py", line 763, in run
>        self.__target(*self.__args, **self.__kwargs)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/__init__.py", line 1409, in async_manager
>        request(*args, **kwargs)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/page.py", line 109, in handle
>        func(self, *args, **kwargs)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/page.py", line 1278, in _save
>        summary = self._cosmetic_changes_hook(summary)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/page.py", line 1325, in _cosmetic_changes_hook
>        self.text = ccToolkit.change(old)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/cosmetic_changes.py", line 301, in change
>        new_text = self._change(text)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/cosmetic_changes.py", line 295, in _change
>        text = self.safe_execute(method, text)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/cosmetic_changes.py", line 282, in safe_execute
>        result = method(text)
>      File
"/mnt/nfs/labstore-secondary-tools-project/herculebot/pywikibot-core/pywi

                     kibot/cosmetic_changes.py", line 662, in
removeEmptySections
>        stripped_text = str(text)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in
position 78:
                                      ordinal not in range(128)

> Do I need to make something else ?

> 2018-05-29 15:58 GMT+02:00 Hercule Antoine <hercule.wikipedia@gmail.com>:

>> Hello,

>> It's possible, it's my third attempt to report this bug, on 3 different
lists.

>> Thank you for the information.

>> Regards

>> Hercule

>> 2018-05-29 15:54 GMT+02:00 Dalba <dalba.wiki@gmail.com>:

>>> Hi,
>>> It looks similar to T195075[1] which was marked was resolved almost two
>>> days ago.

>>> [1]: https://phabricator.wikimedia.org/T195075

>>> On Tue, May 29, 2018 at 6:12 PM Hercule Antoine
>>> <hercule.wikipedia@gmail.com>
>>> wrote:

>>> On Tue, May 29, 2018 at 6:12 PM Hercule Antoine
>>> <hercule.wikipedia@gmail.com>
>>> wrote:

>>> > Hello,

>>> > There is a big issue with the removal of empty sections by cosmetic
>>> changes.

>>> >
https://gerrit.wikimedia.org/r/#/c/433914/6/pywikibot/cosmetic_changes.py

>>> > It removes also non-empty sections, that starts and ends with HTML
>>> comments
>>> > See :


https://fr.wikipedia.org/w/index.php?title=S%C3%A9ries_t%C3%A9l%C3%A9vis%C3%A9es_diffus%C3%A9es_sur_American_Broadcasting_Company&diff=prev&oldid=148771218

>>> > This bug is, I think, critical because all changes with CC activated
must
>>> be verified.

>>> > I don't think that CC should remove comments added by editors.

>>> > I tried to open a bug on phabricator but don't understand how to do
it.

>>> > Regard
>>> > _______________________________________________
>>> > 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