Manual talk:Pywikibot

Jump to: navigation, search

About this board

Archives 


Please use one of the communication channels listed on Manual:Pywikibot/Communication rather than using this discussion board. There is very little traffic here, so it may take a while before you get a response.

Why Pywikibot marks my edits as minor edits?

3
Fructibus (talkcontribs)

I am running Pywikibot/category.py at this moment, adding a category to a list of files.

I just noticed that the edits of my bot ( commons:Special:Contributions/Fructibot ) are marked as minor edits. Why is that and how can I fix it?

Xqt (talkcontribs)

The reason is that bot edits normally should not be shown on user's watch list. This is done by this flag. The minor flag could be set on pywikibot.put() with minorEdit=False parameter or on pywikibot.save() method with minor=False parameter. But use it with care not to disturb other users flooding their watch lists.

Fructibus (talkcontribs)

Ahh, I see now, I was worried that maybe the robot is supposed to make normal edits, not minor edits, and therefore maybe I did something wrong. Thank you very much!

87.0.79.89 (talkcontribs)

Hi,

I need a script that:

1) Select pages that are in a specific category

2) Delete in those pages an old template with its parameters (that could also be sub-templates); the template is the same, but the content is different for all, so I can't specify manually the text

3) And replace it with a text (a new template with standard content for all)

It's possible? I see something in ''replace.py'' (point 1 and 3), but I'm not sure it can do the 2nd; and it seems that ''template.py'' can only replace the template name.

Glz19

Xqt (talkcontribs)

Try template.py script.

Glz19 (talkcontribs)

Thank you for the answer. It's possible with it selecting a category, for work only on pages in it? I read the documentation page but I can't see it.

Xqt (talkcontribs)

All scripts have a documentation with it. Just use -help option. In your case -cat:<categoryname> should do it.

Reply to "Replacing template with text"
Walter Klosse (talkcontribs)

How i make pagegenerator for category on wikipedia in czech language?

Framawiki (talkcontribs)

Hello, do you want something like

python pwb.py replace "1" "2" -lang:cz -category:test

?

Dvorapa (talkcontribs)

correct is -lang:cs

Reply to "Pagegenerator in different language."
KlosseBot (talkcontribs)

CMD writing no module named pywikibot when i start login.py

Xqt (talkcontribs)

Looks like your cmd has opened the "../core/scripts" path. You should start from parent "core" path and use the pwb.py wrapper script:

pwb.py login

2A00:1028:9192:FA72:F903:A911:3814:C073 (talkcontribs)

And when i write python pwb.py login it said no module named request.

Xqt (talkcontribs)

You have to install request module as a side package first. Read the message and do as proposed. The message is:

Python module 'requests' is required.

Try running 'pip install requests'

do it with the command

pip install requests

188.23.125.244 (talkcontribs)

I executed "pip install requests", it did so, but the same error doesn't go away. I tried both Python 3.6 and 2.7, it's the same with both.

Framawiki (talkcontribs)

Hello, can you type python pwb.py version and post here what you obtain ?

188.23.125.244 (talkcontribs)

This doesn't even work for me, as it gets an error in line 163 of pwb.py

Xqt (talkcontribs)

Did you installed requests for both python releases?

88.117.63.15 (talkcontribs)

I installed 2.7 after trying 3.6. I eventually got things to work after installing pip seperately again and then installing requests via "pip install requests" and restarting. I may have repeated this some times and can't pinpoint what got things to work, but i eventually got it to work.

KlosseBot (talkcontribs)

'pip install requests' doesnt work

Xqt (talkcontribs)

What is your python version? I propose using 2.7.9 or higher or 3.4 or higher release because the en:python package installer (pip) is shipped with these versions. Otherwise you have to install pip first.

KlosseBot (talkcontribs)

I have 3.4 but still it isnt pip in it. How do i install it?

Xqt (talkcontribs)

Maybe this could help.

This comment was hidden by Walter Klosse (history)
Xqt (talkcontribs)

You are redefine your default mylang and family which is wikipedia:cs then.

KlosseBot (talkcontribs)

How? Now i have just wikidata and still same response.

Reply to "wikidata is not valid site"

Uploading files with titles containing UTF-8 characters

5
Jc86035 (talkcontribs)

I was having trouble uploading python pwb.py upload.py -keep -noverify -ignorewarn "/…/BSicon hÜST.svg" narrow formations. Do I need to escape the Ü?

Xqt (talkcontribs)

No idea. A traceback would help to find out the problem.

Jc86035 (talkcontribs)

(Third comment in thread; had previous revisions suppressed)

ERROR: Traceback (most recent call last):
 File "/…/Documents/pywikibot/pywikibot/data/api.py", line 1558, in submit
   body=body, headers=headers)
 File "/…/Documents/pywikibot/pywikibot/tools/__init__.py", line 1105, in wrapper
   return obj(*__args, **__kw)
 File "/…/Documents/pywikibot/pywikibot/comms/http.py", line 279, in request
   r = fetch(baseuri, method, body, headers, **kwargs)
 File "/…/Documents/pywikibot/pywikibot/comms/http.py", line 381, in fetch
   error_handling_callback(request)
 File "/…/Documents/pywikibot/pywikibot/comms/http.py", line 297, in error_handling_callback
   raise request.data
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 884: ordinal not in range(128)
Xqt (talkcontribs)

Seems the traceback isn't complete. I propose to file a bug at phabricator:

Jc86035 (talkcontribs)

(I've tried changing multiple instances of "ascii" in the config files to "utf-8" but there was no effect.)

Jc86035 (talkcontribs)

I am trying to delay movepages.py so it makes edits every eight seconds, so the script isn't stopped after every eight page moves by the Commons API. However, the script ignores user-config.py settings for delay since the action is not an edit but a page move. How can I add a delay?

Xqt (talkcontribs)

Please file a bug at [https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=PHID-PROJ-orw42whe2lepxc7gghdq phabricator]. Seems this is a real bug and should ne solved

Jc86035 (talkcontribs)

Filed a bug, T173914.

Reply to "Delay in movepages.py"
SamiIslam (talkcontribs)

Hi,

Can a normal user use the pywikibot functionality from a wiki site to create a site from a text file? Or is that something only an admin would have to do on the server hosting the wiki?

Thanks!

Sami

Xqt (talkcontribs)

There is a script "pagefromfile.py" to do this but it is may be local community restrictions to allow or discard edits in this way.

Reply to "Pywikibot usage"
Jc86035 (talkcontribs)

Does movepages.py update redirects as well to avoid creating double redirects?

This comment was hidden by Jc86035 (history)
Xqt (talkcontribs)

Currently not.

Jc86035 (talkcontribs)

Are there any scripts which do so?

XXN (talkcontribs)

redirect.py

Reply to "Moving pages"

how can i get transclusions template

1
جار الله (talkcontribs)

Hello how can i get transclusions template using Pywikibot core?