conda-forge / pyqt-feedstock

A conda-smithy repository for pyqt.
BSD 3-Clause "New" or "Revised" License
5 stars 36 forks source link

AttributeError on some enums only on Windows #72

Closed djhoese closed 4 years ago

djhoese commented 4 years ago

Issue:

I'm writing some tests for the uwsift package which is a PyQt5-based GUI application. I'm writing tests for a QWizard dialog and as part of that need to access the QWizard.WizardButton.NextButton enum (https://doc.qt.io/qt-5/qwizard.html#WizardButton-enum). This works fine on Linux and OSX, but on Windows on Travis CI I get an AttributeError:

>       assert wiz.button(QWizard.WizardButton.NextButton).isEnabled()
E       AttributeError: type object 'WizardButton' has no attribute 'NextButton'

See the travis job here: https://travis-ci.org/ssec/sift/jobs/621409537#L1234

The environment for this build has PyQt 5.12.3 and Qt 5.12.5. I was hoping the people here with more experience with PyQt could help me out. I'm posting this here instead of with the PyQt people because my initial guess is that something was built weird in conda-forge.

Any ideas?

djhoese commented 4 years ago

I got access to a Windows machine and I think this is a build issue with the conda-forge package. If I take a conda environment that produces the AttributeError, do conda uninstall -y pyqt, followed by pip install pyqt5 (the wheel), and then do the same test it works fine.

To recreate on Windows (assume conda-forge):

conda create -n test python=3.7 pyqt
conda activate test
python -c "from PyQt5.QtWidgets import QWizard; QWizard.NextButton"

To make a working environment:

conda activate test
conda uninstall -y pyqt
pip install pyqt5
python -c "from PyQt5.QtWidgets import QWizard; QWizard.NextButton"
hmaarrfk commented 4 years ago

I"m also having trouble with this pyqt=5.12 package. Version 5.9 works "better", but what I can download from pypi and pyside2 seem to crash my application the least....

hard to tell what the actual source is.

djhoese commented 4 years ago

Yeah I haven't tested pyside. The pyqt5 on PyPI was compatible with the qt on conda-forge (or maybe it was using its own bundled Qt, not sure).

hmaarrfk commented 4 years ago

It might be related to this: https://github.com/GNS3/gns3-gui/issues/2819

djhoese commented 4 years ago

@hmaarrfk What part from that issue are you looking at? I've only seen this issue on Windows and that issue seems to talk about all platforms. Either way they talk about 5.13.1 fixing their issue so we might get lucky with that version on conda-forge.

hmaarrfk commented 4 years ago

My issue was when I tried to add @property to my class, that was a subclass of some qt object. I had to remove that pythonic construct and go back to get_my_attribute and set_my_attribute

jschueller commented 4 years ago

I cannot reproduce the issue with the latest version

djhoese commented 4 years ago

Verified this on my own Windows 10 VM. Looks good with the latest build (build 2). Thanks for checking @jschueller.