# Buggy code
def get_translation_strings(self):
    # type: () -> Dict[str, str]
    translation_strings = {}  # type: Dict[str, str]
    dirname = self.get_template_dir()

    for dirpath, dirnames, filenames in os.walk(dirname):
        for filename in [f for f in filenames if f.endswith(".handlebars")]:
            with open(os.path.join(dirpath, filename), "r") as reader:
                data = reader.read()
                data = data.replace("\n", "\\n")
                translation_strings.update(self.extract_strings(data))

    dirname = os.path.join(settings.DEPLOY_ROOT, "static/js")
    for filename in os.listdir(dirname):
        if filename.endswith(".js"):
            with open(os.path.join(dirname, filename)) as reader:
                data = reader.read()
                translation_strings.update(self.extract_strings(data))

    return translation_strings


# Traceback (IOError)
processing locale pl
Traceback (most recent call last):
File "./manage.py", line 29, in <module>
execute_from_command_line(sys.argv)
File "/srv/zulip-venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/srv/zulip-venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/zulip-venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/zulip-venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/home/tabbott/zulip/zerver/management/commands/makemessages.py", line 90, in handle
self.handle_frontend_locales(*args, **options)
File "/home/tabbott/zulip/zerver/management/commands/makemessages.py", line 101, in handle_frontend_locales
translation_strings = self.get_translation_strings()
File "/home/tabbott/zulip/zerver/management/commands/makemessages.py", line 173, in get_translation_strings
with open(os.path.join(dirname, filename)) as reader:
IOError: [Errno 2] No such file or directory: '/home/tabbott/zulip/zproject/../static/js/.#echo.js'

# Fixed code
def get_translation_strings(self):
    # type: () -> Dict[str, str]
    translation_strings = {}  # type: Dict[str, str]
    dirname = self.get_template_dir()

    for dirpath, dirnames, filenames in os.walk(dirname):
        for filename in [f for f in filenames if f.endswith(".handlebars")]:
            if filename.startswith("."):
                continue
            with open(os.path.join(dirpath, filename), "r") as reader:
                data = reader.read()
                data = data.replace("\n", "\\n")
                translation_strings.update(self.extract_strings(data))

    dirname = os.path.join(settings.DEPLOY_ROOT, "static/js")
    for filename in os.listdir(dirname):
        if filename.endswith(".js") and not filename.startswith("."):
            with open(os.path.join(dirname, filename)) as reader:
                data = reader.read()
                translation_strings.update(self.extract_strings(data))

    return translation_strings