toggle-corp / alacritty-colorscheme

Change colorscheme of alacritty with ease.
Apache License 2.0
343 stars 35 forks source link

TypeError: TypeError: 'NoneType' object is not subscriptable #17

Closed Weriel closed 3 years ago

Weriel commented 3 years ago

It doesn't matter which command I execute, or rather try to. I always get an error message that says:

TypeError: 'NoneType' object is not subscriptable

Listing the installed themes works, when I go to apply one though this happens:

blink@rosie:~$ alacritty-colorscheme -a pencil_dark.yaml
Traceback (most recent call last):
  File "/home/blink/.local/bin/alacritty-colorscheme", line 8, in <module>
    sys.exit(main())
  File "/home/blink/.local/lib/python3.8/site-packages/alacritty_colorscheme/cli.py", line 226, in main
    replace_colorscheme(colors_path, args.config_file,
  File "/home/blink/.local/lib/python3.8/site-packages/alacritty_colorscheme/cli.py", line 155, in replace_colorscheme
    if config_yaml['colors']:
TypeError: 'NoneType' object is not subscriptable
tnagorra commented 3 years ago

Maye you do not have a alacritty config file. Can you check if you have one?

Weriel commented 3 years ago

I do have one. It's under the path: $HOME/.config/alacritty/alacritty.yml

Weriel commented 3 years ago

I fixed the problem. I had to manually add a theme in the alacritty.yml and after that the commands worked.

exapsy commented 2 years ago

I fixed the problem. I had to manually add a theme in the alacritty.yml and after that the commands worked.

How do you add a theme? How did you fix that exactly?

Neither of the documentations make this very clear. I think there is some room for improvement in that area.

Edit

Figured it out, but I had to do further search and found this site https://draculatheme.com/alacritty where the author suggested that you should add an import, like this

import:
  - /path/to/dracula.yml

But since the whole purpose of this repository is to add/change themes, I dont think I should have entered to a completely irrelevant site to learn about this.

Can I contribute and add this extra but very important information?

tnagorra commented 2 years ago

In the newer release, users do not need to add a "colors" section on alacritty config file. The tool should be able to add a "colors" if there isn't one already defined.

Users do not need to add an import manually.

The only requirement is that there should already be a user editable config file. Could you share the alacritty version you are using and the alacritty config?

P.S. Yes, contributions are encouraged and you can contribute by creating a fork and submitting a PR.

dimasirfandanu commented 2 years ago

I can still produce this error on my machine

❯ alacritty-colorscheme --version 
alacritty-colorscheme 1.0.1

No matter what arguments I pass except 'list'

❯ alacritty-colorscheme apply solarized_dark.yaml
Traceback (most recent call last):
  File "/home/dimasirfandanu/.local/bin/alacritty-colorscheme", line 8, in <module>
    sys.exit(main())
  File "/home/dimasirfandanu/.local/lib/python3.10/site-packages/alacritty_colorscheme/cli.py", line 158, in main
    handle_args(args)
  File "/home/dimasirfandanu/.local/lib/python3.10/site-packages/alacritty_colorscheme/cli.py", line 147, in handle_args
    replace_colorscheme(colors_path, args.config_file,
  File "/home/dimasirfandanu/.local/lib/python3.10/site-packages/alacritty_colorscheme/colorscheme.py", line 72, in replace_colorscheme
    config_yaml['colors'].update(colors_yaml['colors'])
TypeError: 'NoneType' object is not subscriptable
nonogakhi commented 2 years ago
alacritty-colorscheme apply solarized_dark.yaml

I have also the same exact problem

tnagorra commented 2 years ago

This PR should fix the above issue as well https://github.com/toggle-corp/alacritty-colorscheme/pull/36