By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,550 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,550 IT Pros & Developers. It's quick & easy.

select() on WinXP

P: n/a
I'm running Python 2.5 on Windows XP. When I try to do this:

Expand|Select|Wrap|Line Numbers
  1. import select
  2. select.select([], [], [])
  3.  
I get this:

[output]
Traceback (most recent call last):
File "C:/Documents and Settings/Grebekel/Desktop/s.py", line 2, in
<module>
select.select([],[],[])
error: (10022, 'An invalid argument was supplied')
[/output]

Is there anything I should be aware of to get select() working under
Windows?

Nov 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
gr******@gmail.com wrote:
I'm running Python 2.5 on Windows XP. When I try to do this:

Expand|Select|Wrap|Line Numbers
  1. import select
  2. select.select([], [], [])
  3.  

I get this:

[output]
Traceback (most recent call last):
File "C:/Documents and Settings/Grebekel/Desktop/s.py", line 2, in
<module>
select.select([],[],[])
error: (10022, 'An invalid argument was supplied')
[/output]

Is there anything I should be aware of to get select() working under
Windows?
like, say, only calling select if you actually have something you want to select on?

(if you want to sleep, use time.sleep())

</F>

Nov 23 '06 #2

P: n/a
I'm using it for sockets, it works on linux but not on Windows. The
actual code is something like (server side):

r, w, e = select.select(self.clients, [], self.clients, 5)

where self.clients is a list of accepted sockets.

Nov 23 '06 #3

P: n/a
gr******@gmail.com schrieb:
I'm using it for sockets, it works on linux but not on Windows. The
actual code is something like (server side):

r, w, e = select.select(self.clients, [], self.clients, 5)

where self.clients is a list of accepted sockets.
The docs for select.select say:

Empty sequences are allowed, but acceptance of three empty sequences is platform-dependent.
(It is known to work on Unix but not on Windows.)

Thomas

Nov 23 '06 #4

P: n/a
I patched the code to:

if self.clients:
r, w, e = select.select(self.clients, [], self.clients, 5)

It works now, thank you Thomas :)

Nov 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.