[issue32558] Socketserver documentation : error in server example

2018-01-15 Thread Tristan Colombo

New submission from Tristan Colombo :

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", 

# Create the server, binding to localhost on port 
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@python
components: Documentation
messages: 309995
nosy: docs@python, tcolombo
priority: normal
severity: normal
status: open
title: Socketserver documentation : error in server example
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue32558>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32558] Socketserver documentation : error in server example

2018-01-15 Thread Tristan Colombo

Tristan Colombo  added the comment:

Correction of my previous correction :
server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)

'with' statement can not be used...

--

___
Python tracker 
<https://bugs.python.org/issue32558>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32558] Socketserver documentation : error in server example

2018-01-15 Thread Tristan Colombo

Tristan Colombo  added the comment:

Running on Debian Etch
Ok, my python3 was broken and links to python3.5.3
All my apologizes

--
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue32558>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com