Handle undefined __file__

Needed for running non-interactively.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-05-21 02:22:44 +02:00
parent 7024eb6fae
commit 345ff9ca7e
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -47,7 +47,11 @@ is_packaged = False
if is_packaged:
vagfile='/usr/share/scullery/{}'.format(vagfile)
else:
vagfile='{}/{}'.format(os.path.abspath(os.path.dirname(__file__)), vagfile)
try:
me = __file__
except NameError:
me = sys.argv[0]
vagfile='{}/{}'.format(os.path.abspath(os.path.dirname(me)), vagfile)
def _abort(msg):
log.error(msg)