Open renyhp opened 1 year ago
From logs, it looks like /usr/share/hardcode-tray/database/android-messages-desktop.electron.json
has a problem.
Here is the content in my PC:
// SPDX-FileCopyrightText: © 2020, Alexey Varfolomeev <varlesh@users.noreply.github.com>
//
// SPDX-License-Identifier: GPL-3.0-or-later
{
"name": "Android Messages Desktop",
"app_path": [
"/opt/Android Messages/",
"/usr/lib/android-messages-desktop"
],
"icons_path": [
"/opt/Android Messages/resources/",
"/usr/lib/android-messages-desktop/resources/"
],
"binary": "app.asar",
"script": "electron",
"icons": {
"tray": {
"original": "resources/tray/icon.png",
"theme": "android-messages-desktop-tray"
},
"tray-unread": {
"original": "resources/tray/unread_icon.png",
"theme": "android-messages-desktop-tray-unread"
}
}
}
In the python shell,
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.load(open('/usr/share/hardcode-tray/database/android-messages-desktop.electron.json'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/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)
I don't have any idea why it's complaining.
I temporarily patched /usr/lib/python3/dist-packages/HardcodeTray/modules/parser.py
by adding a return
statement in the except
block in Parser._read()
(this really looks like something that should be done anyway)
I ran into this, too.
I did a bit more digging. It appears that any .json
file in /usr/share/hardcode-tray/database/
that contains inline JSON comments (i.e. android-messages-desktop.electron.json Line 1
) will cause the json.load()
to fail to load any data in parser.py Line 84
See Stack overflow link.
A easy workaround is to only try to parse the applications you need using the hardcode-tray --only
option. If that does not work, you can simply remove the JSON comments from the offending files.
I'm getting a similar error even with all the comments removed from the files.
@genderneutralnoun I was able to remove all the comments from the JSON files here: /usr/share/hardcode-tray/database/
. And I noticed that a couple of those files had a typo of {{
at the top of the file, making the formatting incorrect. I want to say it was the bauh.json
and the blueman.electron.json
, but I didn't note it as I was editing all the files.
Once all those comments and the errors where removed everything ran great for me.
Unfortunately when I look at the files in this projects repo I don't see any of those errors or comments. My guess is somewhere upstream for this package those comments/formatting are getting added in the packaging process.
Hope that helps others looking to fix this issue.
is this https://github.com/bilelmoussaoui/Hardcode-Tray/issues/777 a duplicate?
Specifications
4.4.0~a1.dev0
Linux Mint
3.24
python3-cairo:amd64 1.20.1-3build1
,python3-gi-cairo 3.42.1-0ubuntu1
Issue
hardcode-tray
just crashes before doing anything.I also tried
but no success anyway.