[issue36633] py_compile.compile: AttributeError on importlib.utils

2019-04-15 Thread Jens Vagelpohl


New submission from Jens Vagelpohl :

The following code in py_compile.compile fails (tested on 3.6.6 and 3.7.3) with 
tracebacks that end like the one shown at the bottom. There's an AttributeError 
about importlib.utils.

"""
if cfile is None:
if optimize >= 0:
optimization = optimize if optimize >= 1 else ''
cfile = importlib.util.cache_from_source(file,
 optimization=optimization)
else:
cfile = importlib.util.cache_from_source(file)
"""

Sample tail end of traceback:

"""
  File "/Users/jens/src/.eggs/Chameleon-3.6-py3.7.egg/chameleon/template.py", 
line 243, in _cook
cooked = self.loader.build(source, filename)
  File "/Users/jens/src/.eggs/Chameleon-3.6-py3.7.egg/chameleon/loader.py", 
line 177, in build
py_compile.compile(name)
  File 
"/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/py_compile.py",
 line 130, in compile
cfile = importlib.util.cache_from_source(file)
AttributeError: module 'importlib' has no attribute 'util'
"""

--
components: Library (Lib)
messages: 340271
nosy: dataflake
priority: normal
severity: normal
status: open
title: py_compile.compile: AttributeError on importlib.utils
versions: Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue36633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36633] py_compile.compile: AttributeError on importlib.utils

2019-04-15 Thread Jens Vagelpohl


Jens Vagelpohl  added the comment:

Thank you for the prompt reply.

It turns out this is not a bug in py_compile. Other code we use imports 
importlib.util briefly for a quick check at module level and then deletes it, 
also at module scope. Removing the deletion fixes the issue.

Thanks again and apologies!

--
resolution:  -> third party

___
Python tracker 
<https://bugs.python.org/issue36633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com