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

Crash with KeyError if klippy does not have a logfile specified on the command line. #21

Open
Laikulo opened this issue Mar 31, 2024 · 0 comments

Comments

@Laikulo
Copy link

Laikulo commented Mar 31, 2024

Synopsis:
If the klipper host is not writing to a logfile, and logs are going to stdout/stderr, extra drops a stacktrace and fails to configure

Expected:
If results_dir is specified in config, that is used. If log_file and the config dir guess both turn up unusable, default to /tmp (or similar), or print a message and halt.

Actual:

crashes here:

os.path.dirname(self.printer.start_args['log_file']),

Stacktrace from my setup, which uses a modified klipper, and packages extras as wheels:

Mar 31 16:59:16 voron klipper-klippy[705]: ERROR:root:Unhandled exception during connect
Mar 31 16:59:16 voron klipper-klippy[705]: Traceback (most recent call last):
Mar 31 16:59:16 voron klipper-klippy[705]:   File "/var/lib/klippy/.local/lib/python3.9/site-packages/klippy/klippy.py", line 183, in _connect
Mar 31 16:59:16 voron klipper-klippy[705]:     self._read_config()
Mar 31 16:59:16 voron klipper-klippy[705]:   File "/var/lib/klippy/.local/lib/python3.9/site-packages/klippy/klippy.py", line 149, in _read_config
Mar 31 16:59:16 voron klipper-klippy[705]:     self.load_object(config, section_config.get_name(), None)
Mar 31 16:59:16 voron klipper-klippy[705]:   File "/var/lib/klippy/.local/lib/python3.9/site-packages/klippy/klippy.py", line 138, in load_object
Mar 31 16:59:16 voron klipper-klippy[705]:     self.objects[section] = init_func(config.getsection(section))
Mar 31 16:59:16 voron klipper-klippy[705]:   File "/var/lib/klippy/.local/lib/python3.9/site-packages/autospeed/autospeed.py", line 4, in load_config
Mar 31 16:59:16 voron klipper-klippy[705]:     return AutoSpeed(config)
Mar 31 16:59:16 voron klipper-klippy[705]:   File "/var/lib/klippy/.local/lib/python3.9/site-packages/autospeed/main.py", line 54, in __init__
Mar 31 16:59:16 voron klipper-klippy[705]:     os.path.dirname(self.printer.start_args['log_file']),
Mar 31 16:59:16 voron klipper-klippy[705]: KeyError: 'log_file'

Was also able to reproduce on an installation as per this repo's docs on a more typical klipper setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant