Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local variable 'conversion_tool' referenced before assignment #358

Closed
andia89 opened this issue May 23, 2017 · 23 comments
Closed

local variable 'conversion_tool' referenced before assignment #358

andia89 opened this issue May 23, 2017 · 23 comments
Labels

Comments

@andia89
Copy link
Collaborator

andia89 commented May 23, 2017

Specifications

  • Hardcode-Tray version : latest
  • Distribution : Ubuntu

Steps to reproduce the problem

  1. Run the script
  2. First thing you see is
  File "hardcode-tray.py", line 93, in <module>
    print("Conversion tool : {0}".format(App.svg()))
  File "/opt/Hardcode-Tray/src/app.py", line 155, in svg
    if conversion_tool:
UnboundLocalError: local variable 'conversion_tool' referenced before assignment

I'm using a config file, that specifies the conversion_tool

@bilelmoussaoui
Copy link
Owner

I have already fixed that issue on my local machine, i will push that fix in an hour 👍

bilelmoussaoui added a commit that referenced this issue May 23, 2017
@bilelmoussaoui
Copy link
Owner

Fixed on master

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Nope. Now it tells me:

Traceback (most recent call last):
  File "hardcode-tray.py", line 87, in <module>
    if not isinstance(App.theme(), dict):
  File "/opt/Hardcode-Tray/src/app.py", line 227, in theme
    source = Gio.SettingsSchemaSource.get_default()
NameError: name 'Gio' is not defined

@bilelmoussaoui
Copy link
Owner

You must be missing a dependency then (that we should include on the ppa ofc) :P
Because Gio is imported at the beginning of the file

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Ok it seems that the --update flag is broken. manually reinstalling it works. Is it possible that it doesn't update the right files (you changed the names of quite a few)

@bilelmoussaoui
Copy link
Owner

Yeah, it doesn't work you should update manually or reuse the install.sh in order to get everything to work with the latest version

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Still an error:

Traceback (most recent call last):
  File "hardcode-tray.py", line 122, in <module>
    App.execute(action)
  File "/opt/Hardcode-Tray/src/app.py", line 115, in execute
    app.install()
  File "/opt/Hardcode-Tray/src/decorators.py", line 47, in wrapper
    func(app)
  File "/opt/Hardcode-Tray/src/modules/applications/application.py", line 124, in install
    self.execute(Action.APPLY)
  File "/opt/Hardcode-Tray/src/modules/applications/binary.py", line 54, in execute
    self.install_icon(icon, icon_path)
  File "/opt/Hardcode-Tray/src/modules/applications/pak.py", line 64, in install_icon
    self.set_icon(icon, icon_path, pngbytes, True)
  File "/opt/Hardcode-Tray/src/modules/applications/pak.py", line 51, in set_icon
    self.set_binary_file(icon_path.append(self.binary))
  File "/opt/Hardcode-Tray/src/modules/applications/pak.py", line 47, in set_binary_file
    self.pak = data_pack.read_data_pack(binary_file)
  File "/opt/Hardcode-Tray/src/modules/applications/pak/data_pack.py", line 46, in read_data_pack
    data = read_file(input_file, BINARY)
  File "/opt/Hardcode-Tray/src/modules/applications/pak/data_pack.py", line 36, in read_file
    with open(filename, mode) as file_object:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/chromium-browser/resources.pak'

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

And this one as well ;)

Traceback (most recent call last):
  File "hardcode-tray.py", line 122, in <module>
    App.execute(action)
  File "/opt/Hardcode-Tray/src/app.py", line 115, in execute
    app.install()
  File "/opt/Hardcode-Tray/src/decorators.py", line 47, in wrapper
    func(app)
  File "/opt/Hardcode-Tray/src/modules/applications/application.py", line 124, in install
    self.execute(Action.APPLY)
  File "/opt/Hardcode-Tray/src/modules/applications/extract.py", line 37, in execute
    self.extract(icon_path)
  File "/opt/Hardcode-Tray/src/modules/applications/zip.py", line 50, in extract
    with ZipFile(icon_path + self.binary) as zip_object:
