[Labs-l] Scripts which adds template to articles created by ContentTranslation tool do not work on the grid
Martin Urbanec
martin.urbanec at wikimedia.cz
Fri Jun 16 17:10:38 UTC 2017
I can't, the script is Python3 only.
Martin
pá 16. 6. 2017 v 19:04 odesílatel MarcoAurelio <strigiwm at gmail.com> napsal:
> It's being some time I was not in the list and I've missed important
> announcements for sure but last time I checked Python 3 was still not
> supported by Labs. I mean, the shared pywikibot files where still in Python
> 2. Not sure if this is still the case but could you please try to run in on
> the grid with python instead of python3 and see if that solves the issue?
> Regards.
>
> El El vie, 16 jun 2017 a las 18:16, Martin Urbanec <
> martin.urbanec at wikimedia.cz> escribió:
>
>> Hello,
>>
>> I have a script which should add a template to articles which are created
>> by the ContentTranslation tool (the template has parameters which depends
>> on language and revision which were used as the source one; this is the
>> reason why I use separate script). It may be found at
>> https://github.com/urbanecm/addPrekladCT/blob/master/addmissing.py. The
>> script work perfectly on my local PC and on bastion host but I can't get it
>> work on the grid.
>>
>> The script itself is run by *python3 addmissing.py -always
>> -file:pages.txt -search:'-insource:/\{\{[Pp]řeklad/'* and require
>> pages.txt file and preklads.txt file at
>> https://tools.wmflabs.org/urbanecmbot/test/preklads.txt. The first
>> contains pages that should be processed and act as the generator, the
>> second one is something like a database with exact templates which should
>> be inserted. Both files are as an example in the attachments.
>>
>> When I try to run it at toollabs bastion, all works as it should. When I
>> send the script to grid, it do not work (see sample output below). Why? Can
>> somebody help me with it?
>>
>> Thank you in advance,
>> Martin Urbanec / Urbanecm
>>
>> ; Output
>>
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $ cat test.sh
>> python3 addmissing.py -always -file:pages.txt
>> -search:'-insource:/\{\{[Pp]řeklad/'
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $ jsub bash test.sh
>> Your job 6201363 ("bash") has been submitted
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $ qstat
>> job-ID prior name user state submit/start at queue
>> slots ja-task-ID
>>
>> -----------------------------------------------------------------------------------------------------------------
>> 6201363 0.30000 bash urbanecm r 06/16/2017 18:14:42
>> task at tools-exec-1404.eqiad.wmf 1
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $ ls ~/bash.*
>> /home/urbanecm/bash.err /home/urbanecm/bash.out
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $ cat ~/bash.*
>> Traceback (most recent call last):
>> File "addmissing.py", line 223, in <module>
>> main()
>> File "addmissing.py", line 183, in main
>> local_args = pywikibot.handle_args(args)
>> File "/shared/pywikipedia/core/pywikibot/bot.py", line 954, in
>> handle_args
>> writeToCommandLogFile()
>> File "/shared/pywikipedia/core/pywikibot/bot.py", line 1128, in
>> writeToCommandLogFile
>> command_log_file.write(s + os.linesep)
>> File "/usr/lib/python3.4/codecs.py", line 711, in write
>> return self.writer.write(data)
>> File "/usr/lib/python3.4/codecs.py", line 368, in write
>> data, consumed = self.encode(object, self.errors)
>> UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc5' in
>> position 67: surrogates not allowed
>> CRITICAL: Closing network session.
>> <class 'UnicodeEncodeError'>
>> urbanecm at tools-bastion-02 ~/Documents/cswiki/addPrekladCT
>> $
>>
> _______________________________________________
>> Labs-l mailing list
>> Labs-l at lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/labs-l
>>
> --
> M. A.
> _______________________________________________
> Labs-l mailing list
> Labs-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/labs-l
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/labs-l/attachments/20170616/75b99706/attachment-0001.html>
More information about the Labs-l
mailing list