Funny error message

Bob van der Poel bob at mellowood.ca
Fri Jan 1 11:39:53 EST 2021


It appears that a couple of things are happening ... and not being a python
install expert by a long shot, none of it makes sense to me.

But, let me first state that I've never screwed around with the python
installation. I let the Ubuntu packager take care of that.

- running "python -v" I get A LOT of data about various modules being
loaded, etc. I see that most of the modules are loaded from the system dir
/usr/lib/python3.8 but some from .local/lib/python3.8. I have never created
the .local tree so I, again, assume that the installer is doing this. BTW,
sys.path is:
['', '/usr/lib/python38.zip', '/usr/lib/python3.8',
'/usr/lib/python3.8/lib-dynload', '/home/bob/.local

   /lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages',
'/usr/lib/python3/dist-packages']

- running python -v gives too much info. I really can't see what is causing
the unneeded text, but assume it is "requests". Note that this is the
module from .local. Experimenting, I deleted .local/.../requests and it is
now using /usr/.../requests. I've undeleted the .local version.

- creating a one line script with only a bad command in it and running
"python -v script.py >err_file" does not give the lengthy printout. The
same error message is displayed on the terminal.

I really have no idea ... and don't care that much, except it is annoying
to have these same lines repeated over and over again after every error.
Could this be a bug in requests?


On Fri, Jan 1, 2021 at 3:03 AM Peter Otten <__peter__ at web.de> wrote:

> On 31/12/2020 23:46, Bob van der Poel wrote:
>
> > When I run python from the command line and generate an error I get the
> > following:
> >
> > Python 3.8.5 (default, Jul 28 2020, 12:59:40)
> > [GCC 9.3.0] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> z
> > /home/bob/.local/lib/python3.8/site-packages/requests/__init__.py:89:
> > RequestsDependencyWarning: urllib3 (1.24.3) or chardet (4.0.0) doesn't
> > match a supported version!
> >    warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported
> "
> > Traceback (most recent call last):
> >    File "<stdin>", line 1, in <module>
> > NameError: name 'z' is not defined
> >
> > I understand "z in not defined" ... but what's with the warnings?
>
> It looks like Python tries to import requests as a side effect of
> printing the traceback.
> Start the interpreter in verbose mode
>
> $ python -v
>
> and trigger the name error again to see which module triggers that import.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW:   http://www.mellowood.ca


More information about the Python-list mailing list