os.read in non blocking mode of os.open : resource busy error
Kushal Kumaran
kushal.kumaran+python at gmail.com
Sun Jun 21 05:47:45 EDT 2009
On Wed, Jun 17, 2009 at 7:18 PM, kshama nagaraj<kshama.nagaraj at gmail.com> wrote:
> Dear all,
>
> I am using os.open to open a tun/tap device and then read data from it.
> I also need to do some other tasks apart from reading from this device. So i
> wish to have the read non blocking.
> I am opening the device in non-block mode using os.O_NONBLOCK .
> But, if i do this, i get an error when i call the os.read a follows:
>
> File "./tunnel_more1.py", line 305, in main_loop
> payload = os.read(self.tun_fd,64)
> OSError: [Errno 11] Resource temporarily unavailable
>
>From the glibc documentation of read:
`EAGAIN'
Normally, when no input is immediately available, `read'
waits for some input. But if the `O_NONBLOCK' flag is set
for the file (*note File Status Flags::), `read' returns
immediately without reading any data, and reports this error.
And from ipython:
In [1]: import errno
In [2]: print errno.EAGAIN
11
That's your error 11.
> I am running my application with GNU Radio on Ubuntu.
>
> Can some one tell me, what is the error? What are the ways to use non
> blocking read?
>
> thanks all for your time and attention.
>
>
More information about the Python-list
mailing list