2

I have an issue while importing a dynamic python module (pyd), my file structures is as follow:

A
|--A.py
+--B
  │--B.py
  │--__init__.py
  +--Crypto
     |--__init__.py
     +--Cipher
        |--__init__.py        
        |--_AES.pyd

A.py: from B import B

B.py: from Crypto.Cipher import _AES

when executing A.py, I get the following error:

SystemError: dynamic module not initialized properly

The import is working fine when I am executing B.py. Also, If I move Crypto to another place and add that folder to sys.path, the import is still working fine.

The error occurs when B.py and the Crypto are under the same folder, but B was imported by another file which is not under the same directory.

hmofrad
  • 1,784
  • 2
  • 22
  • 28
shawn luo
  • 21
  • 2

1 Answers1

0

After trying various factors, I think it's the module being appended with a relative path name. This should be a bug caused by the python relative import feature

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 23 '21 at 12:10