After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748198 - draw event never happens inside virtualenv
draw event never happens inside virtualenv
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-20 16:10 UTC by Stuart Axon
Modified: 2016-06-07 08:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Print exception if marshalling a signal argument fails. (907 bytes, patch)
2016-06-06 09:38 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Stuart Axon 2015-04-20 16:10:53 UTC
If 'gi' is a symlink (a common thing to do in virtualenv).   Everything seems to work as normal, except the draw events never happen.

The following program shows the issue

https://gist.github.com/stuaxo/c453c759fadc8d615490


# output outside virtualenv, using 'gi' [OK]
$ python no_draw_if_gi_is_symlink.py
using gi
Draw
Draw

# create a virtualenv using '--site-packages' [OK]
$ virtualenv env1 --system-site-packages
$ . env1/bin/activate.sh
$ python no_draw_if_gi_is_symlink.py
using gi
Draw
Draw
$ deactivate

# create a virtualenv and symlink in 'gi' .. [FAIL]
$ virtualenv env2
$ . env2/bin/activate.sh
$ pushd $VIRTUAL_ENV/lib/python2.7/site-packages
$ ln -si /usr/lib/python2.7/dist-packages/gi
$ popd
$ python no_draw_if_gi_is_symlink.py
using gi

^^ No 'Draw' !!!


$ deactivate
Comment 1 Christoph Reiter (lazka) 2015-04-20 16:33:49 UTC
You're missing a

pushd $VIRTUAL_ENV/lib/python2.7/
ln -s ln -s /usr/lib/pymodules/python2.7/cairo/
popd

No idea why this results in the missing signal and no error message.
Comment 2 Stuart Axon 2015-04-20 17:41:59 UTC
That works ...  it would be really good if pygobject could raise 

ImportError: No module named cairo

if anything that needs cairo is called, and it's not accessible for some reason.
Comment 3 Christoph Reiter (lazka) 2016-06-06 09:38:48 UTC
Created attachment 329177 [details] [review]
Print exception if marshalling a signal argument fails.

For example if cairo support is missing, a Gtk.Widget::draw call
will result in
"TypeError: Couldn't find foreign struct converter for 'cairo.Context'"