Web lists-archives.com

Re: python3.7 disfunctional (was: argparse missing from libpython3.7-stdlib ?) NOW SOLVED




On Sat, 23 Feb 2019 02:30:01 +0100, Frank Miles wrote:

> I just upgraded my desktop from stable/stretch to testing/buster.
> I'd earlier done the same to a laptop without any problems.
> On the desktop, I get the following strange traceback :
> 
> $ python3 Python 3.7.2+ (default, Feb  2 2019, 14:31:48)
> [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license"
> for more information.
>>>> help()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python3.7/_sitebuiltins.py", line 102, in __call__
>     import pydoc
>   File "/usr/lib/python3.7/pydoc.py", line 66, in <module>
>     import inspect
>   File "/usr/lib/python3.7/inspect.py", line 40, in <module>
>     import linecache
>   File "/usr/lib/python3.7/linecache.py", line 11, in <module>
>     import tokenize
>   File "/usr/lib/python3.7/tokenize.py", line 33, in <module>
>     import re
>   File "/usr/lib/python3.7/re.py", line 143, in <module>
>     class RegexFlag(enum.IntFlag):
> AttributeError: module 'enum' has no attribute 'IntFlag'
>>>> 
>>>> 
> I've tried reinstalling python3.7 and its library packages without
> effect.
> 
> Any hints on how I might find what's causing this pathological behavior?
>  TIA!
>    -Frank

I posted a similar query on the python newsgroup - and Chris Angelico 
provided a good diagnostic method and correctly speculated about the
source of the problem.

What had happened some time ago was I'd introduced a python3 enum system,
which happened to reside at /usr/local/python3.7/dist-packages.  This was
earlier in the path than the proper enum module, so got imported rather
than the one in /usr/lib/python3.7/ .  Renaming things to get it out of
the way has restored the proper import, allowing python3 to work normally.

Thanks all-
  Frank