Home > Blockchain >  Python: Crypto package error: "No module called '_number_new'"
Python: Crypto package error: "No module called '_number_new'"

Time:01-04

I have a software which installs its own local Python 3.9. Included in its python39/lib/site-packages is Crypto package, which causes errors and seems old and incompatible with Python 3.9. It includes long integers, like 1L, which I fixed by removing the "L". But I'm still getting the error below, even though the file

...\python39\lib\site-packages\Crypto\Util\_number_new.py 

exists. For now, I'm trying to fix such errors manually, to avoid dealing with other incompatibility issues that will show up, if I try to update the whole Crypto package. The line in number.py:

# New functions
from _number_new import *

Error message:

> Traceback (most recent call last):   File "C:\Program
> Files\Soft\python39\lib\site-packages\Crypto\Util\number.py", line 62,
> in <module>
>     from _number_new import *   File "C:\Program Files\Soft\python39\lib\site-packages-forced\shiboken2\files.dir\shibokensupport\__feature__.py",
> line 142, in _import
>     return original_import(name, *args, **kwargs) ModuleNotFoundError: No module named '_number_new'

...\python39\lib\site-packages\Crypto\Util listing:

lib\site-packages\Crypto\Util

CodePudding user response:

Modules in packages can be accessed using dot notation, so you just need to:

from Crypto.Util._number_new import *
  • Related