#!/usr/bin/env python3

import os
import sys


sys.path.insert(0, '.')

# This is needed to find resources when using pyinstaller
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
    basedir = getattr(sys, '_MEIPASS', '')
else:
    basedir = os.path.dirname(os.path.abspath(__file__))

try:
    from picard.tagger import main
    main(os.path.join(basedir, 'locale'), %(autoupdate)s)
except SystemExit:
    raise  # Just continue with a normal application exit
except:  # noqa: E722,F722 # pylint: disable=bare-except
    from picard import crash_handler
    crash_handler()
    raise
