[PyQt] PyQt5 QtSerialPort Error "QSocketNotifier: Invalid socket specified"

Dan Arbogast arbogastdan at gmail.com
Mon Sep 12 17:10:36 BST 2016


Thanks for the response Phil, I tried substituting open() in place of
setOpenMode() and now the output is:

ttyUSB0
ttyUSB1
False
QSocketNotifier: Can only be used with threads started with QThread
True
0
QSocketNotifier: Can only be used with threads started with QThread
0

So now both the open() and writeData() lines show a new QSocketNotifier
error.

There are several examples out there for how to use QtSerialPort with C++
but nothing I could find for Python.  Do you know of any?  I shouldn't be
this hard.

Dan


On Sat, Sep 10, 2016 at 10:45 AM, Phil Thompson <phil at riverbankcomputing.com
> wrote:

> On 6 Sep 2016, at 4:49 pm, Dan Arbogast <arbogastdan at gmail.com> wrote:
> >
> > I'm trying to use QtSerialPort for a PyQt5 project but haven't found the
> magic. Right now the code seems to be opening the port fine but I'm getting
> "QSocketNotifier: Invalid socket specified" error whenever I try to write
> to the open port. The code is attached.
> >
> > Running Ubuntu 16.04, PyQt5, Qt 5.6.0
> >
> > The output from this code on my machine is:
> >
> > ttyUSB0
> > ttyUSB1
> > False
> > True
> > QSocketNotifier: Invalid socket specified
> >
> > Any idea what is causing the QSocketNotifier error, or how to
> troubleshoot it?  If you run this on your machine do you get the same error?
> >
> > Thanks for any help you might share.
>
> Try calling open() rather than setOpenMode().
>
> Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160912/d9d20da2/attachment.html>


More information about the PyQt mailing list