TypeError: unsupported operand type(s) for +: 'Path' and 'str'

@bilelmoussaoui
Copy link
Owner

bilelmoussaoui commented May 23, 2017

@wa4557 Both issues are fixed on master
I will release a hotfix version once every small issue is fixed

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Another one:

running:

hardcode-tray --clear-cache

gives:

Welcome to the tray icons hardcoder fixer!
Traceback (most recent call last):
  File "hardcode-tray.py", line 85, in <module>
    print("Your indicator icon size is : {0}".format(App.icon_size()))
  File "/opt/Hardcode-Tray/src/app.py", line 193, in icon_size
    if App.config().get("icons"):
  File "/opt/Hardcode-Tray/src/app.py", line 143, in config
    App._config = load(data)
  File "/usr/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Once more running the app gives:

Traceback (most recent call last):
  File "hardcode-tray.py", line 121, in <module>
    App.execute(action)
  File "/opt/Hardcode-Tray/src/app.py", line 106, in execute
    app.install()
  File "/opt/Hardcode-Tray/src/decorators.py", line 60, in wrapper
    func(app)
  File "/opt/Hardcode-Tray/src/modules/applications/application.py", line 125, in install
    self.execute(Action.APPLY)
  File "/opt/Hardcode-Tray/src/modules/applications/binary.py", line 54, in execute
    self.install_icon(icon, icon_path)
  File "/opt/Hardcode-Tray/src/modules/applications/pak.py", line 67, in install_icon
    self.set_icon(icon, icon_path, pngbytes, True)
  File "/opt/Hardcode-Tray/src/modules/applications/pak.py", line 56, in set_icon
    self.backup.file(str(icon_name), self.pak.resources[icon_name])
KeyError: 8003

@bilelmoussaoui
Copy link
Owner

Your json config file is broken. But i wll add an exception for that (first issue)

@bilelmoussaoui
Copy link
Owner

Both issues fixed on master

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

How is that broken?

{
    "conversion-tool": "Inkscape",
    "backup-ignore": true
}

@bilelmoussaoui
Copy link
Owner

Well, it's what the output shows :/ Do you still get the same error?

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Nope your fix fixed that, not exactly sure why though. clean-cache doesn't delete the empty folder though

@bilelmoussaoui
Copy link
Owner

Does it remove the subfolders? or at least the contents?
to be sure that everything works, check the log files /tmp/Hardcode-Tray/

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Nothing in the logfiles. The folders with the dates are still there, but at least they are empty :)

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Everything looks good now 👍

@bilelmoussaoui
Copy link
Owner

The folders were created automatically because i was missing a condition, but should be fixed now 👍

@andia89
Copy link
Collaborator Author

andia89 commented May 23, 2017

Ha I got another one :)

Traceback (most recent call last):
  File "hardcode-tray.py", line 121, in <module>
    App.execute(action)
  File "/opt/Hardcode-Tray/src/app.py", line 106, in execute
    app.install()
  File "/opt/Hardcode-Tray/src/decorators.py", line 61, in wrapper
    func(app)
  File "/opt/Hardcode-Tray/src/modules/applications/application.py", line 125, in install
    self.execute(Action.APPLY)
  File "/opt/Hardcode-Tray/src/modules/applications/extract.py", line 44, in execute
    self.install_icon(icon, self.tmp_data)
  File "/opt/Hardcode-Tray/src/decorators.py", line 35, in wrapper
    func(application, icon, icon_path)
  File "/opt/Hardcode-Tray/src/modules/applications/application.py", line 139, in install_icon
    output_icon = icon_path.append(icon.original)
AttributeError: 'str' object has no attribute 'append'

@bilelmoussaoui
Copy link
Owner

Hmm i know what causes this, i will see how i can fix it :)

@bilelmoussaoui
Copy link
Owner

Fixed

@bilelmoussaoui bilelmoussaoui modified the milestone: v3.8.1 May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants