Issue383

Title KeyError: 'six' in pkg_resources
Priority bug Status chatting
Superseder Nosy List tiangong
Assigned To Keywords

Created on 2017-10-25.17:44:30 by tiangong, last changed by tiangong.

Messages
msg2280 (view) Author: tiangong Date: 2017-10-26.16:00:57
Hi Kay,

> a) This is import "six" that hbmqtt\plugins\manager.py is doing there.
I can't confirm this for sure, but it's likely.

> b) Your main program name ends in ".pyw" as opposed to ".py". I have 
seen it rarely used, 
> but it seems to need handling as well. That is only beauty issue though.
Yes, it ends with ".pyw", but the error occurs on a file with ending ".py" 
as well.

> c) The same happens on your install if you do "import 
pkg_resources.extern" and "import 
> six" in a simple file as well.
I compiled the following programme:

    import pkg_resources.extern
    import six

    print('test')

Nuitka shows the warning:

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Program 
Files\Python36\Lib\site-packages\six.py:82' may require use of '--recurse-
directory'.

Running the compiled programme "test.exe" fails with "KeyError: 'six'".

d) Can you can your Python directory there for all the six.py and list 
them.
Pardon?

Best regards,
Philipp
msg2275 (view) Author: kayhayen Date: 2017-10-26.10:31:17
Hello there,

can you confirm the following assumptions:

a) This is import "six" that hbmqtt\plugins\manager.py is doing there.
b) Your main program name ends in ".pyw" as opposed to ".py". I have seen it rarely used, 
but it seems to need handling as well. That is only beauty issue though.
c) The same happens on your install if you do "import pkg_resources.extern" and "import 
six" in a simple file as well.
d) Can you can your Python directory there for all the six.py and list them.

In terms of workaround, this ought to be a regression of a recent change, where hidden 
dependencies of "pkg_resources.extern" were added, that should make it able to load 
embedded copies as opposed to external ones, as a fallback. But maybe the "spec" Nuitka 
provides for newer Python then is surprising to the module importer, as it might well say 
"pkg_resources.external.six" where "six" is expected or the other way around. I will need a 
reproducer that I hopefully get from your responses.

Yours,
Kay
msg2274 (view) Author: tiangong Date: 2017-10-25.17:44:30
The following error occurs on Windows 7 (x86-64) with Python 3.6.1 and Nuitka 0.5.28. Trying to run the exe file compiled with Nuitka leads 
to:

  [...]
  File "C:\Users\User\Python\<project>\dist\<project>.pyw.dist\hbmqtt\plugins\manager.py", line 7, in <module hbmqtt.plugins.manager>
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "C:\Users\User\Python\<project>\dist\<project>.pyw.dist\pkg_resources\__init__.py", line 51, in <module>
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "C:\Users\User\Python\<project>\dist\<project>.pyw.dist\pkg_resources\extern\__init__.py", line 43, in load_module
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
KeyError: 'six'

Help is appreciated.
History
Date User Action Args
2017-10-26 16:00:57tiangongsetmessages: + msg2280
2017-10-26 10:31:17kayhayensetstatus: unread -> chatting
messages: + msg2275
2017-10-25 17:44:30tiangongcreate