Skip to content
Advertisement

Python: Crypto package error: “No module called ‘_number_new'”

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

...python39libsite-packagesCryptoUtil_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
> FilesSoftpython39libsite-packagesCryptoUtilnumber.py", line 62,
> in <module>
>     from _number_new import *   File "C:Program FilesSoftpython39libsite-packages-forcedshiboken2files.dirshibokensupport__feature__.py",
> line 142, in _import
>     return original_import(name, *args, **kwargs) ModuleNotFoundError: No module named '_number_new'

…python39libsite-packagesCryptoUtil listing:

libsite-packagesCryptoUtil

Advertisement

Answer

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

from Crypto.Util._number_new import *
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement