[docs] [issue32558] Socketserver documentation : error in server example
Tristan Colombo
report at bugs.python.org
Mon Jan 15 11:40:20 EST 2018
New submission from Tristan Colombo <tristan.colombo at gmail.com>:
In the documentation, at page :
- https://docs.python.org/3.6/library/socketserver.html
- Section 21.21.4.1
In the server side code :
if __name__ == "__main__":
HOST, PORT = "localhost", 9999
# Create the server, binding to localhost on port 9999
with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
...
We got an error line 24 :
with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
AttributeError: __exit__
socketserver.TCPServer object has no __exit__() method and can not be used in 'with' statement.
Proposed correction :
server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)
with server:
...
----------
assignee: docs at python
components: Documentation
messages: 309995
nosy: docs at python, tcolombo
priority: normal
severity: normal
status: open
title: Socketserver documentation : error in server example
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32558>
_______________________________________
More information about the docs
mailing list