Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > serial readline thread IO Error (9, 'Bad file descriptor')

Thread Tools

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

Posts: n/a
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?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling python 3.1.2 with local readline fails to get readline - help! gavino Python 4 09-20-2010 05:17 AM
Raw_input with readline in a daemon thread makes terminal textdisappear John O'Hagan Python 3 10-23-2009 01:22 AM
Getting application ReadLine and Perl debugger ReadLine to cooperate Andrew DeFaria Perl Misc 1 01-30-2008 11:46 PM
Readline::readline() blocking all other threads Jean-Michel Ruby 0 12-22-2007 01:00 AM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM