question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiling python code that uses six.py somewhere in the import chain

See original GitHub issue

Steps:

  1. Compile any code that has six.py in it’s import chain - e.g. direct usage or imports some module which eventually imports six.py e.g.
~/temp/glances $ nuitka --python-version=3.5 --portable --recurse-all /usr/bin/glances 
Nuitka:WARNING:Unresolved '__import__' call at '/home/gsjy/.local/lib/python3.5/site-packages/six.py:82' may require use of '--recurse-directory'.
  1. Try running the generated code. Result:
~/temp/glances$ glances.dist/glances.exe 
Traceback (most recent call last):
  File "/home/gsjy/temp/glances/glances.dist/glances", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/gsjy/temp/glances/glances.dist/pkg_resources/__init__.py", line 51, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/gsjy/temp/glances/glances.dist/pkg_resources/extern/__init__.py", line 43, in load_module
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
KeyError: 'six'
  • Nuitka version 0.5.28.1, Python 3.5.2 and Python 2.7.12 on Ubuntu 16.04 and Windows 10
  • Python installed and kept up to date by the APT, nuitka installed and managed by pip
  • No virtualenv
  • Looks like issue is not a regression.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Feb 16, 2018

Can you try out develop branch. I recall that I did some work around its meta path based importer, but I am unsure now.

0reactions
kayhayencommented, Apr 12, 2019

@alex-pobeditel-2004 What makes you think this is the original issue, because it is not. Report a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling python code that uses six.py somewhere ... - GitHub
Steps: Compile any code that has six.py in it's import chain - e.g. direct usage or imports some module which eventually imports six.py...
Read more >
py_compile — Compile Python source files — Python 3.11.1 ...
The py_compile module provides a function to generate a byte-code file from a source file, and another function used when the module source...
Read more >
Your Guide to the CPython Source Code - Real Python
In this detailed Python tutorial, you'll explore the CPython source code. By following this step-by-step walkthrough, you'll take a deep ...
Read more >
Dragon taming with Tailbiter, a bytecode compiler for Python
Her chapter explains the CPython bytecode virtual machine, which takes the output of a compiler and executes it. I've tried to make this...
Read more >
Python Modules: Creating, Importing, and Sharing - Stack Abuse
Since Python is interpreted language, it runs the imported module's code once it reaches an import or from statement. Later imports within the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found