How to decide which module is in charge of this error? cx-Freeze or pynput or six?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Thu Jan 9 03:20:48 EST 2020


Takes the simple\hello.py file in the cx_Freeze\samples directory as an example, I insert this line into hello.py:

    from pynput.keyboard import Key, Controller

then build the executable using "py setup.py build" command, the on-screen message shows this missing module warning:

    ...
    Missing modules:
    ...
    ? six.moves imported from pynput._util
    ...

Run the created hello.exe will cause this error:

    ...
    from pynput._util import Events
  File "C:\Users\jfong\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\pynput\_util\__init__.py", line 33, in <module>
    from six.moves import queue
  File "C:\Users\jfong\AppData\Local\Programs\Python\Python36-32\lib\site-packages\six.py", line 92, in __get__
    result = self._resolve()
  File "C:\Users\jfong\AppData\Local\Programs\Python\Python36-32\lib\site-packages\six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "C:\Users\jfong\AppData\Local\Programs\Python\Python36-32\lib\site-packages\six.py", line 82, in _import_module
    __import__(name)
ModuleNotFoundError: No module named 'queue'

If I change line 33 in file pynput\_util\__init__.py
    from six.moves import queue
to
    import queue
and re-build, then that missing warning is gone and hello.exe excutes correctly.

My question is how to decide which module causes this problem?

PS. My environment is Windows 8.1, Python 3.6.8, cx-Freeze 5.1.1, pynput 1.6.5, six 1.13.0. I had try to upgrade the cx-Freeze to the latest v6.1 but result is the same.

--Jach


More information about the Python-list mailing list