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.

AssertionError: assert encoding is not None

See original GitHub issue

Nuitka version, full Python version, flavor, OS, etc. as output by this

command (it does more than you think, and we are adding more all the time):

python -m nuitka --version

0.7.6
Commercial: None
Python: 3.8.12 (default, Oct 12 2021, 13:49:34)
Flavor: Anaconda Python
Executable: /root/miniconda3/envs/py38/bin/python
OS: Linux
Arch: x86_64
Distribution: Ubuntu (based on Debian) 20.04.1

How did you install Nuitka and Python

I used pip install nuitka installed Nuitka.

  • I’m sure I install nuitka succeed
  • I use nuitka on Windows10 by wsl.

What error did I get?

I had a sanic server codes. And I used this command to generate *.bin file: python3 -m nuitka --follow-imports --plugin-enable=pylint-warnings -o ./server.bin --remove-output --show-scons --static-libpython=no cx_api_server/server.py

Then, I got this error:

...
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'pkg_resources._vendor.packaging' added 'pkg_resources._vendor.packaging.version,pkg_resources._vendor.packaging.specifiers,pkg_resources._vendor.packaging.requirements'.
PASS 1:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 579/597, sanic.response
...
...
...
Problem with statement at /root/miniconda3/envs/py38/lib/python3.8/site-packages/sanic/response.py:37:
-> class BaseHTTPResponse:
Nuitka:INFO: Interrupted while working on '<Node 'COMPILED_PYTHON_MODULE' with {'filename': '/root/miniconda3/envs/py38/lib/python3.8/site-packages/sanic/response.py', 'module_name': <ModuleName sanic.response>, 'code_flags': ''}>'.
PASS 1:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 579/597, sanic.response
...
...
 File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/nuitka/specs/BuiltinParameterSpecs.py", line 679, in extractBuiltinArgs
    result = builtin_class(*args_list, source_ref=node.getSourceReference())
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/nuitka/nodes/AttributeNodesGenerated.py", line 604, in wrapExpressionStrOperationEncode
    return ExpressionStrOperationEncode3(
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/nuitka/nodes/StrNodes.py", line 1404, in __init__
    assert encoding is not None
AssertionError

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Apr 29, 2022

This is now on develop and will be in 0.8 release. I actually found another similar bug for str.split and str.rsplit when enhancing the test to cover terminal keyword arguments.

0reactions
kayhayencommented, May 20, 2022

Part of 0.8 release that I just made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve AssertionError for converting string characters ...
The assert is checking that compress('') return bytes. It doesn't, it returns output which is a str . Output needs to be encoded...
Read more >
Asserting Expectations - The Debugging Book
In C and C++, defining the preprocessor variable NDEBUG ("no debug") turns off assertions, replacing them with a statement that does nothing.
Read more >
Errors | Node.js v19.3.0 Documentation
AssertionError s are a special class of error that can be triggered when Node.js detects an exceptional logic violation that should never occur....
Read more >
Getting error "g_utf8_collate: assertion 'str1 != NULL' failed ...
NULL ' failed. The problem is not reproducible with the utf8 encoding. It is not showing those messages with other language(en_US.
Read more >
Python's assert: Debug and Test Your Code Like a Pro
In this tutorial, you'll learn how to use Python's assert statement ... AssertionError >>> assert null is None >>> assert null is not...
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