[New-bugs-announce] [issue22304] Update multiprocessing examples to Py3 and test

Terry J. Reedy report at bugs.python.org
Sat Aug 30 01:25:38 CEST 2014


New submission from Terry J. Reedy:

https://docs.python.org/2/library/multiprocessing.html#examples
contains several examples in Python2 code that need to be updated for Python 3. Richard, if you have them in .py files, perhaps you could run them through 2to3 and then test.

# Example where a pool of http servers share a single listening socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
...
    print 'Serving at http://%s:%d using %d worker processes' % \
          (ADDRESS[0], ADDRESS[1], NUMBER_OF_PROCESSES)
    print 'To exit press Ctrl-' + ['C', 'Break'][sys.platform=='win32']

#update
from http.server import HTTPServer, SimpleHTTPRequestHandler
...
    print('Serving at http://%s:%d using %d worker processes' % \
          (ADDRESS[0], ADDRESS[1], NUMBER_OF_PROCESSES))
    print('To exit press Ctrl-' + ['C', 'Break'][sys.platform=='win32'])


This still does not run on Windows 
_pickle.PicklingError: Can't pickle <class '_thread.lock'>: attribute lookup lock on _thread failed
but that was true in 2.7 also (#21204).

----------
assignee: docs at python
components: Documentation
messages: 226103
nosy: docs at python, sbt, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Update multiprocessing examples to Py3 and test
type: behavior
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22304>
_______________________________________


More information about the New-bugs-announce mailing list