Python BaseHttpServer поддерживает Html5? - PullRequest
1 голос
/ 04 декабря 2010

Я использую BaseHttpServer из Python-2.6.6. Я не мог заставить его работать с тегом. Действительно ли Python-2.6 поддерживает HTML5?

Это может быть более полезным:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 309, in process_request
    self.finish_request(request, client_address)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 617, in __init__
    self.handle()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
    method()
  File "testServer.py", line 43, in do_GET
    self.send_error(404,'File Not Found: %s' % self.path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 357, in send_error
    self.send_response(code, message)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 382, in send_response
    (self.protocol_version, code, message))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 318, in write
    self.flush()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe

Сторона сервера:

if self.path.endswith(".ts"):           
    f = open("simpsons.ts", 'r')
    self.send_response(200)
    self.send_header('Content-type', 'video/mpegts')
    self.end_headers()      
    self.wfile.write(f.read())
    return

Клиентская сторона:

video width='320' height='240' src="simpsons.ts" controls="controls" /video

Код изображения (рабочий):

Сторона сервера:

if self.path.endswith(".png"):          
    f = open("ps_logo2.png", 'r')
    self.send_response(200)
    self.send_header('Content-type', 'image/png')
    self.end_headers()      
    self.wfile.write(f.read())
    return 

Клиентская сторона:

img src="ps_logo2.png" alt="No Image"/

Ответы [ 2 ]

3 голосов
/ 04 декабря 2010

Поддержка HTML5 действует в первую очередь на уровне браузера, а не на уровне языка. Так что да, Python неявно поддерживает HTML5.

0 голосов
/ 04 декабря 2010

Кажется, вы неправильно диагностировали свою проблему. HTML5 полностью браузерная сторона. Сломанная труба свидетельствует о чем-то другом.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...