diff -Naur --no-dereference grpc-1.40.0-original/test/core/http/test_server.py grpc-1.40.0/test/core/http/test_server.py --- grpc-1.40.0-original/test/core/http/test_server.py 2021-09-03 19:20:52.000000000 -0400 +++ grpc-1.40.0/test/core/http/test_server.py 2021-09-09 11:34:26.772184779 -0400 @@ -19,7 +19,7 @@ import ssl import sys -import BaseHTTPServer +import http.server _PEM = os.path.abspath( os.path.join(os.path.dirname(sys.argv[0]), '../../..', @@ -27,7 +27,7 @@ _KEY = os.path.abspath( os.path.join(os.path.dirname(sys.argv[0]), '../../..', 'src/core/tsi/test_creds/server1.key')) -print _PEM +print(_PEM) open(_PEM).close() argp = argparse.ArgumentParser(description='Server for httpcli_test') @@ -35,29 +35,29 @@ argp.add_argument('-s', '--ssl', default=False, action='store_true') args = argp.parse_args() -print 'server running on port %d' % args.port +print('server running on port %d' % args.port) -class Handler(BaseHTTPServer.BaseHTTPRequestHandler): +class Handler(http.server.BaseHTTPRequestHandler): def good(self): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() - self.wfile.write('
This is a test
') + self.wfile.write(b'This is a test
') def do_GET(self): if self.path == '/get': self.good() def do_POST(self): - content = self.rfile.read(int(self.headers.getheader('content-length'))) + content = self.rfile.read(int(self.headers.get('content-length'))) if self.path == '/post' and content == 'hello': self.good() -httpd = BaseHTTPServer.HTTPServer(('localhost', args.port), Handler) +httpd = http.server.HTTPServer(('localhost', args.port), Handler) if args.ssl: httpd.socket = ssl.wrap_socket(httpd.socket, certfile=_PEM, diff -Naur --no-dereference grpc-1.40.0-original/tools/distrib/python_wrapper.sh grpc-1.40.0/tools/distrib/python_wrapper.sh --- grpc-1.40.0-original/tools/distrib/python_wrapper.sh 2021-09-03 19:20:52.000000000 -0400 +++ grpc-1.40.0/tools/distrib/python_wrapper.sh 2021-09-09 11:33:47.641824138 -0400 @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -for p in python2.7 python2.6 python2 python not_found ; do +for p in python3 not_found ; do python=$(which $p || echo not_found)