skorokithakis / tbvaccine

A small utility to pretty-print Python tracebacks. ⛺
MIT License
377 stars 14 forks source link

Fix startup error when config dir not exist #30

Closed wataash closed 5 years ago

wataash commented 5 years ago

Fix error If ~/.config/ doesn't exist (usual in docker containers):

root@4fd8085c7d11:/# python3 /mnt/tes.py
Error processing line 1 of /usr/local/lib/python3.7/site-packages/tbvaccine.pth:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<string>", line 3, in <module>
    File "/usr/local/lib/python3.7/site-packages/tbvaccine/tbv.py", line 258, in add_hook
      tbv = TBVaccine(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/tbvaccine/tbv.py", line 55, in __init__
      self._load_config()
    File "/usr/local/lib/python3.7/site-packages/tbvaccine/tbv.py", line 69, in _load_config
      with open(config_path, "w") as configfile:
  FileNotFoundError: [Errno 2] No such file or directory: '/root/.config/tbvaccine/tbvaccine.cfg'

Remainder of file ignored