#1105158 python3-comedilib: Python 3 comedi module cannot be imported with "import comedi"

Package:
python3-comedilib
Source:
python3-comedilib
Description:
Python3 wrapper for Comedilib
Submitter:
Ian Abbott
Date:
2025-05-12 13:03:02 UTC
Severity:
normal
#1105158#5
Date:
2025-05-12 12:55:07 UTC
From:
To:
Dear Maintainer,

The way the comedi Python module is installed by the Debian package means that
a simple script such as the following does not work:

#!/usr/bin/env python3
import comedi
print(comedi.MAJOR)

When run, the follow Error is produced:

AttributeError: module 'comedi' has no attribute 'MAJOR'

This is because the Debian package installs /usr/lib/python3/dist-
packages/comedi/comedi.py whereas building and installing "manually" via the
"./configure; make; sudo make install" method would not create the "comedi"
subdirectory in the *-packages directory.

The following script does work, but is non-canonical:

#!/usr/bin/env python3
import comedi.comedi as comedi
print(comedi.MAJOR)

One workaround is to create the file /usr/lib/python3/dist-
packages/comedi/__init__.py containing just this one line:

from .comedi import *