Importlib behaves differently when importing pyd file

Jach Feng jfong at ms4.hinet.net
Wed Nov 16 01:52:07 EST 2022


My working directory d:\Works\Python\ has a package 'fitz' looks like this:

....fitz\
........__init__.py
........fitz.py
........utils.py
........_fitz.pyd

There is a statement in fitz.py:
....return importlib.import_module('fitz._fitz')

It works fine under Python 3.4 interpreter:
>>> import fitz
>>>

But under Python 3.8 I get an exception:
>>> import fitz
Traceback(...
...
...
ImportError: DLL load failed while importing _fitz
>>>

I work under Windows7 64bit with Python 32bit. Can anyone help?


--Jach


More information about the Python-list mailing list