bilelmoussaoui / bilelmoussaoui/Hardcode-Tray

Crash with UnboundLocalError

Open
#763 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
889
Forks
59
PR merge metrics
No merged PRs in 30d

Description

### Specifications
- Hardcode-Tray version : `4.4.0~a1.dev0`
- Distribution : `Linux Mint`
- Gtk version : `3.24`
- Inkscape version : Not installed
- Cairo version : ` python3-cairo:amd64 1.20.1-3build1`, `python3-gi-cairo 3.42.1-0ubuntu1`
- Sni-qt version: Not installed

### Issue

`hardcode-tray` just crashes before doing anything.

```
$ sudo /usr/bin/hardcode-tray --conversion-tool RSVGConvert --size 22 --theme Papirus --apply
Welcome to Hardcode-Tray!
Hardcode-Tray replaces some icons on the binary files of some applications.
Please close all the running applications before running Hardcode-Tray script.
Desktop Environment: Xfce
Scaling Factor: 1
Icon Size: 22
Icon Theme: Papirus
Conversion Tool: RSVGConvert
To Do: All
Applying now…

Traceback (most recent call last):
File "/usr/bin/hardcode-tray", line 123, in
App.execute()
File "/usr/lib/python3/dist-packages/HardcodeTray/app.py", line 100, in execute
apps = App.get_supported_apps()
File "/usr/lib/python3/dist-packages/HardcodeTray/app.py", line 90, in get_supported_apps
application_data = Parser(db_file)
File "/usr/lib/python3/dist-packages/HardcodeTray/modules/parser.py", line 47, in __init__
self._read()
File "/usr/lib/python3/dist-packages/HardcodeTray/modules/parser.py", line 91, in _read
self._parse_paths(data["app_path"], "app_path")
UnboundLocalError: local variable 'data' referenced before assignment
```

I also tried

```
$ apt remove --purge hardcode-tray
$ apt install hardcode-tray
```

but no success anyway.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported command, then inspect modules/parser.py at Parser._read and app.py at App.get_supported_apps, using the traceback as the entry point. Determine why the parser reaches _parse_paths without initialized data, and verify that hardcode-tray proceeds past startup without the reported UnboundLocalError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.