as the summary says. In python3, None is illegal for user defined attributes. Please define a new name like NoButton for both python2-pykde4 and python3-pykde4 (and KF5 of course), otherwise it is more difficult to write portable python code. See https://docs.python.org/3.2/library/constants.html actually this was illegal even with Python2.7, but it seems its C bindings did not enforce that, letting pykde4 get through with that bug: https://docs.python.org/2.7/library/constants.html Please check if there are more such definitions for constants None, False, True This fails with python 3.4.0: i5:[Exit 1 (SIGHUP)]~/vpn/kajongg/src (master) cat xx.py ; python3 xx.py from PyKDE4.kdeui import KDialog # print(KDialog.Default) this works as expected print(KDialog.None) # this fails with a syntax error File "xx.py", line 3 print(KDialog.None) # this fails with a syntax error ^ SyntaxError: invalid syntax
Isn't this an upstream issue? I get the same thing with PyQt4 and Python 3 if I try to access QAbstractPrintDialog::None as QAbstractPrintDialog.None.
Ah, so the symbol is actually exposed by a Qt superclass? Yeah, then this is an upstream issue. A workaround would be getattr(KDialog, 'None'), i guess.
In KDialog's case, the symbol comes from KDialog itself. My point is that PyQt has the same problem with enums in Qt that have "None" as one of their values.
Maybe the best idea would be to make SIP/DIP automatically create a “<keyword>_” property when encountering a python keyword? because the same problem (but more visibly) also existed for exec() on python 2, which is why PyQt has an exec_() alias for it. so something like: for cpp_fieldname in ...: field_proxy = ... if cpp_fieldname in python_keywords: setattr(current_python_class, cpp_fieldname + '_', field_proxy) setattr(current_python_class, cpp_fieldname, field_proxy)
Dear Bug Submitter, This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond. Thank you for helping us make KDE software even better for everyone!
Hello, unfortunately this bug is being closed as unmaintained, per request of einar77.