Page MenuHomePhabricator

upload.py: Allow set a description without using tkinter
Closed, InvalidPublic

Description

tools.framabot@tools-bastion-02:/shared/pywikipedia/core$ python pwb.py upload -family:commons -lang:commons https://farm3.staticflickr.com/2833/33285036503_ bc4c85d9f5_o_d.jpg
The filename on the target wiki will default to: 33285036503_bc4c85d9f5_o_d.jpg
Enter a better name, or press enter to accept:
The suggested description is:

It is not possible to upload a file without a summary/description.
Do you want to change this description? ([Y]es, [n]o, [q]uit): y
ERROR: Could not load GUI modules: No module named _tkinter, please install the python-tk package
No editor available.
Set your favourite editor in user-config.py "editor", or install python packages tkinter and idlelib, which are typically part of Python but may be packaged separately on your platform.

It is not possible to upload a file without a summary/description.
Do you want to change this description? ([Y]es, [n]o, [q]uit):

Event Timeline

If you set in user-config.py: editor = '/usr/bin/vim' (or whatever), it should be OK even without tkinter.
GUI is a fallback to std editor.

Maybe the error message could be improved anyhow.

Oh, yes, I forgot this config. And the error message shows this...
@Mpaa Do you think that it's necessary to load some "rescue" editors, such as nano on linux or notepad.exe on windows ?

I did that.
Note that the same editor will be called e.g. by replace.py.
It is quite convenient to have one configured.