py_compile tracebacks with import error

Bug #1874084 reported by Alberto Donato
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3.8 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When using flycheck mode inside emacs, py_compile sometimes tracebacks with the following error:

  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/py_compile.py", line 13, in <module>
    import traceback
  File "/usr/lib/python3.8/traceback.py", line 5, in <module>
    import linecache
  File "/usr/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/usr/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/usr/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
    import re
  File "/usr/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/py_compile.py", line 13, in <module>
    import traceback
  File "/usr/lib/python3.8/traceback.py", line 5, in <module>
    import linecache
  File "/usr/lib/python3.8/linecache.py", line 11, in <module>
    import tokenize
  File "/usr/lib/python3.8/tokenize.py", line 32, in <module>
    import re
  File "/usr/lib/python3.8/re.py", line 143, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Try installing a more recent version of python-pycompile, and please open a bug report if the issue persists in the latest release. Thanks!

The checker basically calls "python3 -m py_compile <file>"

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: libpython3.8-minimal 3.8.2-1ubuntu1 [modified: usr/lib/python3.8/py_compile.py]
ProcVersionSignature: Ubuntu 5.4.0-24.28-generic 5.4.30
Uname: Linux 5.4.0-24-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: GNOME
Date: Tue Apr 21 15:36:48 2020
InstallationDate: Installed on 2019-10-19 (185 days ago)
InstallationMedia: Ubuntu 19.10 "Eoan Ermine" - Release amd64 (20191017)
SourcePackage: python3.8
UpgradeStatus: Upgraded to focal on 2020-03-13 (39 days ago)

Revision history for this message
Alberto Donato (ack) wrote :
Revision history for this message
Alberto Donato (ack) wrote :

this seems to be due to a local "enum.py" overriding the global one

Changed in python3.8 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.