[issue36047] socket file handle does not support stream write

Stéphane Wirtel report at bugs.python.org
Wed Feb 20 04:26:37 EST 2019


Stéphane Wirtel <stephane at wirtel.be> added the comment:

I confirm that you don't use socket.makefile in write mode.

Python 3.7.2 (default, Jan 16 2019, 19:49:22) 
[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> s = socket.socket()
>>> s.connect('localhost', 5432)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: connect() takes exactly one argument (2 given)
>>> s.connect(('localhost', 5432))
>>> S = s.makefile()
>>> print('hello world', file=S, flush=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: not writable
>>> S = s.makefile(mode='w')
>>> print('hello world', file=S, flush=True)
>>> 

I close the issue.

----------
nosy: +matrixise
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36047>
_______________________________________


More information about the Python-bugs-list mailing list