[PyQt] Attribute type change problem while using Qt 5.12 / PyQt 5.12.1 and wildcard imports

Umit Oztosun umit at oztosun.net
Thu May 2 07:16:36 BST 2019


> On 1 May 2019, at 18:34, Kyle Altendorf <sda at fstab.net> wrote:
> 
> On 2019-05-01 05:55, Ümit Öztosun wrote:
>> Hello,
>> I have encountered a weird problem using PyQt 5.12.1 and Qt 5.12. Take
>> the following script:
>> from PyQt5.QtCore import *
>> class A(QObject):
>>    flag = True
>> a = A()
>> print a.flag
>> This outputs QCborSimpleType.True. Boolean attribute somehow converted
>> to
>> a QCborSimpleType. However, just changing the wildcard import corrects
>> output:
>> from PyQt5.QtCore import QObject
>> class A(QObject):
>>    flag = True
>> a = A()
>> print a.flag
>> Output is True this time.
> 
> What about this?  Maybe check it in both the 'working' and 'non-working' scenarios.
> 
>   import PyQt5.QtCore
>   print(PyQt5.QtCore.True)
>   print(PyQt5.QtCore.__all__)

Hi Kyle,

Checked that but PyQt5.QtCore does not have True or __all__ in both installations.

>>> PyQt5.QtCore.__all__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'PyQt5.QtCore' has no attribute '__all__'

Regards,
Umit Oztosun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190502/29385ab7/attachment.html>


More information about the PyQt mailing list