Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

select on windows: must import socket first?

0 views
Skip to first unread message

Irmen de Jong

unread,
May 29, 2003, 5:38:47 PM5/29/03
to
When using select() on windows, without import socket first, I get this:

Python 2.3b1 (#40, Apr 25 2003, 19:06:24) [MSC v.1200 32 bit (Intel)] onwin32
Type "help", "copyright", "credits" or "license" for more information.
>>> import select
>>> select.select([],[],[])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
select.error: (10093, 'Either the application has not called WSAStartup, or
WSAStartup failed')
>>>


Is this intentionally? I can't seem to find anything in the docs that says
that I have to import socket first. (because that gets rid of this error).

--Irmen

PS. Yeah I know that select on windows doesn't like empty lists...

Grant Edwards

unread,
May 29, 2003, 5:44:04 PM5/29/03
to
In article <3ed67de7$0$49112$e4fe...@news.xs4all.nl>, Irmen de Jong wrote:
> When using select() on windows, without import socket first, I get this:
>
> Python 2.3b1 (#40, Apr 25 2003, 19:06:24) [MSC v.1200 32 bit (Intel)] onwin32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import select
> >>> select.select([],[],[])
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> select.error: (10093, 'Either the application has not called WSAStartup, or
> WSAStartup failed')
> >>>
>
>
> Is this intentionally? I can't seem to find anything in the docs that says
> that I have to import socket first. (because that gets rid of this error).

Under Windows, select can't be used for anything except
sockets, so there's really no use for importing select w/o
importing socket. I suppose you could put a call in the select
module to start up winsock if it hasn't already been done, but
what's the point?

I'm guessing that the select call is probably actually part of
winsock and not really part of Win32...

--
Grant Edwards grante Yow! Are we THERE yet? My
at MIND is a SUBMARINE!!
visi.com

Irmen de Jong

unread,
May 29, 2003, 5:53:19 PM5/29/03
to
Grant Edwards wrote:
> Under Windows, select can't be used for anything except
> sockets, so there's really no use for importing select w/o
> importing socket. I suppose you could put a call in the select
> module to start up winsock if it hasn't already been done, but
> what's the point?

There's no point, indeed.
But I was just wondering if this is a conscious omission of the init call, or
that somebody forgot something ;-)

> I'm guessing that the select call is probably actually part of
> winsock and not really part of Win32...

You're probably right.
But couldn't it be implemented using WaitForMultipleObjects() ?
Never mind. Don't want to mess with that.

--Irmen

0 new messages