Bug 1394373 - Importing cec in python3 fails
Summary: Importing cec in python3 fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libcec
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Peter Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-11 19:59 UTC by fednuc
Modified: 2019-01-02 13:10 UTC (History)
1 user (show)

Fixed In Version: libcec-4.0.3-2.fc28 libcec-4.0.3-2.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-02 02:36:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description fednuc 2016-11-11 19:59:08 UTC
With python3-libcec and libcec installed, "import cec" fails.

This worked previously on Fedora 24... something to do with the libcec 3.1.0 update maybe?

It seems to be some sort of path or path+swig issue? The following workaround works:

$ cd /usr/lib64/python3.5/site-packages/cec
$ python3
>>> import cec
>>>

As does:

$ python3
>>> import sys
>>> sys.path.append("/usr/lib64/python3.5/site-packages/cec")
>>> import cec
>>>

Without workarounds, the following happens:

$ python3
>>> import cec
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/cec/__init__.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named '_cec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.5/site-packages/cec/__init__.py", line 21, in <module>
    _cec = swig_import_helper()
  File "/usr/lib64/python3.5/site-packages/cec/__init__.py", line 20, in swig_import_helper
    return importlib.import_module('_cec')
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_cec'
>>>

Comment 1 Peter Robinson 2016-11-12 18:41:53 UTC
Does it fail with python2? Can you try version 4 in rawhide or attach a small reproducer?

Comment 2 fednuc 2016-11-13 14:01:46 UTC
There are no Python 2 bindings for libcec on F25 - only python3-libcec.

Same problem using libcec-4.0.0-1.fc26.x86_64.rpm, platform-2.1.0.1-1.fc26.x86_64.rpm and python3-libcec-4.0.0-1.fc26.x86_64.rpm from Rawhide, installed on F25.

Reproduction is as straightforward as below on F25 - was there something else you were looking for?

$ sudo dnf install libcec python3-libcec
$ python3
>>> import cec
(fails with above exceptions)

Comment 3 Peter Robinson 2017-01-07 08:33:47 UTC
can you try 4.0.1 when you get a moment?

Comment 4 fednuc 2017-01-08 23:12:35 UTC
Identical error with 4.0.1.

Comment 5 fednuc 2017-06-17 12:32:46 UTC
Still present in F26 with libcec-4.0.2-3.fc26:

>>> import cec
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/cec/__init__.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_cec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/cec/__init__.py", line 17, in <module>
    _cec = swig_import_helper()
  File "/usr/lib64/python3.6/site-packages/cec/__init__.py", line 16, in swig_import_helper
    return importlib.import_module('_cec')
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_cec'


So, exactly the same, except now with python-3.6. The workaround still works but needed an updated path (I noticed because my program broke after updating to F26).

What needs to be done to get this fixed?

Comment 6 Peter Robinson 2017-06-18 11:28:17 UTC
> What needs to be done to get this fixed?

Report it upstream and get it fixed there and then we just consume the upstream fix

Comment 7 fednuc 2017-06-20 11:55:22 UTC
OK, I had a look upstream and seems like it might be a misuse of SWIG that no longer works.

https://github.com/Pulse-Eight/libcec/issues/356

Just renaming cec/__init__.py to cec/cec.py seems to be enough to fix this downstream for Python 3.6 (presumably 3.5 as well).

Comment 8 Fedora End Of Life 2017-11-16 19:11:45 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 fednuc 2017-11-18 11:29:25 UTC
Should be fixed in upstream master (see linked bug above) but no releases since the fix, so testing this on Fedora is pending.

Comment 10 Ben Cotton 2018-11-27 18:11:10 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 fednuc 2018-11-27 18:46:56 UTC
Still broken in F29. Looks like it was probably (?) fixed upstream ~ 3 weeks ago.

Comment 12 Fedora Update System 2018-12-24 03:20:39 UTC
libcec-4.0.3-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-7202bb344e

Comment 13 Fedora Update System 2018-12-24 03:20:43 UTC
libcec-4.0.3-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-241639ab73

Comment 14 fednuc 2018-12-24 20:22:13 UTC
The 4.0.3-2 python3-libcec package newly requires python33, presumably it's not supposed to?

Comment 15 Peter Robinson 2018-12-25 01:13:21 UTC
(In reply to fednuc from comment #14)
> The 4.0.3-2 python3-libcec package newly requires python33, presumably it's
> not supposed to?

On which release? There's a new dep generator in rawhide that might be causing issues

Comment 16 Fedora Update System 2018-12-25 02:41:29 UTC
libcec-4.0.3-2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-7202bb344e

Comment 17 Fedora Update System 2018-12-25 03:29:29 UTC
libcec-4.0.3-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-241639ab73

Comment 18 fednuc 2018-12-25 10:48:12 UTC
> On which release? There's a new dep generator in rawhide that might be causing issues

On Fedora 28. Fedora 29 seems fine.

Comment 19 Fedora Update System 2019-01-02 02:36:54 UTC
libcec-4.0.3-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2019-01-02 04:11:01 UTC
libcec-4.0.3-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 21 fednuc 2019-01-02 13:10:24 UTC
Confirmed fixed/working with 4.0.3-2.


Note You need to log in before you can comment on or make changes to this bug.