I am developing a small graphical application using Python 3 and PyQt5. On the first computer, I use where only PyQt5 is installed, everything in my code is fine. But when I want to run my code on another laptop where PyQt4 and PyQt5 are installed, I get the following error:
RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class
The Python interpreter detects an error in the file "ViewWindow.py", is called from the main file.
Since I have both PyQt4 and PyQt5 on this laptop, and because I cannot remove PyQt4 (that would be too easy ...), I wonder if it is possible to force the use of PyQt5.QtCore or something else to avoid this problem. My configuration on this laptop: Debian 8, Python3.4, PyQt4 and 5 (without a special configuration installed from the Debian repositories), IDE = Spyder.
I put the first lines of my files there main.pyand ViewWindow.py.
import sys
import sqlite3
import ViewWindow
from DataWindow import DataWindow
from PyQt5.QtCore import QObject
from PyQt5.QtWidgets import (QApplication,
QWidget,
QGridLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QTextEdit,
QVBoxLayout
)
class MainWindow(QWidget):
import sys
import sqlite3
from PyQt5.QtCore import QObject
from PyQt5.QtWidgets import (QApplication,
QWidget,
QGridLayout,
QLabel,
QPushButton,
QVBoxLayout
)
class ViewWindow(QWidget):
Does anyone know how to make this code run?
Thank,
Jerry M.
Edit: I tried to run this script forcing to use Python3, and it worked ... It seems that the problem comes from iPython3. Thank you for your help.