Hello!
I'm an user of pywikipedia and I'm going to answer to your questions. I hope my answers are satisfatory.


Da: "Lee Francis Wilhelmsen" <lee.francis.wilhelmsen@gmail.com>
Data: 18 febbraio 2008 23:50:02 GMT+01:00
A: pywikipedia-l@lists.wikimedia.org
Oggetto: [Pywikipedia-l] Logging Pywikipedia output


Hi

I am using standard python logging for my project. This project uses
Pywikipedia and runs as a cron job every night. It therefore needs to
log to a file and possibly any other configured log handler (mail,
syslog etc).

However, looking at wikipedia.py it seems Pywikipedia does not use any
kind of logging facility meaning that messages created by the tool are
lost if not piped to a output file.

Have the developers of this helpful tool considered or discussed using
standard Python logging for Pywikipedia instead print statements?
Maybe I am missing something? It would be helpful to be able to
configure a dedicated logger for the Pywikipedia output messages for
debugging a production environment.

Regards
Lee Francis

-- 
_____
In theory, there is no difference between theory and practice. But, in
practice, there is.
-- Jan L.A. van de Snepscheut



You should replace all the calls to the Python statement "print" to "wikipedia.output()". For example:
print "Foo"
becomes:
wikipedia.output("Foo")

Now you can use the "-log" option to log the output of your script to a file:
python my_bot_script.py -log:logs/my_bot_script.log

Of course you need to add "wikipedia.handleArgs()" at the beginning of your script so pywikipedia can handle the shell parameters (e.g. -log).


Da: "Lee Francis Wilhelmsen" <lee.francis.wilhelmsen@gmail.com>
Data: 19 febbraio 2008 10:17:29 GMT+01:00
A: pywikipedia-l@lists.wikimedia.org
Oggetto: [Pywikipedia-l] Reducing sleep time


Hi

I am uploading a lot of documents to my local wiki. However,
Pywikipedia is sleeping for nearly 10 seconds between calls to
page.put(...). For large amounts of files this is quite noticeable.

  "Sleeping for 9.3 seconds, 2008-02-19 10:06:45"
  "Creating page [[en:<something>]]"

Can someone briefly explain why this sleep time is necessary and also
how to reduce it (eliminate it?) if possible. I am thinking there is a
story here... :-)

I think I saw a script somewhere tackling a similar problem, but I
can't seem to find it now.

Regards
Lee Francis

-- 
_____
In theory, there is no difference between theory and practice. But, in
practice, there is.
-- Jan L.A. van de Snepscheut




_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l


You can reduce this sleep time by setting the "put_throttle" variable in user-config.py.
From the lines in config.py:
# Slow down the robot such that it never makes a second change within
# 'put_throttle' seconds.
put_throttle = 10

You should set the "put_throttle" variable to the number of seconds that you like.
If you are editing on a Wikimedia wiki, I suggest you not to change this variable, as this can increase the load on Wikimedia servers.
Remember, you shouldn't set this variable directly in config.py, you should set it in user-config.py.

Regards
Pietrodn
powerpdn@gmail.com