Open sten0 opened 1 month ago
P.S. "moment of bad luck" = unscheduled hard power-off when UPS failed
Alternatively, maybe lieer could handle this case gracefully and automatically instead of doing this:
gmi pull
Failed to decode state file `/home/sten/.mail/account.gmail/.state.gmailieer.json`.
Traceback (most recent call last):
File "/usr/bin/gmi", line 24, in <module>
g.main ()
File "/usr/share/lieer/lieer/gmailieer.py", line 419, in main
args.func(args)
File "/usr/share/lieer/lieer/gmailieer.py", line 612, in pull
self.setup(args, args.dry_run, True)
File "/usr/share/lieer/lieer/gmailieer.py", line 489, in setup
self.local.load_repository(block)
File "/usr/share/lieer/lieer/local.py", line 379, in load_repository
self.state = Local.State(self.state_f, self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/lieer/lieer/local.py", line 270, in __init__
self.json = json.load(fd)
^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hi,
Yes that sounds great (a pr documenting it)! Lieer maybe printing a hint about this, but not doing it itself is maybe also good.
Gaute
tir. 9. apr. 2024, 02:01 skrev Nicholas D Steeves @.***
:
Alternatively, maybe lieer could handle this case gracefully and automatically instead of doing this:
gmi pull Failed to decode state file
/home/sten/.mail/account.gmail/.state.gmailieer.json
. Traceback (most recent call last): File "/usr/bin/gmi", line 24, ing.main () File "/usr/share/lieer/lieer/gmailieer.py", line 419, in main args.func(args) File "/usr/share/lieer/lieer/gmailieer.py", line 612, in pull self.setup(args, args.dry_run, True) File "/usr/share/lieer/lieer/gmailieer.py", line 489, in setup self.local.load_repository(block) File "/usr/share/lieer/lieer/local.py", line 379, in load_repository self.state = Local.State(self.state_f, self.config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/lieer/lieer/local.py", line 270, in init self.json = json.load(fd) ^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/init.py", line 293, in load return loads(fp.read(), ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) — Reply to this email directly, view it on GitHub https://github.com/gauteh/lieer/issues/278#issuecomment-2043901021, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN365XDVE2JRKD6B4CX5TY4MVWVAVCNFSM6AAAAABF5SPIRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBTHEYDCMBSGE . You are receiving this because you were mentioned.Message ID: @.***>
Hi @gauteh !
I recently had a moment of bad luck recently, and my .state.gmailieer.json ended up as an empty file. Presumably the thing to do in this case is to make an additional copy of .state.gmailieer.json.bak (ie: .state.gmailieer.json.bak.known_good), then cp .state.gmailieer.json.bak to .state.gmailieer.json, then
gmi pull
, and then let mi sync take place as scheduled.If there aren't any pitfalls or caveats with this approach, then I'd be happy to file a PR. Otherwise I think that it would be nice if you could write something on this topic in the documentation.
Kind regards, Nicholas