serial readline thread IO Error (9, 'Bad file descriptor')

Discussion in 'Python' started by nik, Jun 19, 2007.

  1. nik

    nik Guest

    Hi,
    How can I close a thread that is waiting on a file/port down
    gracefully, and not have an IO error pop up?

    I am having trouble closing a thread that is listening to the serial
    port. I have a thread that calls uses a pySerial serial port and calls
    readline() without a timeout, which is blocking. When I am shutting
    down the application I close the serial port, which causes the IO
    error: (9, 'Bad file descriptor'). It makes sense that we would get
    this error, because it is trying to read off of a closed 'file'. Is
    there a better way to close this thread and port down?

    Thanks,
    Nik
     
    nik, Jun 19, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin
    Replies:
    4
    Views:
    1,103
    David Bolen
    Jul 7, 2003
  2. drs
    Replies:
    0
    Views:
    390
  3. Replies:
    9
    Views:
    759
    Abhijit Soman
    Jan 6, 2005
  4. Vishnu
    Replies:
    0
    Views:
    528
    Vishnu
    Jan 6, 2005
  5. lynology

    Bad File Descriptor Error on strcat/strcpy

    lynology, Aug 18, 2004, in forum: C Programming
    Replies:
    4
    Views:
    541
    Chris Torek
    Aug 18, 2004
Loading...

Share This Page