pyuic AttributeError in RedHat 9

D

Dave

I just upgraded to Redhat 9, and I'm now seeing problems with PyQt programs
that worked in Redhat 8. Here is an example from a simple demo program
created with qt-designer, compiled with pyuic, and run under python2.2:

[macquigg@saguaro foodx]$ python2.2 food.py
Traceback (most recent call last):
File "food.py", line 34, in ?
win = MainWindow()
File "mainwindow.py", line 22, in __init__
self.fileNewAction.setIconSet(QIconSet(QPixmap.fromMimeSource("")))
AttributeError: fromMimeSource

It was a rough upgrade, with lots of files failing the verification test, so
first thing I did is force upgrade qt-designer, PyQt, sip, and python.

[root@saguaro lib]# rpm -Uvh
/home/macquigg/rpm/redhat/qt-designer-3.1.1-6.i386.rpm --replacepkgs
Preparing... ##################################[100%]
1:qt-designer ##################################[100%]
[root@saguaro lib]# rpm -V qt-designer
[root@saguaro lib]# rpm -Uvh
/home/macquigg/rpm/redhat/python-2.2.2-26.i386.rpm --replacepkgs
Preparing... ##################################[100%]
1:python ##################################[100%]
[root@saguaro lib]# rpm -V python
[root@saguaro lib]# rpm -Uvh
/home/macquigg/rpm/redhat/PyQt-3.5-5.i386.rpm --replacepkgs
Preparing... ##################################[100%]
1:pyQt ##################################[100%]
[root@saguaro lib]# rpm -V PyQt
[root@saguaro lib]# rpm -Uvh
/home/macquigg/rpm/redhat/sip-3.5-2.i386.rpm --replacepkgs
Preparing... ##################################[100%]
1:sip ##################################[100%]
[root@saguaro lib]# rpm -V sip
[root@saguaro lib]#

I also re-opened the project in the new qt-designer, and resaved the .ui
files, then recompiled the .py files. The new .py files are definitely
different, but I suppose this is to be expected.

--> Old mainwindow.py:
self.fileNewAction = QAction(self,"fileNewAction")
self.fileNewAction.setIconSet(QIconSet(uic_load_pixmap_MainWindow("")))

--> New mainwindow.py:
self.fileNewAction = QAction(self,"fileNewAction")
self.fileNewAction.setIconSet(QIconSet(QPixmap.fromMimeSource("")))

The AttributeError remains. Any suggstions what to try next?



Note: I have also installed python2.3 (from python.org). They say they
have been careful not to step on previous files, but I suppose there is a
possibility.

-- Dave
 
D

Dave

I've got a simpler sequence that demonstrates the problem. I now believe
it is a missing definition in qt.libqtc ( part of the package
PyQt-3.5-5.i386.rpm ). Before filing a bug report, I just wanted to see if
I'm missing something obvious.

--> Using Red Hat 9 with python-2.2.2 and PyQt-3.5:
[macquigg@saguaro macquigg]$ python

Python 2.2.2 (#1, Feb 24 2003, 19:13:11)

[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2

....

['__del__', '__doc__', '__init__', '__module__', 'arrowCursor', 'black',

'blankCursor', 'blue', 'color0', 'color1', 'crossCursor', 'cyan',
'darkBlue',

'darkCyan', 'darkGray', 'darkGreen', 'darkMagenta', 'darkRed', 'darkYellow',

'forbiddenCursor', 'gray', 'green', 'ibeamCursor', 'lightGray', 'magenta',

'pointingHandCursor', 'red', 'sizeAllCursor', 'sizeBDiagCursor',

'sizeFDiagCursor', 'sizeHorCursor', 'sizeVerCursor', 'splitHCursor',

'splitVCursor', 'upArrowCursor', 'waitCursor', 'whatsThisCursor', 'white',

'yellow']

--> There is no attribute 'QPixmap.fromMimeSource'

Traceback (most recent call last):

File "<stdin>", line 1, in ?

AttributeError: fromMimeSource



--> Here is the definition of QPixmap (from qt.py):



class QPixmap(QPaintDevice,Qt):

def __init__(self,*args):

libqtc.sipCallCtor(221,self,args)

....

<module 'libqtc' from 'libqtcmodule.so'>

....

[macquigg@saguaro site-packages]$ rpm -qf libqtcmodule.so

PyQt-3.5-5

....





-- Dave
 
D

Dave

I'm going to try one more test before filing the bug report. I'll set up a
fresh partition, and see if this fails in a virgin installation of RedHat 9.
That will eliminate any possibility of a problem arising from the messy
upgrade process.

Has anyone gotten PyQt to work in RedHat 9?

-- Dave
 
D

Dave

In case anyone is following this thread, I found the solution to the
QPixmap.fromMimeSource Attribute error. The missing attributes are
available in a later version of PyQt. Here is what I did to fix the setup
in Redhat 9:

To review, if you try to use Qt Designer with Python in Redhat 9, and you
see an error like this when trying to run a file compiled by pyuic:

Traceback (most recent call last):

File "food.py", line 34, in ?

win = MainWindow()

File "mainwindow.py", line 22, in __init__

self.fileNewAction.setIconSet(QIconSet(QPixmap.fromMimeSource("")))

AttributeError: fromMimeSource



The problem is PyQt-3.5-5 distributed with Redhat 9 does not support
qt-designer-3.1.1-6 which also comes with Redhat 9. To fix this, you need
to update the following packages:

Uninstall:

rpm -e sip-devel

rpm -e PyQt-devel

rpm -e PyQt



Install:

rpm -Uvh qscintilla-1.53-0.i386.rpm

rpm -Uvh sip-3.7-1.20030811.0.i386.rpm

rpm -Uvh PyQt-3.7-1.i386.rpm


The new packages are available on Sourceforge at
http://sourceforge.net/project/showfiles.php?group_id=61057

Qt and Python are a dynamite combination!! The new IDE in Python2.3 really
rocks!!

Redhat 9 sucks. I'm installing Debian tomorrow.

-- Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top