Page MenuHomePhabricator

pwb console script doesn't find scripts in the scripts folder but pwb.py does
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

  • pip install pywikibot from git
  • pwb touch -help (or any other script in ./scripts, ./scripts/userscripts, ./scripts/maintenance)

What happens?:

ERROR: touch.py not found! Misspelling?

What should have happened instead?:
pwb finds and executes the script like python3 pwb.py.

Software version:
current (14dffb0)

Other information:
It finds scripts from ./pywikibot/scripts.

Installing scripts into a site-package instead of relying on the path should fix this.

Event Timeline

Don't see that scripts are installed. config.userscripts variable must be used to give access to the scripts folder-

JJMC89 renamed this task from pwb console script doesn't find scripts in the scripts folder to pwb console script doesn't find scripts in the scripts folder but pwb.py does.Dec 2 2022, 5:03 PM
JJMC89 updated the task description. (Show Details)

Don't see that scripts are installed. config.userscripts variable must be used to give access to the scripts folder-

Thanks to @JJMC89 for pointing me to this task. I can confirm this happens today on the latest stable release as well. I followed @Xqt's suggestion and added to my user-config.py the following: user_script_paths = ['pywikibot-core.scripts.maintenance'] and it fixed it.

Not sure if this is related but calling the pwb version -v command makes the script print different outputs:

(pwbvenv) tools.xxxx@shell-yyyyy:~$ pwb version -v
Pywikibot: pywikibot/__init__.py (, -1 (unknown), 2023/01/24, 15:27:17, UNKNOWN)
`

whereas:

(pwbvenv) tools.xxxx@shell-yyyyy:~$ python3 pywikibot-core/pwb.py version -v
Pywikibot: [https] r-pywikibot-core (b678f2e, g17785, 2023/01/21, 12:29:25, stable)

Thanks to @JJMC89 for pointing me to this task. I can confirm this happens today on the latest stable release as well. I followed @Xqt's suggestion and added to my user-config.py the following: user_script_paths = ['pywikibot-core.scripts.maintenance'] and it fixed it.

I tried this solution today and it still didn't work

@PAWS:~$ pwb replace -start:!
ERROR: replace.py not found! Misspelling?
WARNING: /srv/paws/pywikibot-core/scripts/maintenance does not exists; remove it from user_script_paths
@PAWS:~$

I tried this solution today and it still didn't work

@PAWS:~$ pwb replace -start:!
ERROR: replace.py not found! Misspelling?
WARNING: /srv/paws/pywikibot-core/scripts/maintenance does not exists; remove it from user_script_paths
@PAWS:~$

The PAWS install of pywikibot is missing the scripts since it was updated to 8.0.0 (T326512). Also, the path is different on PAWS compared to what MarcoAurelio has.

Change 986520 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Add config.base_dir to scripts search path

https://gerrit.wikimedia.org/r/986520

Change 986520 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Add config.base_dir to scripts search path

https://gerrit.wikimedia.org/r/986520