alumae / kaldi-gstreamer-server

Real-time full-duplex speech recognition server, based on the Kaldi toolkit and the GStreamer framwork.
BSD 2-Clause "Simplified" License
1.07k stars 341 forks source link

No such file or directory when running master_server.py #35

Closed gunthercox closed 8 years ago

gunthercox commented 8 years ago

I ran into a small snag when running master_server.py. Apparently the readme file could not be found. I fixed the issue by getting the absolute path to the readme based on the path to the current directory.

I am not sure if anyone else has run into this. I would gladly send a pull request if you are interested.

 class MainHandler(tornado.web.RequestHandler):
     def get(self):
+        current_directory = os.path.dirname(os.path.abspath(__file__))
+        parent_directory = os.path.join(current_directory, os.pardir)
+        readme = os.path.join(parent_directory, "README.md")
+        self.render(readme)
-        self.render("../README.md")

Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1443, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "kaldigstserver/master_server.py", line 76, in get
    self.render("../README.md")
  File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 699, in render
    html = self.render_string(template_name, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 803, in render_string
    t = loader.load(template_name)
  File "/usr/local/lib/python2.7/dist-packages/tornado/template.py", line 424, in load
    self.templates[name] = self._create_template(name)
  File "/usr/local/lib/python2.7/dist-packages/tornado/template.py", line 451, in _create_template
    with open(path, "rb") as f:
IOError: [Errno 2] No such file or directory: '/home/gcox/GitHub/kaldi-gstreamer-server/templates/../README.md'
alumae commented 8 years ago

Sure, please send a pull request!