question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when adding theme to `~/.config/babi/theme.json`

See original GitHub issue

Hi Anthony, I was testing babi on my Ubuntu 18.04 server via SSH and it worked perfectly fine until I tried to add themes to ~/.config/babi/theme.json I tried to add this theme. I simply copy/pasted it into a file named theme.json. I am using Python 3.6.9 and when executingbabi theme.json the following error comes up:

Traceback (most recent call last):
  File "/home/kittnjdr/.local/bin/babi", line 11, in <module>
    load_entry_point('babi==0.0.1', 'console_scripts', 'babi')()
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/main.py", line 63, in main
    return c_main(stdscr, args)
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/main.py", line 37, in c_main
    screen = Screen(stdscr, args.filenames or [None], perf)
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/screen.py", line 78, in __init__
    Syntax.from_screen(stdscr, color_manager),
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/hl/syntax.py", line 143, in from_screen
    theme = Theme.from_filename(xdg_config('theme.json'))
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 152, in from_filename
    return cls.from_dct(json.loads(contents))
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 139, in from_dct
    return cls(Style(**default), TrieNode.from_dct(root))
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 74, in from_dct
    k: TrieNode.from_dct(v) for k, v in dct['children'].items()
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 74, in <dictcomp>
    k: TrieNode.from_dct(v) for k, v in dct['children'].items()
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 74, in from_dct
    k: TrieNode.from_dct(v) for k, v in dct['children'].items()
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 74, in <dictcomp>
    k: TrieNode.from_dct(v) for k, v in dct['children'].items()
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 76, in from_dct
    return cls(PartialStyle.from_dct(dct), children)
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/theme.py", line 48, in from_dct
    kv['fg'] = Color.parse(dct['foreground'])
  File "/home/kittnjdr/.local/lib/python3.6/site-packages/babi/color.py", line 11, in parse
    return cls(r=int(s[1:3], 16), g=int(s[3:5], 16), b=int(s[5:7], 16))
ValueError: invalid literal for int() with base 16: 'hi'

Maybe this theme is not suitable?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Mar 17, 2020

whoa, weird! it looks like ~some coloring is taking but it’s greyscaled everything?

1reaction
asottilecommented, Mar 17, 2020

Capture28

here’s what it looks like for me once I fixed white – I also did black at the same time, I don’t suspect other named colors will come up but I’ll try a bunch of themes later to verify 👍

thanks again for the report!

Read more comments on GitHub >

github_iconTop Results From Across the Web

babi/README.md at main · asottile/babi - GitHub
pip install babi ... it to json (if it is not already json) and put it at ~/.config/babi/theme.json . a helper script is...
Read more >
babi - Python Package Health Analysis - Snyk
Based on project statistics from the GitHub repository for the PyPI package babi, we found that it has been starred 282 times, and...
Read more >
babi [python]: Datasheet - Package Galaxy
Installation: pip install babi ... convert it to json (if it is not already json) and put it at ~/.config/babi/theme.json . a helper...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found