Bug 1712748 - python3-twisted - fails to import glib2reactor
Summary: python3-twisted - fails to import glib2reactor
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-twisted
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Robert-André Mauchin 🐧
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-22 08:00 UTC by Milan Crha
Modified: 2019-07-21 15:27 UTC (History)
3 users (show)

Fixed In Version: python-twisted-19.2.1-1.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-21 01:00:07 UTC
Type: Bug


Attachments (Terms of Use)
test.py (131 bytes, text/plain)
2019-05-22 08:00 UTC, Milan Crha
no flags Details

Description Milan Crha 2019-05-22 08:00:02 UTC
Created attachment 1571838 [details]
test.py

Trying to import glib2reactor in python3 fails with the below error. Try with the attached test.py, which should just print on the console "Bye", instead of error. 

> $ /usr/bin/python3 ./test.py 
> Traceback (most recent call last):
>   File "./test.py", line 3, in <module>
>     from twisted.internet import glib2reactor
>   File "/usr/lib64/python3.7/site-packages/twisted/internet/glib2reactor.py", line 19, in <module>
>     from twisted.internet import gtk2reactor
>   File "/usr/lib64/python3.7/site-packages/twisted/internet/gtk2reactor.py", line 45, in <module>
>     import gobject
> ModuleNotFoundError: No module named 'gobject'

Running it with python2 works as expected:
> $ /usr/bin/python2 ./test.py 
> Bye

According to [1], you might change "import gobject" with something else. Depending on the effort, either with ".... as gobject", or do all the related renames.

Tested with:
python2-twisted-19.2.0-1.fc30.x86_64
python3-twisted-19.2.0-1.fc30.x86_64

[1] https://stackoverflow.com/questions/37323567/install-gobject-module

Comment 1 Milan Crha 2019-05-22 08:20:12 UTC
You probably know that, but in case you might find it useful, here's something "portable":

try:
    import gobject
except ImportError:
    from gi.repository import GObject as gobject

(which I found in the project I spotted this with).

Comment 2 Robert-André Mauchin 🐧 2019-05-22 16:59:29 UTC
Upstream bug report: https://twistedmatrix.com/trac/ticket/9642

Comment 3 Fedora Update System 2019-05-22 19:08:59 UTC
python-twisted-19.2.0-3.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-ed3ce55067

Comment 4 Milan Crha 2019-05-23 13:35:17 UTC
Thanks. I see they suggest to use 'gireactor', instead of 'gtk2reactor'. I agree with the rationale about gtk2 being too old and possibly not shipped. They also claim "Possibly this module should be removed entirely", I'm not sure whether they mean the "gtk2reactor" or the "twisted" module with that "this". I hope they mean the former.

Comment 5 Miro Hrončok 2019-05-23 13:52:48 UTC
they mean the "gtk2reactor" module

Comment 6 Fedora Update System 2019-05-23 18:58:44 UTC
python-twisted-19.2.0-3.fc30 has been pushed to the Fedora 30 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-2019-ed3ce55067

Comment 7 Milan Crha 2019-05-23 19:18:18 UTC
(In reply to Miro Hrončok from comment #5)
> they mean the "gtk2reactor" module

Okay, that sounds good.

I'm sorry for a lame question, though I've basically no idea of python, the less of the 'twisted' or 'gtk2reactor'... Does anybody know whether anywhere exists a porting guide from gtk2reactor to gireactor?

Comment 8 Milan Crha 2019-05-23 19:19:50 UTC
> ...from gtk2reactor to gireactor?

Oops, "from glib2reactor to gireactor".

Comment 9 Fedora Update System 2019-06-09 22:36:33 UTC
FEDORA-2019-dbd2eccffa has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-dbd2eccffa

Comment 10 Fedora Update System 2019-06-10 01:11:07 UTC
python-twisted-19.2.1-1.fc30 has been pushed to the Fedora 30 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-2019-dbd2eccffa

Comment 11 Fedora Update System 2019-07-21 01:00:07 UTC
python-twisted-19.2.1-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2019-07-21 15:27:47 UTC
python-twisted-19.2.1-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.


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