question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set path for config.cfg when starting server.py

See original GitHub issue

When starting server.py on startup with a systemd unit, the execution is handled by root and the command needs to specify the full path of both python and eps, e.g.

[Unit]
Description=Electrum Personal Server
After=bitcoind.service

[Service]
Type=simple
ExecStart=/usr/bin/python3 /home/bitcoin/electrum-personal-server/server.py

[Install]
WantedBy=multi-user.target

This gives the error message Non-existant configuration file 'config.cfg', as the script assumes that it is started from within the installation directory.

$ sudo systemctl start eps.service
$ sudo systemctl status eps.service
● eps.service - Electrum Personal Server
   Loaded: loaded (/etc/systemd/system/eps.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Mar 30 01:21:02 RaspiBolt systemd[1]: Started Electrum Personal Server.
Mar 30 01:21:02 RaspiBolt python3[13963]: 01:21:02,712804 [  LOG] Non-existant configuration file 'config.cfg'

Is it possible to set the full path for the config.cfg on startup, or do you know of a better way to handle the automatic start with systemd on boot?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chris-belchercommented, Mar 30, 2018

Ah sorry that was silly of me. The file config.cfg isn’t the only one which is accessed.

I recoded it so the user configures the current working directory https://github.com/chris-belcher/electrum-personal-server/commit/f33934059b084bc80ad1f2e39a0997114104a604, then every file like debug.log and the SSL certs should be correctly located. It should work, I tested this time much more.

1reaction
chris-belchercommented, Mar 30, 2018

Thanks for the issue. I think the best way to solve this is to allow setting the full path to the config file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where to put a configuration file in Python? - Stack Overflow
I use ConfigParser to parse the myproject.conf file. In my code, it's easy to load the file with a good path : my_project/conf/myproject.conf....
Read more >
Config file and command line options - The Jupyter Notebook
Config file and command line options . The notebook server can be run with a variety of command line arguments. A list...
Read more >
Configuration Handling — Flask Documentation (2.2.x)
Configuring from Python Files¶ · $ export YOURAPPLICATION_SETTINGS=/path/to/settings.cfg $ flask run * Running on http://127.0.0.1:5000/ · $ set -x ...
Read more >
The CFG API for Python - Documentation sets
The path to the file from which the configuration has been read. You won't usually need to set this, unless you want to...
Read more >
Django settings - Django documentation
A settings file is just a Python module with module-level variables. ... If you set DEBUG to False , you also need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found