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
JavaScript
x
2
1
python39libsite-packagesCryptoUtil_number_new.py
2
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:
JavaScript
1
3
1
# New functions
2
from _number_new import *
3
Error message:
JavaScript
1
7
1
> Traceback (most recent call last): File "C:Program
2
> FilesSoftpython39libsite-packagesCryptoUtilnumber.py", line 62,
3
> in <module>
4
> from _number_new import * File "C:Program FilesSoftpython39libsite-packages-forcedshiboken2files.dirshibokensupport__feature__.py",
5
> line 142, in _import
6
> return original_import(name, *args, **kwargs) ModuleNotFoundError: No module named '_number_new'
7
…python39libsite-packagesCryptoUtil listing:
Advertisement
Answer
Modules in packages can be accessed using dot notation, so you just need to:
JavaScript
1
2
1
from Crypto.Util._number_new import *
2