Josh
Josh

Reputation: 744

QSocketNotifier: Can only be used with threads started with QThread

I'm getting the following error with just a very basic application and with no sockets or anything fancy:

QSocketNotifier: Can only be used with threads started with QThread

Machine:

From Script.py

#!/usr/bin/python3.8
from PyQt5.QtWidgets import QApplication, QLabel
app = QApplication([])
label = QLabel('Hello World!')
label.show()
app.exec_()

Upvotes: 5

Views: 7800

Answers (2)

Morteza
Morteza

Reputation: 48

I encountered an issue while using the pyperclip library to handle copy-paste functionality in my game. The following error was raised:

QSocketNotifier: Can only be used with threads started with QThread

This was unexpected, as I was not using any Qt or PyQt libraries in my code. After some investigation, I discovered that the issue was caused by interference from Visual Studio Code (VSCode). VSCode was interacting with the environment in a way that triggered this error.

To resolve the issue, I ran the program directly from the Ubuntu terminal (outside of VSCode), and the code worked as expected without raising the error.

Upvotes: 1

Sergio Gonzalez
Sergio Gonzalez

Reputation: 1

I had a similar problem with matplotlib in python3, I solved it removing the package python3-pyqt5,then reinstalling matplotlib in python.

Upvotes: 0

Related Questions