[New-bugs-announce] [issue31318] Windows importlib.util.find_spec("re") results in AttributeError: module 'importlib' has no attribute 'util'

elmar report at bugs.python.org
Fri Sep 1 00:01:34 EDT 2017


New submission from elmar:

Hi There, 

I found the following bug, but have now idea where to search to fix this:

On Windows calling a python script from the command line with the line importlib.util.find_spec("re") in it or using the standard python shell 
and executing importlib.util.find_spec("re") causes an AttributeError: module 'importlib' has no attribute 'util'.
Surprisingly using ipython and calling the same script with %run or executing importlib.util.find_spec("re") in the ipython shell works fine.

C:\Users\buchere>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>> importlib.util.find_spec("re")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'importlib' has no attribute 'util'
>>> exit()
 
ipython:
C:\Users\buchere>ipython
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)]

Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import importlib

In [2]: importlib.util.find_spec("re")
Out[2]: ModuleSpec(name='re', loader=<_frozen_importlib_external.SourceFileLoade
r object at 0x01EB6750>, origin='c:\\users\\buchere\\appdata\\local\\programs\\p
ython\\python36-32\\lib\\re.py')

In [3]:

The same code works fine in the Darwin and Linux standard python shell. 
This error is really specific to the Windows standard python shell.

----------
messages: 301083
nosy: bue
priority: normal
severity: normal
status: open
title: Windows importlib.util.find_spec("re") results in AttributeError: module 'importlib' has no attribute 'util'

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31318>
_______________________________________


More information about the New-bugs-announce mailing list