Importlib behaves differently when importing pyd file

Dieter Maurer dieter at handshake.de
Wed Nov 16 12:11:52 EST 2022


Jach Feng wrote at 2022-11-15 22:52 -0800:
>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
>>>>

The Python C-API is Python version dependent.
Your `_fitz.pyd` may need to be recreated for Python 3.8.


More information about the Python-list mailing list