0

I cleared out the differences of python 2to3 in the files tensorboard.py and tensorboard_handler.py but Tensorboard still has Visualization error.

Error on Browser side:

Graph Visualization failed:Error:Failure parsing graph definition

The Server side error log is:

Exception happened during processing of request from ('127.0.0.1', 52783)

Traceback (most recent call last):

  File "/usr/lib/python3.4/socketserver.py", line 617, in process_request_thread

    self.finish_request(request, client_address)

  File "/usr/lib/python3.4/socketserver.py", line 344, in finish_request

    self.RequestHandlerClass(request, client_address, self)

  File "/usr/lib/python3.4/site-
packages/tensorflow/tensorboard/tensorboard_handler.py", line 85, in __ init __

    http.server.BaseHTTPRequestHandler.__init__(self,*args)

  File "/usr/lib/python3.4/socketserver.py", line 673, in __ init __

    self.handle()

  File "/usr/lib/python3.4/http/server.py", line 398, in handle

    self.handle_one_request()

  File "/usr/lib/python3.4/http/server.py", line 386, in handle_one_request

    method()

  File "/usr/lib/python3.4/site-
packages/tensorflow/tensorboard/tensorboard_handler.py", line 389, in do_GET

    handlers[clean_path](query_params)

  File "/usr/lib/python3.4/site-
packages/tensorflow/tensorboard/tensorboard_handler.py", line 217, in 
_serve_graph

    self._send_gzip_response(graph_pbtxt, 'text/plain')

  File "/usr/lib/python3.4/site-
packages/tensorflow/tensorboard/tensorboard_handler.py", line 135, in 
_send_gzip_response

    f = gzip.GzipFile(fileobj=out, mode='w')

  File "/usr/lib/python3.4/gzip.py", line 220, in __ init __

    self._write_gzip_header()

  File "/usr/lib/python3.4/gzip.py", line 252, in _write_gzip_header

    self.fileobj.write(b'\037\213')             # magic header

TypeError: string argument expected, got 'bytes'
awesoon
  • 32,469
  • 11
  • 74
  • 99
Ruth
  • 151
  • 1
  • 5

1 Answers1

0

tensorboard_handler.py uses StringIO, but then passes bytes to it. When working with Python 3, it should probably use BytesIO instead (which is new in Python 3). This question is related: StringIO in python3.

Unfortunately, Tensorboard does not yet support python 3, but if you happen to fix this issue, send a pull request.

Community
  • 1
  • 1
wicke
  • 739
  • 7
  • 7
  • Running 2to3 and replacing StringIO by BytesIO indeed fixes the issue for Python 3. I have it fixed locally but would need to make sure the code runs in both Python 2 and 3 before sending a pull request. – jfsantos Jan 10 '16 at 00:19