Page MenuHomePhabricator

welcome.py does not work for ar.wikinews
Closed, ResolvedPublic

Description

When using welcome.py (core version) on Wikimedia Labs to welcome new users on Arabic Wikinews (arwikinews), it does not work and gives the error:

Traceback (most recent call last):
  File "welcome.py", line 192, in <module>
    import pywikibot
ImportError: No module named pywikibot

My command was:

python welcome.py -edit:0 -nlog -sul -limit:500 -lang:ar -family:wikinews

The compat version of the script works normally.

Event Timeline

Meno25 created this task.Aug 7 2015, 6:52 AM
Meno25 raised the priority of this task from to Needs Triage.
Meno25 updated the task description. (Show Details)
Meno25 added a project: Pywikibot.
Meno25 added a subscriber: Meno25.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptAug 7 2015, 6:52 AM
jayvdb added a subscriber: jayvdb.Aug 7 2015, 9:00 AM

Try: python pwb.py welcome ...

XZise updated the task description. (Show Details)Aug 7 2015, 9:03 AM
XZise set Security to None.

Try: python pwb.py welcome ...

I did and the result was

1Script to welcome new users.
2
3This script works out of the box for Wikis that
4have been defined in the script. It is currently used on the Dutch, Norwegian,
5Albanian, Italian Wikipedia, Wikimedia Commons and English Wikiquote.
6
7Ensure you have community support before running this bot!
8
9URLs to current implementations:
10* Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:Welcome_log
11* Dutch Wikipedia: https://nl.wikipedia.org/wiki/Wikipedia:Logboek_welkom
12* Italian Wikipedia: https://it.wikipedia.org/wiki/Wikipedia:Benvenuto_log
13* English Wikiquote: https://en.wikiquote.org/wiki/Wikiquote:Welcome_log
14* Persian Wikipedia: https://fa.wikipedia.org/wiki/ویکی‌پدیا:سیاهه_خوشامد
15* Korean Wikipedia: https://ko.wikipedia.org/wiki/위키백과:Welcome_log
16
17Everything that needs customisation to support additional projects is
18indicated by comments.
19
20Description of basic functionality:
21* Request a list of new users every period (default: 3600 seconds)
22 You can choose to break the script after the first check (see arguments)
23* Check if new user has passed a threshold for a number of edits
24 (default: 1 edit)
25* Optional: check username for bad words in the username or if the username
26 consists solely of numbers; log this somewhere on the wiki (default: False)
27 Update: Added a whitelist (explanation below).
28* If user has made enough edits (it can be also 0), check if user has an empty
29 talk page
30* If user has an empty talk page, add a welcome message.
31* Optional: Once the set number of users have been welcomed, add this to the
32 configured log page, one for each day (default: True)
33* If no log page exists, create a header for the log page first.
34
35This script (by default not yet implemented) uses two templates that need to
36be on the local wiki:
37* {{WLE}}: contains mark up code for log entries (just copy it from Commons)
38* {{welcome}}: contains the information for new users
39
40This script understands the following command-line arguments:
41
42 -edit[:#] Define how many edits a new user needs to be welcomed
43 (default: 1, max: 50)
44
45 -time[:#] Define how many seconds the bot sleeps before restart
46 (default: 3600)
47
48 -break Use it if you don't want that the Bot restart at the end
49 (it will break) (default: False)
50
51 -nlog Use this parameter if you do not want the bot to log all
52 welcomed users (default: False)
53
54 -limit[:#] Use this parameter to define how may users should be
55 checked (default:50)
56
57 -offset[:TIME] Skip the latest new users (those newer than TIME)
58 to give interactive users a chance to welcome the
59 new users (default: now)
60 Timezone is the server timezone, GMT for Wikimedia
61 TIME format : yyyymmddhhmmss
62
63 -timeoffset[:#] Skip the latest new users, accounts newer than
64 # minutes
65
66 -numberlog[:#] The number of users to welcome before refreshing the
67 welcome log (default: 4)
68
69 -filter Enable the username checks for bad names (default: False)
70
71 -ask Use this parameter if you want to confirm each possible
72 bad username (default: False)
73
74 -random Use a random signature, taking the signatures from a wiki
75 page (for instruction, see below).
76
77 -file[:#] Use a file instead of a wikipage to take the random sign.
78 If you use this parameter, you don't need to use -random.
79
80 -sign Use one signature from command line instead of the default
81
82 -savedata This feature saves the random signature index to allow to
83 continue to welcome with the last signature used.
84
85 -sul Welcome the auto-created users (default: False)
86
87 -quiet Prevents users without contributions are displayed
88
89 -quick Provide quick check by API bulk-retrieve user datas
90
91********************************* GUIDE ***********************************
92
93Report, Bad and white list guide:
94
951) Set in the code which page it will use to load the badword, the
96 whitelist and the report
972) In these page you have to add a "tuple" with the names that you want to
98 add in the two list. For example: ('cat', 'mouse', 'dog')
99 You can write also other text in the page, it will work without problem.
1003) What will do the two pages? Well, the Bot will check if a badword is in
101 the username and set the "warning" as True. Then the Bot check if a word
102 of the whitelist is in the username. If yes it remove the word and
103 recheck in the bad word list to see if there are other badword in the
104 username.
105 Example:
106 * dio is a badword
107 * Claudio is a normal name
108 * The username is "Claudio90 fuck!"
109 * The Bot finds dio and sets "warning"
110 * The Bot finds Claudio and sets "ok"
111 * The Bot finds fuck at the end and sets "warning"
112 * Result: The username is reported.
1134) When a user is reported you have to check him and do:
114 * If he's ok, put the {{welcome}}
115 * If he's not, block him
116 * You can decide to put a "you are blocked, change another username"
117 template or not.
118 * Delete the username from the page.
119 IMPORTANT : The Bot check the user in this order:
120 * Search if he has a talkpage (if yes, skip)
121 * Search if he's blocked, if yes he will be skipped
122 * Search if he's in the report page, if yes he will be skipped
123 * If no, he will be reported.
124
125Random signature guide:
126
127Some welcomed users will answer to the one who has signed the welcome message.
128When you welcome many new users, you might be overwhelmed with such answers.
129Therefore you can define usernames of other users who are willing to receive
130some of these messages from newbies.
131
1321) Set the page that the bot will load
1332) Add the signatures in this way:
134
135*<SPACE>SIGNATURE
136<NEW LINE>
137
138Example:
139<pre>
140* [[User:Filnik|Filnik]]
141* [[User:Rock|Rock]]
142</pre>
143
144NOTE: The white space and <pre></pre> aren't required but I suggest you to
145 use them.
146
147*************************** Known issues/FIXMEs ****************************
148* *
149* The regex to load the user might be slightly different from project to *
150* project. (In this case, write to Filnik or the PWRF for help...) *
151* Use a class to group toghether the functions used. *
152* *
153******************************** Badwords **********************************
154
155The list of Badwords of the code is opened. If you think that a word is
156international and it must be blocked in all the projects feel free to add it.
157If also you think that a word isn't so international, feel free to delete it.
158
159However, there is a dinamic-wikipage to load that badwords of your project or
160you can add them directly in the source code that you are using without adding
161or deleting.
162
163Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't
164badword at all but can be used for some bad-nickname.
165
166
167Global arguments available for all bots:
168
169-dir:PATH Read the bot's configuration data from directory given by
170 PATH, instead of from the default directory.
171
172-lang:xx Set the language of the wiki you want to work on, overriding
173 the configuration in user-config.py. xx should be the
174 language code.
175
176-family:xyz Set the family of the wiki you want to work on, e.g.
177 wikipedia, wiktionary, wikitravel, ...
178 This will override the configuration in user-config.py.
179
180-user:xyz Log in as user 'xyz' instead of the default username.
181
182-daemonize:xyz Immediately return control to the terminal and redirect
183 stdout and stderr to file xyz.
184 (only use for bots that require no input from stdin).
185
186-help Show this help text.
187
188-log Enable the log file, using the default filename
189 'welcome-bot.log'
190 Logs will be stored in the logs subdirectory.
191
192-log:xyz Enable the log file, using 'xyz' as the filename.
193
194-nolog Disable the log file (if it is enabled by default).
195
196-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot
197 edits during periods of database server lag. Default is set by
198 config.py
199
200-putthrottle:n Set the minimum time (in seconds) the bot will wait between
201-pt:n saving pages.
202-put_throttle:n
203
204-debug:item Enable the log file and include extensive debugging data
205-debug for component "item" (for all components if the second form
206 is used).
207
208-verbose Have the bot provide additional console output that may be
209-v useful in debugging.
210
211-cosmeticchanges Toggles the cosmetic_changes setting made in config.py or
212-cc user_config.py to its inverse and overrules it. All other
213 settings and restrictions are untouched.
214
215-simulate Disables writing to the server. Useful for testing and
216 debugging of new code (if given, doesn't do any real
217 changes, but only shows what would have been changed).
218
219-<config var>:n You may use all given numeric config variables as option and
220 modify it with command line.
221
222
223WARNING: u'Site wikinews:ar not managed by welcome.py: lang "ar" missing in nete xt[wikinews].'
224meno25@tools-bastion-01:~/core$ python pwb.py welcome -edit:0 -nlog -sul -limit:500 -lang:ar -family:wikinews
225
226Script to welcome new users.
227
228This script works out of the box for Wikis that
229have been defined in the script. It is currently used on the Dutch, Norwegian,
230Albanian, Italian Wikipedia, Wikimedia Commons and English Wikiquote.
231
232Ensure you have community support before running this bot!
233
234URLs to current implementations:
235* Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:Welcome_log
236* Dutch Wikipedia: https://nl.wikipedia.org/wiki/Wikipedia:Logboek_welkom
237* Italian Wikipedia: https://it.wikipedia.org/wiki/Wikipedia:Benvenuto_log
238* English Wikiquote: https://en.wikiquote.org/wiki/Wikiquote:Welcome_log
239* Persian Wikipedia: https://fa.wikipedia.org/wiki/ویکی‌پدیا:سیاهه_خوشامد
240* Korean Wikipedia: https://ko.wikipedia.org/wiki/위키백과:Welcome_log
241
242Everything that needs customisation to support additional projects is
243indicated by comments.
244
245Description of basic functionality:
246* Request a list of new users every period (default: 3600 seconds)
247 You can choose to break the script after the first check (see arguments)
248* Check if new user has passed a threshold for a number of edits
249 (default: 1 edit)
250* Optional: check username for bad words in the username or if the username
251 consists solely of numbers; log this somewhere on the wiki (default: False)
252 Update: Added a whitelist (explanation below).
253* If user has made enough edits (it can be also 0), check if user has an empty
254 talk page
255* If user has an empty talk page, add a welcome message.
256* Optional: Once the set number of users have been welcomed, add this to the
257 configured log page, one for each day (default: True)
258* If no log page exists, create a header for the log page first.
259
260This script (by default not yet implemented) uses two templates that need to
261be on the local wiki:
262* {{WLE}}: contains mark up code for log entries (just copy it from Commons)
263* {{welcome}}: contains the information for new users
264
265This script understands the following command-line arguments:
266
267 -edit[:#] Define how many edits a new user needs to be welcomed
268 (default: 1, max: 50)
269
270 -time[:#] Define how many seconds the bot sleeps before restart
271 (default: 3600)
272
273 -break Use it if you don't want that the Bot restart at the end
274 (it will break) (default: False)
275
276 -nlog Use this parameter if you do not want the bot to log all
277 welcomed users (default: False)
278
279 -limit[:#] Use this parameter to define how may users should be
280 checked (default:50)
281
282 -offset[:TIME] Skip the latest new users (those newer than TIME)
283 to give interactive users a chance to welcome the
284 new users (default: now)
285 Timezone is the server timezone, GMT for Wikimedia
286 TIME format : yyyymmddhhmmss
287
288 -timeoffset[:#] Skip the latest new users, accounts newer than
289 # minutes
290
291 -numberlog[:#] The number of users to welcome before refreshing the
292 welcome log (default: 4)
293
294 -filter Enable the username checks for bad names (default: False)
295
296 -ask Use this parameter if you want to confirm each possible
297 bad username (default: False)
298
299 -random Use a random signature, taking the signatures from a wiki
300 page (for instruction, see below).
301
302 -file[:#] Use a file instead of a wikipage to take the random sign.
303 If you use this parameter, you don't need to use -random.
304
305 -sign Use one signature from command line instead of the default
306
307 -savedata This feature saves the random signature index to allow to
308 continue to welcome with the last signature used.
309
310 -sul Welcome the auto-created users (default: False)
311
312 -quiet Prevents users without contributions are displayed
313
314 -quick Provide quick check by API bulk-retrieve user datas
315
316********************************* GUIDE ***********************************
317
318Report, Bad and white list guide:
319
3201) Set in the code which page it will use to load the badword, the
321 whitelist and the report
3222) In these page you have to add a "tuple" with the names that you want to
323 add in the two list. For example: ('cat', 'mouse', 'dog')
324 You can write also other text in the page, it will work without problem.
3253) What will do the two pages? Well, the Bot will check if a badword is in
326 the username and set the "warning" as True. Then the Bot check if a word
327 of the whitelist is in the username. If yes it remove the word and
328 recheck in the bad word list to see if there are other badword in the
329 username.
330 Example:
331 * dio is a badword
332 * Claudio is a normal name
333 * The username is "Claudio90 fuck!"
334 * The Bot finds dio and sets "warning"
335 * The Bot finds Claudio and sets "ok"
336 * The Bot finds fuck at the end and sets "warning"
337 * Result: The username is reported.
3384) When a user is reported you have to check him and do:
339 * If he's ok, put the {{welcome}}
340 * If he's not, block him
341 * You can decide to put a "you are blocked, change another username"
342 template or not.
343 * Delete the username from the page.
344 IMPORTANT : The Bot check the user in this order:
345 * Search if he has a talkpage (if yes, skip)
346 * Search if he's blocked, if yes he will be skipped
347 * Search if he's in the report page, if yes he will be skipped
348 * If no, he will be reported.
349
350Random signature guide:
351
352Some welcomed users will answer to the one who has signed the welcome message.
353When you welcome many new users, you might be overwhelmed with such answers.
354Therefore you can define usernames of other users who are willing to receive
355some of these messages from newbies.
356
3571) Set the page that the bot will load
3582) Add the signatures in this way:
359
360*<SPACE>SIGNATURE
361<NEW LINE>
362
363Example:
364<pre>
365* [[User:Filnik|Filnik]]
366* [[User:Rock|Rock]]
367</pre>
368
369NOTE: The white space and <pre></pre> aren't required but I suggest you to
370 use them.
371
372*************************** Known issues/FIXMEs ****************************
373* *
374* The regex to load the user might be slightly different from project to *
375* project. (In this case, write to Filnik or the PWRF for help...) *
376* Use a class to group toghether the functions used. *
377* *
378******************************** Badwords **********************************
379
380The list of Badwords of the code is opened. If you think that a word is
381international and it must be blocked in all the projects feel free to add it.
382If also you think that a word isn't so international, feel free to delete it.
383
384However, there is a dinamic-wikipage to load that badwords of your project or
385you can add them directly in the source code that you are using without adding
386or deleting.
387
388Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't
389badword at all but can be used for some bad-nickname.
390
391
392Global arguments available for all bots:
393
394-dir:PATH Read the bot's configuration data from directory given by
395 PATH, instead of from the default directory.
396
397-lang:xx Set the language of the wiki you want to work on, overriding
398 the configuration in user-config.py. xx should be the
399 language code.
400
401-family:xyz Set the family of the wiki you want to work on, e.g.
402 wikipedia, wiktionary, wikitravel, ...
403 This will override the configuration in user-config.py.
404
405-user:xyz Log in as user 'xyz' instead of the default username.
406
407-daemonize:xyz Immediately return control to the terminal and redirect
408 stdout and stderr to file xyz.
409 (only use for bots that require no input from stdin).
410
411-help Show this help text.
412
413-log Enable the log file, using the default filename
414 'welcome-bot.log'
415 Logs will be stored in the logs subdirectory.
416
417-log:xyz Enable the log file, using 'xyz' as the filename.
418
419-nolog Disable the log file (if it is enabled by default).
420
421-maxlag Sets a new maxlag parameter to a number of seconds. Defer bot
422 edits during periods of database server lag. Default is set by
423 config.py
424
425-putthrottle:n Set the minimum time (in seconds) the bot will wait between
426-pt:n saving pages.
427-put_throttle:n
428
429-debug:item Enable the log file and include extensive debugging data
430-debug for component "item" (for all components if the second form
431 is used).
432
433-verbose Have the bot provide additional console output that may be
434-v useful in debugging.
435
436-cosmeticchanges Toggles the cosmetic_changes setting made in config.py or
437-cc user_config.py to its inverse and overrules it. All other
438 settings and restrictions are untouched.
439
440-simulate Disables writing to the server. Useful for testing and
441 debugging of new code (if given, doesn't do any real
442 changes, but only shows what would have been changed).
443
444-<config var>:n You may use all given numeric config variables as option and
445 modify it with command line.
446
447
448WARNING: u'Site wikinews:ar not managed by welcome.py: lang "ar" missing in netext[wikinews].'

jayvdb renamed this task from welcome.py (core) does not work to welcome.py does not work for ar.wikinews.Aug 7 2015, 11:20 AM
XZise added a subscriber: XZise.Aug 7 2015, 11:22 AM

This could be solved then with T104821 by adding the configuration variables on the site (without changing the script's source code).

Xqt closed this task as Resolved.Jan 25 2016, 2:04 PM
Xqt claimed this task.
Xqt added a subscriber: Xqt.
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptJan 25 2016, 2:04 PM