Bug 1008392

Summary: [abrt] Mayavi-4.3.0-2.fc19: pygments_highlighter.py:148:highlightBlock:AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack'
Product: [Fedora] Fedora Reporter: Benny <mail2benny>
Component: MayaviAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: eusoubrasileiro, orion
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:7e50eda366cf81b8356d15f7458a8c7cbc3f1714
Fixed In Version: python-pyface-4.3.0-4.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-30 00:46:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description Benny 2013-09-16 10:04:15 UTC
Description of problem:
Startup Mayavi --> This error

Version-Release number of selected component:
Mayavi-4.3.0-2.fc19

Additional info:
reporter:       libreport-2.1.7
cmdline:        /usr/bin/python /usr/bin/mayavi2
dso_list:       python-pyface-4.3.0-2.fc19.noarch
executable:     /usr/bin/mayavi2
kernel:         3.10.11-200.fc19.x86_64
runlevel:       N 5
type:           Python
uid:            1000

Truncated backtrace:
pygments_highlighter.py:148:highlightBlock:AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack'

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pyface/ui/qt4/python_shell.py", line 492, in highlightBlock
    super(PythonWidgetHighlighter, self).highlightBlock(string)
  File "/usr/lib/python2.7/site-packages/pyface/ui/qt4/code_editor/pygments_highlighter.py", line 148, in highlightBlock
    self._lexer._epd_state_stack = prev_data.syntax_stack
AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack'

Local variables in innermost frame:
self: <pyface.ui.qt4.python_shell.PythonWidgetHighlighter object at 0x5076320>
prev_data: <PyQt4.QtGui.QTextBlockUserData object at 0x5999d40>
qstring: u'Please check the log file for details.'

Comment 1 Benny 2013-09-16 10:04:23 UTC
Created attachment 798198 [details]
File: backtrace

Comment 2 Benny 2013-09-16 10:04:25 UTC
Created attachment 798199 [details]
File: environ

Comment 3 Orion Poplawski 2013-09-16 16:43:03 UTC
Try installing wxPython.  The problem seems to be that Mayavi doesn't work well with the pyface Qt backend.  I hope to have some updates out soon to fix this, but installing wxPython should do the trick.

Comment 4 Benny 2013-09-17 07:43:36 UTC
Installing wxPython fixed the problem. Thanks!
Maybe wxPython should be added to the dependency list?

Comment 5 Fedora Update System 2013-09-17 16:08:24 UTC
python-pyface-4.3.0-4.fc19, Mayavi-4.3.0-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-pyface-4.3.0-4.fc19,Mayavi-4.3.0-6.fc19

Comment 6 Benny 2013-09-18 07:36:35 UTC
To test this I need python-pyface-wx and python-pyface-qt (as is stated). 

Additionally, when I run a script like this: 
#!/usr/bin/env python
import sys 
import numpy as np
fname=sys.argv[1]
x,y,z,nnn=np.loadtxt(fname,delimiter=';',usecols=(1,2,3,4),unpack=True)
from mayavi import mlab
mlab.options.offscreen=True
mlab.figure(1,fgcolor=(0,0,0),bgcolor=(1,1,1),size=(1280,1024))
pts=mlab.points3d(x,y,z,nnn,scale_mode='none',scale_factor=0.0,colormap='jet',vmin=3.0,vmax=8.0)
mesh=mlab.pipeline.delaunay2d(pts)
mlab.pipeline.surface(mesh,representation='wireframe',line_width=1.333,colormap='jet',vmin=3.0,vmax=8.0)
mlab.view(elevation=30,azimuth=-90)
mlab.savefig('dl-'+fname.rsplit(".",1)[0]+'.png')

I obtain this error:
QWidget: Must construct a QApplication before a QPaintDevice
Aborted (core dumped)

(maybe this helps https://mail.enthought.com/pipermail/enthought-dev/2012-March/030750.html )

Is this related to this bug or should I file a new one?

Comment 7 Fedora Update System 2013-09-18 13:00:41 UTC
Package python-pyface-4.3.0-4.fc19, Mayavi-4.3.0-6.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-pyface-4.3.0-4.fc19 Mayavi-4.3.0-6.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17000/python-pyface-4.3.0-4.fc19,Mayavi-4.3.0-6.fc19
then log in and leave karma (feedback).

Comment 8 Orion Poplawski 2013-09-18 15:32:12 UTC
I think that is a separate issue.  pyface is loading the wx toolkit as expected, but something else is going awry.

Looks like this fixes it: https://github.com/enthought/mayavi/pull/64/files

Try that and let me know if you run into any other problems.

Comment 9 Benny 2013-09-19 07:36:01 UTC
Everything seems to work for now :) 

I updated to the newer version and added the fix in "https://github.com/enthought/mayavi/pull/64/files" and that seems to work like charm.

Much obliged.

Comment 10 Fedora Update System 2013-09-21 08:32:54 UTC
Package python-pyface-4.3.0-4.fc19, Mayavi-4.3.0-7.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-pyface-4.3.0-4.fc19 Mayavi-4.3.0-7.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17000/python-pyface-4.3.0-4.fc19,Mayavi-4.3.0-7.fc19
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-09-30 00:46:29 UTC
python-pyface-4.3.0-4.fc19, Mayavi-4.3.0-7.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Andre F. 2013-10-21 20:16:12 UTC
I've still have the same problem with:

Python 2.7.5 (default, Oct  8 2013, 12:19:40) 
[GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mayavi import mlab
QWidget: Must construct a QApplication before a QPaintDevice
Aborted (core dumped)

Linux 3.11.4-201.fc19.x86_64


(In reply to Benny from comment #6)
> To test this I need python-pyface-wx and python-pyface-qt (as is stated). 
> 
> Additionally, when I run a script like this: 
> #!/usr/bin/env python
> import sys 
> import numpy as np
> fname=sys.argv[1]
> x,y,z,nnn=np.loadtxt(fname,delimiter=';',usecols=(1,2,3,4),unpack=True)
> from mayavi import mlab
> mlab.options.offscreen=True
> mlab.figure(1,fgcolor=(0,0,0),bgcolor=(1,1,1),size=(1280,1024))
> pts=mlab.points3d(x,y,z,nnn,scale_mode='none',scale_factor=0.0,
> colormap='jet',vmin=3.0,vmax=8.0)
> mesh=mlab.pipeline.delaunay2d(pts)
> mlab.pipeline.surface(mesh,representation='wireframe',line_width=1.333,
> colormap='jet',vmin=3.0,vmax=8.0)
> mlab.view(elevation=30,azimuth=-90)
> mlab.savefig('dl-'+fname.rsplit(".",1)[0]+'.png')
> 
> I obtain this error:
> QWidget: Must construct a QApplication before a QPaintDevice
> Aborted (core dumped)
> 
> (maybe this helps
> https://mail.enthought.com/pipermail/enthought-dev/2012-March/030750.html )
> 
> Is this related to this bug or should I file a new one?

Comment 13 Orion Poplawski 2013-10-22 04:32:35 UTC
(In reply to Andre F. from comment #12)
> I've still have the same problem with:
> 
> Python 2.7.5 (default, Oct  8 2013, 12:19:40) 
> [GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from mayavi import mlab
> QWidget: Must construct a QApplication before a QPaintDevice
> Aborted (core dumped)

What version of Mayavi and python-pyface do you have?

Comment 14 Andre F. 2013-10-22 12:33:44 UTC
There it goes.

[andre@dell1555fedora ~]$ rpm -q python-pyface
python-pyface-4.3.0-4.fc19.noarch
[andre@dell1555fedora ~]$ rpm -q Mayavi
Mayavi-4.3.0-7.fc19.x86_64

Any more info needed?

Comment 15 Andre F. 2013-10-22 17:03:52 UTC
Forget what about my bug, I had another installation of mayavi in my site-packages mayavi-4.3.0-py2.7-linux-x86_64.egg .... Really sorry I mixed easy_install with yum install. Just removed it everything working fine.