Open mdickinson opened 5 years ago
@corranwebster, thank you, it is more safe for me to use ETS_TOOLKIT=qt
(qt4
is too archaic nowadays:) I belately saw the warnings being related to enthought/pyface/issues/288, and also enthought/pyface/issues/287 for a similar PR and some discussion.
@mdickinson, just a note: I guessed it is a Traits issue from the last part of a backtrace:
File "/usr/lib/python3/dist-packages/traits/trait_handlers.py", line 236, in error
object, name, self.full_info(object, name, value), value
traits.trait_errors.TraitError: The '_position' trait of a MayaviViewer instance must be a tuple of the form: (a value of class 'int', a value of class 'int'), but a value of wx.Point(900, 730) <class 'wx._core.Point'> was specified.
=============================== RESTART: Shell ===============================
>>>
EDITS: Interesting, with QT_API=pyqt ETS_TOOLKIT=qt4
I'm getting the demo example meshed-and-tiled, so it appears the reported non-tiling behaviour is specific to pyqt5
. Moreover, QT_API=pyside ETS_TOOLKIT=qt4
works (the demo picture appears for a second), but the window disappears immediately after with no backtrace. I'm only getting smth unrelated upon exiting from gdb:
>>> invalid command name "140737256694600timer_event"
while executing
"140737256694600timer_event"
("after" script)
invalid command name "140737256972808config_timer_event"
while executing
"140737256972808config_timer_event"
("after" script)
[Thread 0x7ffff34c9700 (LWP 31646) exited]
[Inferior 1 (process 31642) exited normally]
EDITS2: about QT_API=pyside ETS_TOOLKIT=qt4
under Python2 I've traced it to:
[Thu Jul 4 16:52:27 2019] python2.7[4555]: segfault at 7fd698670750 ip 00007fd696119e5c sp 00007ffc584ce140 error 7 in libqspiaccessiblebridge.so[7fd696118000+25000]
and under Python3 the above is simply:
[Thu Jul 4 17:01:15 2019] python3.6[8030]: segfault at 8 ip 000000000057c2c6 sp 00007fffffffad30 error 4 in python3.6[400000+3bf000]
EDITS3: with ETS_TOOLKIT=wx
under Python2 I've traced it to:
[Thu Jul 4 16:57:18 2019] python2.7[4815]: segfault at f0 ip 00007ffff00bb452 sp 00007fffffff9208 error 4 in libgdk-3.so.0.2404.4[7ffff009c000+79000]
I assume that you are trying to run the code in the example here: https://docs.enthought.com/mayavi/mayavi/mlab.html
I think that page is assuming that you are running this inside an IPython shell with %gui=qt
. I would not expect it to work inside of Idle. You may find it more useful to ask on the ETS Users mailing list (https://groups.google.com/forum/?nomobile=true#!forum/ets-users) detailing what you are trying to do before opening an issue. There may indeed be an issue here, but it is hard to tell where the problem lies: is it Mayavi, TraitsUI, or somewhere else.
Thank you both for your attention to the reported issue. If that matters, the above edits refer to qt-at-spi (= 0.4.0-9)
and libgtk-3-0 (= 3.24.8-1ubuntu1)
under Ubuntu; see them on: https://packages.ubuntu.com/src:qt-at-spi and https://packages.ubuntu.com/src:gtk+3.0 respectively
@mprogram BTW, there's no need to copy your comments to the Traits issue. That issue is closed, and shouldn't get any more comments at this point - the behaviour being discussed isn't related to Traits, but to the various layers that live on top of Traits. Let's keep the discussion in this issue for now, until we figure out whether there's a better place.
In your traceback, traits is complaining that a trait attribute that was declared as having one type is having an object of a different type assigned to it. The error is indeed reported by Traits, and is evidence of a bug, but that bug is not in Traits itself. Both the attribute declaration, and the code that assigns the wrong value to that attribute, are in other libraries (Mayavi and PyFace, respectively); Traits is working exactly as intended in doing the type checking and complaining that the assigned type doesn't match the declared type.
Is the demo.py
that you're running from the TraitsUI repository? I was assuming that was the case, which is why I moved the issue to TraitsUI. If not, where does demo.py
come from?
demo.py
is the code I was referring to in the opening message, it is: https://docs.enthought.com/mayavi/mayavi/mlab.html (a big scientific flower)
Ah, I see. In that case, I was wrong to move the discussion here. Sorry. :-(
EDIT1: I coudn't replicate the first backtrace below, it seems that the cause was my py2-non-empty ~/.enthought
directory, and, yes, both were run with different Qt's…
@corranwebster, FYI:
there is a certain difference actually not allowing me to use qt4
over qt
under python3 (latest sources):
$ env QT_API=pyqt ETS_TOOLKIT=qt4 mayavi2 ~/demo.py
Traceback (most recent call last):
File "/usr/bin/mayavi2", line 11, in <module>
load_entry_point('mayavi==4.7.1.dev0', 'gui_scripts', 'mayavi2')()
File "/usr/lib/python3/dist-packages/mayavi/scripts/mayavi2.py", line 602, in main
mayavi.main(sys.argv[1:])
File "/usr/lib/python3/dist-packages/mayavi/plugins/app.py", line 195, in main
app.run()
File "/usr/lib/python3/dist-packages/mayavi/plugins/mayavi_workbench_application.py", line 81, in run
window.open()
File "/usr/lib/python3/dist-packages/pyface/workbench/workbench_window.py", line 144, in open
self._create()
File "/usr/lib/python3/dist-packages/pyface/ui/qt4/application_window.py", line 130, in _create
contents = self._create_contents(self.control)
File "/usr/lib/python3/dist-packages/pyface/workbench/workbench_window.py", line 229, in _create_contents
self._restore_contents()
File "/usr/lib/python3/dist-packages/pyface/workbench/workbench_window.py", line 812, in _restore_contents
self.layout.set_toolkit_memento(self._memento)
File "/usr/lib/python3/dist-packages/pyface/ui/qt4/workbench/workbench_window_layout.py", line 299, in set_toolkit_memento
self.window.control.restoreGeometry(geometry)
TypeError: restoreGeometry(self, Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type 'PySide2.QtCore.QByteArray'
compare:
$ env QT_API=pyqt5 ETS_TOOLKIT=qt mayavi2 ~/demo.py
Exception occurred in traits notification handler for object: <mayavi.filters.poly_data_normals.PolyDataNormals object at 0x7f3b70a68f10>, trait: name, old value: PolyDataNormals, new value:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 591, in _dispatch_change_event
self.dispatch(handler, *args)
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 695, in dispatch
handler(*args)
File "/usr/lib/python3/dist-packages/traitsui/tree_node.py", line 1899, in wrapped_listener
return listener(node, name, new)
File "/usr/lib/python3/dist-packages/traitsui/qt4/tree_editor.py", line 1618, in _label_updated
for name2, nid in self._map[id(object)]:
KeyError: 139893325684232
ERROR|2019-07-06 22:55:26,154|Exception occurred in traits notification handler for object: <mayavi.filters.poly_data_normals.PolyDataNormals object at 0x7f3b70a68f10>, trait: name, old value: PolyDataNormals, new value:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 591, in _dispatch_change_event
self.dispatch(handler, *args)
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 695, in dispatch
handler(*args)
File "/usr/lib/python3/dist-packages/traitsui/tree_node.py", line 1899, in wrapped_listener
return listener(node, name, new)
File "/usr/lib/python3/dist-packages/traitsui/qt4/tree_editor.py", line 1618, in _label_updated
for name2, nid in self._map[id(object)]:
KeyError: 139893325684232
Exception occurred in traits notification handler for object: <mayavi.modules.surface.Surface object at 0x7f3b708cc410>, trait: name, old value: Surface, new value:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 591, in _dispatch_change_event
self.dispatch(handler, *args)
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 695, in dispatch
handler(*args)
File "/usr/lib/python3/dist-packages/traitsui/tree_node.py", line 1899, in wrapped_listener
return listener(node, name, new)
File "/usr/lib/python3/dist-packages/traitsui/qt4/tree_editor.py", line 1618, in _label_updated
for name2, nid in self._map[id(object)]:
KeyError: 139893325684232
ERROR|2019-07-06 22:55:26,183|Exception occurred in traits notification handler for object: <mayavi.modules.surface.Surface object at 0x7f3b708cc410>, trait: name, old value: Surface, new value:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 591, in _dispatch_change_event
self.dispatch(handler, *args)
File "/usr/lib/python3/dist-packages/traits/trait_notifiers.py", line 695, in dispatch
handler(*args)
File "/usr/lib/python3/dist-packages/traitsui/tree_node.py", line 1899, in wrapped_listener
return listener(node, name, new)
File "/usr/lib/python3/dist-packages/traitsui/qt4/tree_editor.py", line 1618, in _label_updated
for name2, nid in self._map[id(object)]:
KeyError: 139893325684232
It actually runs well despite KeyError
's which is a fallout of enthought/mayavi/issues/797 I guess, but it doen't do so well with qt4
(edits: well. it does now).
@mdickinson, may you have a second look if the issue is in a right place, then?
EDIT2: Interesting, under python2 the following happens intermittently:
$ rm -rf ~/.enthought && env ETS_TOOLKIT=wx mayavi2 ~/demo.py
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pyface/ui/wx/splash_screen.py", line 118, in _on_paint
dc = wx.PaintDC(window)
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_gdi.py", line 5130, in __init__
_gdi_.PaintDC_swiginit(self,_gdi_.new_PaintDC(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "IsOk()" failed at ../src/common/dcgraph.cpp(437) in SetTextBackground(): wxGCDC(cg)::SetTextBackground - invalid DC
<repeated>
[Issue migrated from enthought/traits#497]
@mprogram commented on Thu Jul 04 2019
https://docs.enthought.com/mayavi/mayavi/mlab.html
in IDLE:
also enthought/pyface/issues/416
@mprogram commented on Thu Jul 04 2019
Does the backend matter? I'm getting a non-tiled mesh under
ETS_TOOLKIT=qt
, whereas underwx
it is both, meshed and tiled.@corranwebster commented on Thu Jul 04 2019
We don't currently support WxPython 4 - there are branches of Pyface and TraitsUI which have support for WxPython 4, but I don't know about the state of Mayavi and WxPython, for example.
You want
env QT_API=pyside2 ETS_TOOLKIT=qt4
instead ofwx
most likely. Other caveats are that pyside2 support is experimental (PyQt4 and PyQt5 should work just fine) and I also would be cautious about trying to run from inside Idle which uses Tkinter, I think, unless it is starting up your app in a new process.@mdickinson commented on Thu Jul 04 2019
I'm going to (attempt to) move this issue to the TraitsUI repository. It's not a Traits issue.