Sal976 | 13 Jul 2010 17:06

Problem with mwclient page.save and large text files


Hi,

I am using mwclient 0.6.4 (r93) to import some Wiki pages from en.wikipedia
to another wiki installation (presumably running Mediawiki 1.15). 

Everything works fine, except when I try to import 'big' pages, e.g.:

http://en.wikipedia.org/wiki/Grb2

content= Mediawiki text file to be imported (111579 characters in this case)

When I try to write this page (or pages of similar size), I get the
following error:

page = site.Pages['Grb2']
page.save(content)

Traceback:
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/mwclient/page.py", line 142, in
save
    result = do_edit()
  File "/usr/lib64/python2.6/site-packages/mwclient/page.py", line 137, in
do_edit
    **data)
  File "/usr/lib64/python2.6/site-packages/mwclient/client.py", line 165, in
api
    info = self.raw_api(action, **kwargs)
  File "/usr/lib64/python2.6/site-packages/mwclient/client.py", line 250, in
(Continue reading)

Roan Kattouw | 13 Jul 2010 17:20
Picon

Re: Problem with mwclient page.save and large text files

2010/7/13 Sal976 <salvatore.loguercio <at> googlemail.com>:
> I wonder if this error is due to server timeout or exceeding number of
> characters..
> Any suggestions?
>
It spends so much time parsing the wikitext you supplied that PHP's
max execution time limit was exceeded, which causes an empty (0-byte)
response. You can fix the error message by checking for a response of
length zero before you try to JSON-decode it.

Roan Kattouw (Catrope)
Salvatore Loguercio | 14 Jul 2010 10:39

Re: Problem with mwclient page.save and large text files


Thanks much for the quick answer, I see the problem now.
I wonder how these large wikitexts could be written on my target Wiki.
Is there a way to 'force' the PHP max execution time limit through the API?
If not, I guess I will have to contact a sysop..   

Roan Kattouw-2 wrote:
> 
> 2010/7/13 Sal976 <salvatore.loguercio <at> googlemail.com>:
>> I wonder if this error is due to server timeout or exceeding number of
>> characters..
>> Any suggestions?
>>
> It spends so much time parsing the wikitext you supplied that PHP's
> max execution time limit was exceeded, which causes an empty (0-byte)
> response. You can fix the error message by checking for a response of
> length zero before you try to JSON-decode it.
> 
> Roan Kattouw (Catrope)
> 
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api <at> lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
> 
> 

--

-- 
View this message in context: http://old.nabble.com/Problem-with-mwclient-page.save-and-large-text-files-tp29151604p29159629.html
Sent from the WikiMedia API mailing list archive at Nabble.com.
(Continue reading)

Roan Kattouw | 14 Jul 2010 12:22
Picon

Re: Problem with mwclient page.save and large text files

2010/7/14 Salvatore Loguercio <salvatore.loguercio <at> googlemail.com>:
>
> Thanks much for the quick answer, I see the problem now.
> I wonder how these large wikitexts could be written on my target Wiki.
> Is there a way to 'force' the PHP max execution time limit through the API?
> If not, I guess I will have to contact a sysop..
>
That would kind of defeat the purpose of the max execution time. AFAIK
the page should still have been saved, just not have been parsed
completely. You can check this in the history view.

You can ask a sysop to raise the max exec time, or to import these
large pages using the importTextFile.php maintenance script.

Roan Kattouw (Catrope)
Robert Ullmann | 14 Jul 2010 13:39
Picon

login from multiple (two) places?

Hi,

I haven't been able to figure this out from the doc ...

Can I log in a user (bot) from more than one place (IP address) at the
same time? I have an impending need to run Interwicket from more than
one place, as the primary will be unavailable at times. Is logging in
the other system going to log out the first, or some such? any bad
effects?

Robert
Roan Kattouw | 14 Jul 2010 13:55
Picon

Re: login from multiple (two) places?

2010/7/14 Robert Ullmann <rlullmann <at> gmail.com>:
> Hi,
>
> I haven't been able to figure this out from the doc ...
>
> Can I log in a user (bot) from more than one place (IP address) at the
> same time? I have an impending need to run Interwicket from more than
> one place, as the primary will be unavailable at times. Is logging in
> the other system going to log out the first, or some such? any bad
> effects?
>
I believe it will cause such an effect, yes. AFAIK the only reliable
way to be logged in in two places at once is to log in in one place
and transfer the information in the login cookies to the second place.

I think you should just try it and see what happens; worst case you
can detect you've been logged out and log in again, although that
might not be very nice if you run stuff simultaneously from two
places, as they'll spend a lot of time competing for logged-in status.

Roan Kattouw (Catrope)
Robert Ullmann | 14 Jul 2010 14:54
Picon

Re: login from multiple (two) places?

Interesting.

I log in from two places and I get different session identifiers (not
surprising), but the *same* token.

Apparently the problem is that if one logs out from anywhere, it
invalidates everywhere. Not too sure about the exact conditions,
because it is rather painful. (;-) But bots don't usually log out, so
that isn't an issue, they stay logged in for years.

Might be okay.

On Wed, Jul 14, 2010 at 2:55 PM, Roan Kattouw <roan.kattouw <at> gmail.com> wrote:
> 2010/7/14 Robert Ullmann <rlullmann <at> gmail.com>:
>> Hi,
>>
>> I haven't been able to figure this out from the doc ...
>>
>> Can I log in a user (bot) from more than one place (IP address) at the
>> same time? I have an impending need to run Interwicket from more than
>> one place, as the primary will be unavailable at times. Is logging in
>> the other system going to log out the first, or some such? any bad
>> effects?
>>
> I believe it will cause such an effect, yes. AFAIK the only reliable
> way to be logged in in two places at once is to log in in one place
> and transfer the information in the login cookies to the second place.
>
> I think you should just try it and see what happens; worst case you
> can detect you've been logged out and log in again, although that
(Continue reading)

Carl (CBM | 16 Jul 2010 05:37
Picon

Re: login from multiple (two) places?

On Wed, Jul 14, 2010 at 7:39 AM, Robert Ullmann <rlullmann <at> gmail.com> wrote:
> Can I log in a user (bot) from more than one place (IP address) at the
> same time?

Yes; it works fine.  I do it all the time with a script running on a
remote server at the same time I am logged in on my local computer. I
have never encountered any difficulties.

- Carl
rashi dhing | 18 Jul 2010 13:36
Picon

Mediawiki adds extra lines

Does anyone know how to remove the line breaks and the <p> and <pre> tags that mediawiki seems to add internally
while publishing a page. I am working on this project where any text added by the user in the wiki is processed and
transferred to an editor and while i am trying to maintain the alignment, mediawiki tends to add extra spaces and lines.
How can I take care of this ?

Thanks,

Rashi D.
 
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Python Script | 22 Jul 2010 23:09
Picon

how to set flags to on in the api?

I'm trying to edit a page, and the api documentation says to "set the flag to on" for items like the bot flag, minor flag, etc. How do I set these to on? I'm using a python interface to the api that has a format like "action":"edit" for post requests. I've tried "bot":"true" , "bot":"on" , "bot":"1" etc and I can't seem to get it to work. Thanks for the help!

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Gmane