I have a user-config.py file with mylang, family_files, and family set, but that means my script only works if you're cd'd into the directory that the user-config.py file is in, or apparently if you put the file in some place in your home directory. This isn't very good because I'd like to distribute my script and have other people using it.
Is there a way I can set these things (basically just want to tell pywikibot to use a different MediaWiki website) without having a user-config.py file, or point my script to that file regardless of where it is?
I even tried chdir()-ing to the file's location from the Python code, but that didn't work.
If your script uses Pywikibot, other people who want to run it also need an installed Pywikibot. If all of you put the script in pywikibot/scripts/userscripts, everyone can use their own config. Or did I misunderstand the problem?
yabobay via pywikibot pywikibot@lists.wikimedia.org ezt írta (időpont: 2026. ápr. 7., K, 16:55):
I have a user-config.py file with mylang, family_files, and family set, but that means my script only works if you're cd'd into the directory that the user-config.py file is in, or apparently if you put the file in some place in your home directory. This isn't very good because I'd like to distribute my script and have other people using it.
Is there a way I can set these things (basically just want to tell pywikibot to use a different MediaWiki website) without having a user-config.py file, or point my script to that file regardless of where it is?
I even tried chdir()-ing to the file's location from the Python code, but that didn't work.
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
The problem is that what I want to set in the config file is /which mediawiki site to access/. This isn't something that makes sense for individual users to be able to customize, cause my bot is tailored to a specific site. Asking someone to place a config file somewhere is an unnecessary step when it's something that they're not actually ever going to customize. So I wanna know how to tell pywikibot what mediawiki site to access without using a file like that.
On 4/7/26 6:24 PM, Bináris via pywikibot wrote:
If your script uses Pywikibot, other people who want to run it also need an installed Pywikibot. If all of you put the script in pywikibot/scripts/userscripts, everyone can use their own config. Or did I misunderstand the problem?
yabobay via pywikibot pywikibot@lists.wikimedia.org ezt írta (időpont: 2026. ápr. 7., K, 16:55):
I have a user-config.py file with mylang, family_files, and family set, but that means my script only works if you're cd'd into the directory that the user-config.py file is in, or apparently if you put the file in some place in your home directory. This isn't very good because I'd like to distribute my script and have other people using it. Is there a way I can set these things (basically just want to tell pywikibot to use a different MediaWiki website) without having a user-config.py file, or point my script to that file regardless of where it is? I even tried chdir()-ing to the file's location from the Python code, but that didn't work. _______________________________________________ pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/X4OLU6BKL4KQ2B7BN6G2D34V6KQHV33Y/ To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org-- Bináris
pywikibot mailing list --pywikibot@lists.wikimedia.org Public archives athttps://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email topywikibot-leave@lists.wikimedia.org
That's easily solvable:
``` from pywikibot import config config.mylang = 'en' config.family = 'wikipedia' ```
Strainu
Pe marți, 7 aprilie 2026, yabobay via pywikibot < pywikibot@lists.wikimedia.org> a scris:
The problem is that what I want to set in the config file is *which mediawiki site to access*. This isn't something that makes sense for individual users to be able to customize, cause my bot is tailored to a specific site. Asking someone to place a config file somewhere is an unnecessary step when it's something that they're not actually ever going to customize. So I wanna know how to tell pywikibot what mediawiki site to access without using a file like that. On 4/7/26 6:24 PM, Bináris via pywikibot wrote:
If your script uses Pywikibot, other people who want to run it also need an installed Pywikibot. If all of you put the script in pywikibot/scripts/userscripts, everyone can use their own config. Or did I misunderstand the problem?
yabobay via pywikibot pywikibot@lists.wikimedia.org ezt írta (időpont: 2026. ápr. 7., K, 16:55):
I have a user-config.py file with mylang, family_files, and family set, but that means my script only works if you're cd'd into the directory that the user-config.py file is in, or apparently if you put the file in some place in your home directory. This isn't very good because I'd like to distribute my script and have other people using it.
Is there a way I can set these things (basically just want to tell pywikibot to use a different MediaWiki website) without having a user-config.py file, or point my script to that file regardless of where it is?
I even tried chdir()-ing to the file's location from the Python code, but that didn't work.
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@ lists.wikimedia.org/message/X4OLU6BKL4KQ2B7BN6G2D34V6KQHV33Y/ To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
-- Bináris
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
That works, thank you!