question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

qtpy import overrides pyqt5 import

See original GitHub issue

Problem Description

It seems that starting spyder and running code in the interactive console overrides imports of pyqt. This can lead to strange issues when running the code somewhere else even using the same environment. In the description below, this is assumed, e.g. running either in spyder interactive terminal or running using ipython from the same environment (where python can be used to reproduce too)

Sample, works:

from qtpy import QtCore
QtCore.Signal()

Sample 2, works:

from pyqt5 import QtCore
QtCore.pyqtSignal()

Sample 3, fails in cmd, works in spyder:

from pyqt5 import QtCore
QtCore.Signal()

What steps reproduce the problem?

  1. Run the sample 3 in spyder using F5
  2. Run the sample 3 from cmd
  3. Signal / Slot import will either fail or work.

What is the expected output? What do you see instead?

This is due the override of pyqtSignal with Signal in qtpy.QtCore I guess. I just dont see this being a consistent bevavior or I dont understand the reasoning.

Paste Traceback/Error Below (if applicable)

Import error due to Signal has been moved to pyqtSignal in pyqt5+

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
max3-2commented, Feb 23, 2022

I will double check bot not that I know of. Strange… I will check my virtualenv maybe something is mixed up there

0reactions
ccordoba12commented, Mar 7, 2022

Closing due to lack of response. @max3-2, I hope you were able to solve this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding paintEvent in PyQt5 and PySide2 - Stack Overflow
I never had this problem in Qt4. from PySide2 import QtWidgets, QtCore, QtGui # use pyside # from PyQt5 import QtWidgets, QtCore, QtGui...
Read more >
Help overwriting a PyQT widget class and adding a ... - Qt Forum
I'm trying to create my own "ComboBox" class that inherits the QCombobox widget so I can overwrite and specifically control the pop up ......
Read more >
How to Import a PyQt5 .ui File in a Python GUI - Nitratine
In this tutorial, I am going to cover a method that allows you to import the .ui file generated by PyQt Designer directly...
Read more >
[PyQt] Overriding QStandardItem with __iter__ in PyQt5
... QT/PyQT5 versions: 5.6 Thank you for your time, t. from PyQt5 import (Qt, QtCore, QtGui, QtWidgets) from sip import SIP_VERSION import ......
Read more >
PyQt5 QSpinBox - How to override the flags - GeeksforGeeks
For example if user set Qt.CoverWindow flag to spin box, ... from PyQt5 import QtCore, QtGui ... overriding the spin box's window flags....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found