theironrobin / siglo

GTK app to sync InfiniTime watch with PinePhone
Mozilla Public License 2.0
153 stars 23 forks source link

~/.config/siglo.ini was not created during build #81

Closed jjs10 closed 3 years ago

jjs10 commented 3 years ago

After building the project from source on my PinePhone running Mobian I received the following error when running:

Traceback (most recent call last): File "/usr/local/bin/siglo", line 41, in main() File "/usr/local/bin/siglo", line 24, in main d = daemon.daemon() File "/usr/local/share/siglo/siglo/daemon.py", line 13, in init self.manager = InfiniTimeManager() File "/usr/local/share/siglo/siglo/bluetooth.py", line 62, in init if not self.conf.get_property("paired"): File "/usr/local/share/siglo/siglo/config.py", line 43, in get_property prop = config["settings"][key] File "/usr/lib/python3.9/configparser.py", line 960, in getitem raise KeyError(key) KeyError: 'settings'

I eventually figured out the error was because it was looking for ~/.config/siglo.ini that was not created. I created the .ini file with the default values below, which fixed the issue.

[settings] deploy_type = quick last_paired_device = None paired = False adapter = None

I am not sure if this was something I did wrong during the build or if it is a recent bug in the project.

theironrobin commented 3 years ago

weird, i will test when i get the time

Yasumoto commented 3 years ago

Hm, I got this too just now on a new Pop_OS! 21.04 desktop.

I ran the build steps (got an unrelated error) so decided to install the flatpak and hit this too:

❯ flatpak run com.github.alexr4535.siglo
Traceback (most recent call last):
  File "/app/bin/siglo", line 41, in <module>
    main()
  File "/app/bin/siglo", line 24, in main
    d = daemon.daemon()
  File "/app/share/siglo/siglo/daemon.py", line 13, in __init__
    self.manager = InfiniTimeManager()
  File "/app/share/siglo/siglo/bluetooth.py", line 62, in __init__
    if not self.conf.get_property("paired"):
  File "/app/share/siglo/siglo/config.py", line 43, in get_property
    prop = config["settings"][key]
  File "/usr/lib/python3.8/configparser.py", line 960, in __getitem__
    raise KeyError(key)
KeyError: 'settings'

❯ cat ~/.config/siglo.ini
[settings]
  deploy_type = quick
  last_paired_device = None
  paired = False
  adapter = None
jwillikers commented 3 years ago

Yeah, this error doesn't show up if Siglo has previously created the file before being updated. I can re-create the issue from the Flatpak by deleting the ini file before running Siglo as demonstrated below.

$ rm ~/.var/app/com.github.alexr4535.siglo/config/siglo.ini 
$ flatpak run com.github.alexr4535.siglo
Traceback (most recent call last):
  File "/app/bin/siglo", line 41, in <module>
    main()
  File "/app/bin/siglo", line 24, in main
    d = daemon.daemon()
  File "/app/share/siglo/siglo/daemon.py", line 13, in __init__
    self.manager = InfiniTimeManager()
  File "/app/share/siglo/siglo/bluetooth.py", line 62, in __init__
    if not self.conf.get_property("paired"):
  File "/app/share/siglo/siglo/config.py", line 43, in get_property
    prop = config["settings"][key]
  File "/usr/lib/python3.8/configparser.py", line 960, in __getitem__
    raise KeyError(key)
KeyError: 'settings'
esijg commented 3 years ago

Had the same happen when installing from flathub on Fedora 34.

creating siglo.ini text file in ~/.var/app/com.github.alexr4535.siglo/config/ with the following contents did the trick though.

[settings]
deploy_type = quick
last_paired_device = None
paired = False
adapter = None
fractalf commented 3 years ago

Same problem here installing from flathub on Linux Mint 20.1. Thanks @esijg for the fix!

darkdragon-001 commented 3 years ago

Same problem (freshly) installing from flathub on Fedora 34.

theironrobin commented 3 years ago

https://github.com/alexr4535/siglo/commit/97b4ca840de66cd367523148fdeaf5986ec84efb should fix it