I installed libretranslate using pip. Got it running under Ubuntu 20.04 both on the command line and as a service under systemd. I want to add api keys. When I add the --api-keys and run it on the command line it works fine. When I try to run it with --api-keys as a service it errors.
Invocation line in /etc/systemd/system/libretranslate.service:
/usr/local/bin/libretranslate --host 0.0.0.0 --api-keys
Errors produced when I tail /var/log/syslog:
Cannot update models (normal if you’re offline): module ‘app.language’ has no attribute ‘languages’
Traceback (most recent call last):
File “/usr/local/bin/libretranslate”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.8/dist-packages/app/main.py”, line 121, in main
app = create_app(args)
File “/usr/local/lib/python3.8/dist-packages/app/app.py”, line 149, in create_app
api_keys_db = Database() if args.api_keys else None
File “/usr/local/lib/python3.8/dist-packages/app/api_keys.py”, line 15, in init
self.c = sqlite3.connect(db_path, check_same_thread=False)
sqlite3.OperationalError: unable to open database file
Anyone have any ideas why it can’t open the database when run as a service?