Python Error 10038
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn python select.error (10038 'an operation was attempted on something that is not a socket') more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags an operation was attempted on something that is not a socket windows 7 Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, python select stdin windows helping each other. Join them; it only takes a minute: Sign up Can select() be used with files in Python under Windows? up vote 6 down vote favorite 2 I am trying to run the following python server
Python Oserror Winerror 10038
under windows: """ An echo server that uses select to handle multiple clients at a time. Entering any line of input at the terminal will exit the server. """ import select import socket import sys host = '' port = 50000 backlog = 5 size = 1024 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host,port)) server.listen(backlog) input = [server,sys.stdin] running = 1 while running: inputready,outputready,exceptready = select.select(input,[],[]) for s in inputready: if s == server: # handle the server an operation was attempted on something that is not a socket c# socket client, address = server.accept() input.append(client) elif s == sys.stdin: # handle standard input junk = sys.stdin.readline() running = 0 else: # handle all other sockets data = s.recv(size) if data: s.send(data) else: s.close() input.remove(s) server.close() I get the error message (10038, 'An operation was attempted on something that is not a socket'). This probably relates back to the remark in the python documentation that "File objects on Windows are not acceptable, but sockets are. On Windows, the underlying select() function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock.". On internet there are quite some posts on this topic, but they are either too technical for me or simply not clear. So my question is: is there any way the select() statement in python can be used under windows? Please add a little example or modify my code above. Thanks! python windows select file-io share|improve this question edited Sep 19 '12 at 22:38 Piotr Dobrogost 21.4k15119207 asked May 31 '12 at 23:04 Django 1251413 hattip @agf. Duly noted! –inspectorG4dget Jun 1 '12 at 0:17 Source of the code above: ilab.cs.byu.edu/python/threadingmodule.html –schmijos Nov 29 '13 at 14:00 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote Look like it does not like sys.stdin If you change input to t
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn sys.stdin python windows more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Select.select Python Windows
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you,
Python Select Windows
helping each other. Join them; it only takes a minute: Sign up python select.select() on Windows up vote 3 down vote favorite 4 I'm testing UDP punching using code from here. It works on Linux however reports error http://stackoverflow.com/questions/10842428/can-select-be-used-with-files-in-python-under-windows on Windows. Here's the code snippet where the error occurs: while True: rfds, _, _ = select([0, sockfd], [], []) # sockfd is a socket if 0 in rfds: data = sys.stdin.readline() if not data: break sockfd.sendto(data, target) elif sockfd in rfds: data, addr = sockfd.recvfrom(1024) sys.stdout.write(data) And error msg: Traceback (most recent call last): File "udp_punch_client.py", line 64, in
Sign in Pricing Blog Support Search GitHub This repository Watch https://github.com/python-zk/kazoo/issues/78 63 Star 578 Fork 225 python-zk/kazoo Code Issues 62 Pull requests 47 Projects 0 Pulse Graphs New issue Got "error: (10038, '')" on windows http://code.activestate.com/lists/python-list/418339/ when connect. #78 Closed viewstar000 opened this Issue May 3, 2013 · 19 comments Projects None yet Labels None yet Milestone operation was No milestone Assignees No one assigned 8 participants viewstar000 commented May 3, 2013 I have add a print before select, and the logs are: INFO:kazoo.client:Skipping state change INFO:kazoo.protocol.connection:Connecting to 127.0.0.1:2181 ([], [], [], 10000) {} ([], [], [], 10000) {} ([], [], [], 10000) {} operation was attempted INFO:kazoo.client:Zookeeper connection established, state: CONNECTED ([, 3], [], [], 2.9433333333333334) {} ERROR:kazoo.protocol.connection:(10038, '') Traceback (most recent call last): File "C:\Python27\lib\site-packages\kazoo-1.1dev-py2.7.egg\kazoo\protocol\connection.py", line 475, in _connect_loop [], [], timeout)[0] File "C:\Python27\lib\site-packages\kazoo-1.1dev-py2.7.egg\kazoo\handlers\threading.py", line 255, in select return select.select(args, *kwargs) error: (10038, '') Exception in thread Thread-3: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 504, in run self.__target(self.__args, *self.__kwargs) File "C:\Python27\lib\site-packages\kazoo-1.1dev-py2.7.egg\kazoo\protocol\connection.py", line 435, in zk_loop if self._connect_loop(retry) is False: File "C:\Python27\lib\site-packages\kazoo-1.1dev-py2.7.egg\kazoo\protocol\connection.py", line 475, in _connect_loop [], [], timeout)[0] File "C:\Python27\lib\site-packages\kazoo-1.1dev-py2.7.egg\kazoo\handlers\threading.py", line 255, in select return select.select(args, *kwargs) error: (10038, '') my platform: Windows7 32bit, Python 2.7 Zookeeper 3.4.5 with JRE 1.7 on windows 7 32bit. hannosch referenced this issue May 24, 2013 Closed KazooTestHarness on Windows #91 mrtheb commented Jun 4, 2013 I digged a little and found that it was introduced in versi
Perl Lists Python Lists PHP Lists Ruby Lists Tcl Lists ActiveState Lists Lists » python-list Using select([sys.stdin]) on windows xp From: John Taylor