PyWebScrapBook
PyWebScrapBook copied to clipboard
wsb cannot be executed
After installation, running wsb generates an error message " 'wsb' is not recognized as an internal or external command, operable program or batch file."
What is the version of your OS and Python?
Windows 11 Pro 23H2 Python 3.12
On Sat, Mar 30, 2024 at 1:31 AM Danny Lin @.***> wrote:
What is the version of your OS and Python?
— Reply to this email directly, view it on GitHub https://github.com/danny0838/PyWebScrapBook/issues/77#issuecomment-2027925979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUSI3NPJJEM3DVAKSFUTQLY2ZE4XAVCNFSM6AAAAABFO6YU4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHEZDKOJXHE . You are receiving this because you authored the thread.Message ID: @.***>
Seems you have some installation issue for Python causing executables not added to PATH.
Can you run python in the CLI?
python
If yes, try:
python -m webscrapbook
and report whether it works.
yes, but wsb still does not run: A screenshot is attached.
[image: image.png]
On Sat, Mar 30, 2024 at 9:45 AM Danny Lin @.***> wrote:
Seems you have some installation issue for Python causing executables not added to PATH.
Can you run python in the CLI?
python
If yes, try:
python -m webscrapbook
and report whether it works.
— Reply to this email directly, view it on GitHub https://github.com/danny0838/PyWebScrapBook/issues/77#issuecomment-2028075180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUSI3LRBZANNCKI5CMW2E3Y226WBAVCNFSM6AAAAABFO6YU4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGA3TKMJYGA . You are receiving this because you authored the thread.Message ID: @.***>
Attachments is not supported by an email response. Please upload through web interface.
Seems the package is installed successfully. To get it work you have to replace wsb commands with python -m webscrapbook, e.g. wsb config -ba => python -m webscrapbook config -ba.
I current don't know why exactly wsb doesn't appear in your PATH. It may be related to how you have actually installed it and it's a Python / Python module installation issue rather than an issue of this package. To actually fix it, consider:
- Restart your system and re-open the command prompt.
- Fix or reinstall Python and webscrapbook package.
- Manually search for the path of
wsb.exe, which is usually something likeC:\Users\<Your Name>\AppData\Local\Programs\Python\Python312\Scripts\wsb.exe, and add it's parent folder to PATH. Consultwhere pythonto get the path of the installed Python executable and Google to get a hint.
If you installed on Windows using a system-installed Python (located somewhere like C:\Python312\), and you installed with the --user / -U flag to pip (as you almost certainly had to, because running as a regular user python -m pip install webscrapbook will fail when it can't write to C:\Python312\Scripts\ and C:\Python312\site-packages\), then at the end of the install pip most likely printed a message like this:
Installing collected packages: MarkupSafe, lxml, itsdangerous, colorama, blinker,
werkzeug, jinja2, click, flask, webscrapbook
WARNING: The script flask.exe is installed in
'C:\Users\NAME\AppData\Roaming\Python\Python312\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning,
use --no-warn-script-location.
WARNING: The scripts webscrapbook.exe, wsb.exe and wsbview.exe are installed in
'C:\Users\NAME\AppData\Roaming\Python\Python312\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning,
use --no-warn-script-location.
Successfully installed MarkupSafe-2.1.5 blinker-1.8.2 click-8.1.7 colorama-0.4.6
flask-3.0.3 itsdangerous-2.2.0 jinja2-3.1.4 lxml-5.3.0 webscrapbook-2.4.0 werkzeug-3.0.4
That message explains exactly why you can't run the wsb command: wsb.exe is located in C:\Users\NAME\AppData\Roaming\Python\Python312\Scripts which is not on your PATH.
(Its corresponding site-packages dir is on your $PYTHONPATH, though, which is why python -m webscrapbook works):
> python
>>> import sys
>>> from pprint import pp
>>> pp(sys.path)
['',
'C:\\Python312\\python312.zip',
'C:\\Python312\\DLLs',
'C:\\Python312\\Lib',
'C:\\Python312',
'C:\\Users\\NAME\\AppData\\Roaming\\Python\\Python312\\site-packages',
'C:\\Python312\\Lib\\site-packages']
>>>
If you want to check the exact location of the wsb.exe entry point in your Python installation, you can do that using importlib.metadata:
>>> from importlib import metadata
>>> files = metadata.files('webscrapbook')
>>> for f in files:
... if 'wsb.exe' in str(f):
... wsb = f
... break
...
>>> wsb.dist.locate_file(wsb).resolve()
WindowsPath('C:/Users/NAME/AppData/Roaming/Python/Python312/Scripts/wsb.exe')
...You just need to add that directory to your %PATH%.
(If you upgraded the Python installation from a previous version, like say using Chocolatey or some other method, one possibility is that your path still contains the original version's Scripts dir, for example C:\Users\NAME\AppData\Roaming\Python\Python311\Scripts. If so and you no longer use that version, you can just edit it to Python312. Or, add a new entry.)