On Fri, Jan 1, 2021 at 6:24 AM Nicolas Grandjean <nico...@microniko.net> wrote:
> nicolas@krypton:/tmp$ ./import.py
> /usr/lib/python3/dist-packages/cryptography/__init__.py
> 2.6.1
> /usr/lib/python3/dist-packages/cryptography/hazmat/__init__.py
> None
> Traceback (most recent call last):
>   File "./import.py", line 10, in <module>
>     import cryptography.hazmat.primitives.asymmetric
> ModuleNotFoundError: No module named
> 'cryptography.hazmat.primitives.asymmetric'

Curiouser and curiouser!  The version of the module you have installed
clearly has the module that it's complaining it can't find.  And the
'None' there is strange; that means it successfully loaded
cryptography.hazmat.primitives (otherwise the ModuleNotFoundError
would have been for cryptography.hazmat.primitives, instead of
cryptography.hazmat.primitives.asymmetric), but that the module didn't
have a path.

A couple more things to try so we can get some more info:

find /usr/lib/python3/dist-packages/cryptography/hazmat -name __init__.py -ls

Can you also attach the output of this new script?
-- 
Harlan Lieberman-Berg
~hlieberman
#!/usr/bin/python3 -vvv

import os, sys
import pkgutil

def print_submodules(module):
    for loader, module_name, is_pkg in pkgutil.walk_packages(module.__path__, module.__name__+'.'):
        print(module_name)
        module_name = __import__(module_name, fromlist='dummylist')
        if is_pkg:
            print_submodules(module_name)

import cryptography
print_submodules(cryptography)

Reply via email to