TripSit / combogen

Project to automatically generate the combo table graphic from our JSON file
21 stars 17 forks source link

Combogen fails with UnicodeEncodeError #21

Closed orkoden closed 1 year ago

orkoden commented 1 year ago

When I try to run combogen, it starts fine and reads the configuration but then fails with the following error.

== DRUG GROUPS IN DATABASE (FROM CONFIG) ==

psychedelic (10): LSD, Mushrooms, DMT, Mescaline, DOx, NBOMes, 2C-x, 2C-T-x, 5-MeO-xxT, Cannabis
dissociative (4): Ketamine, MXE, DXM, Nitrous
stimulant (4): Amphetamines, MDMA, Cocaine, Caffeine
depressant (5): Alcohol, GHB/GBL, Opioids, Tramadol, Benzodiazepines
antidepressant (2): MAOIs, SSRIs

== MISSING DRUGS (ASYMMETRIC JSON <-> CONFIG) ==

Missing from JSON (0): 
Missing from Config (2): amt, pcp

== MISSING DRUG COMBO DEFINITIONS AND  UNKNOWN INTERACTIONS ==

Combos missing in JSON (0): 
Unknown interactions (0): 

== ASYMMETRIC DRUG COMBOS ==

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/vboxuser/combogen/combogen/__main__.py", line 41, in <module>
    f.write(chart)
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 50776-50778: ordinal not in range(256)

So something goes wrong while encoding characters. I suspected UTF-8 wasn't configured in the environment correctly. But running python3 -c 'import sys; print(sys.getdefaultencoding())' diligently returned utf-8.

A little research makes me suspect it might be related to something being wrong with the font. Applying the patch from #17 didn't change anything though.

OS: Xubuntu 20.04, node v12.22.9., python 3.10, using the default config.json

Any help would be appreciated.

orkoden commented 1 year ago

It ran fine on macOS 13.4 (22F66), node v20.3.0, Python 3.11.4 when I tried. The Xubuntu version of node is ancient. Maybe that was the issue.