[PyKDE] PyQt4 and Python2.3

Andreas Pakulat apaku at gmx.de
Thu Jul 6 10:06:42 BST 2006


On 06.07.06 10:37:11, Torsten Marek wrote:
> Andreas Pakulat wrote:
> > PyQt4 entered Debian/Sid today and I had to try wether my apps also work
> > under the "system python" now. Unfortunately they don't and I'd just
> > like a confirmation that this is "intentional". Debian/Sid still uses
> > python2.3 as standard system python and that one doesn't know decorators
> > yet, as it seems. So if decorators only work with Python 2.4, this
> > should be stated in the docs regarding auto-connection and also I think
> > a note should appear in the README.
> > 
> > If decorators should work with python2.3, I'd like to why this doesn't
> > work:
> > 
> > andreas at morpheus:~/projects/xpathevaluator>PYTHONPATH=$PWD /usr/bin/python2.3 xpathevaluator/xpathevaluator.py
> > Traceback (most recent call last):
> >   File "xpathevaluator/xpathevaluator.py", line 57, in ?
> >     sys.exit(run())
> >   File "xpathevaluator/xpathevaluator.py", line 35, in run
> >     from xpathwidget import XPathWidget
> >   File "/home/andreas/projects/xpathevaluator/xpathevaluator/xpathwidget.py", line 198
> >     @pyqtSignature("on_fileButton_clicked()")
> >     ^
> > SyntaxError: invalid syntax
> 
> decorators don't work with Python 2.3, they are a Python 2.4 feature.

That's what I guessed already...

> With Python 2.3, you need to use the decorators the old way, like staticmethod
> was used etc.

Can you give me an example for this (via PM if you want to)? Would it
then be possible to do something like

if python_version==2.4:
  @pyqtSignature..
else:
  <the older decorator-stuff>
def the_slot():

Does PyQt4 allow that, Phil?

Or at least
if python_version=2.4:
  @pyqtSignature
def the_slot():

And in the constructor of the class I could check wether
python_version==2.3 and then manually connect the slots?

I'd really like to have the programs work with Python2.3 and Python2.4.

Andreas


-- 
You will be winged by an anti-aircraft battery.




More information about the PyQt mailing list