Virtual sd card function after update

Hello!
I need help with printing via virtual sd card.
I’ve been using klipper for almost 2 years with no issue though after I updated it to v0.9.1, I’ve encountered an issue with printing via virtual sd card.
When I click the “sd card” menu on the lcd screen, klipper freezes and shuts down.
Also, “Menu” is missing from lcd screen.

Any help and suggestion would be appreciated.
Thank you in advance!

Following is part of klipper log.

Unhandled exception during run
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 201, in run
    self.reactor.run()
  File "/home/pi/klipper/klippy/reactor.py", line 269, in run
    g_next.switch()
  File "/home/pi/klipper/klippy/reactor.py", line 310, in _dispatch_loop
    timeout = self._check_timers(eventtime, busy)
  File "/home/pi/klipper/klippy/reactor.py", line 156, in _check_timers
    t.waketime = waketime = t.callback(eventtime)
  File "/home/pi/klipper/klippy/reactor.py", line 48, in invoke
    res = self.callback(eventtime)
  File "/home/pi/klipper/klippy/extras/buttons.py", line 76, in <lambda>
    (lambda e, s=self, b=nb: s.handle_button(e, b)))
  File "/home/pi/klipper/klippy/extras/buttons.py", line 82, in handle_button
    callback(eventtime, (button & mask) >> shift)
  File "/home/pi/klipper/klippy/extras/display/menu_keys.py", line 96, in click_callback
    self.callback('click', eventtime)
Connection to 10.0.0.4 closed by remote host.y/menu.py", line 1030, in key_event
Connection to 10.0.0.4 closed.time, key)
PS C:\WINDOWS\system32> /klippy/extras/display/menu.py", line 1023, in _click_callback
    self.press(event)
  File "/home/pi/klipper/klippy/extras/display/menu.py", line 932, in press
    self.stack_push(current)
  File "/home/pi/klipper/klippy/extras/display/menu.py", line 807, in stack_push
    container.update_items()
  File "/home/pi/klipper/klippy/extras/display/menu.py", line 350, in update_items
    if item.is_enabled()]
  File "/home/pi/klipper/klippy/extras/display/menu.py", line 94, in is_enabled
    return self.eval_enable(context)
  File "/home/pi/klipper/klippy/extras/display/menu.py", line 115, in eval_enable
    return bool(ast.literal_eval(self._enable_tpl.render(context)))
  File "/usr/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    /home/pi/.octoprint/uploads/table_saw_0.5in.gcode
    ^
SyntaxError: invalid syntax
Transition to shutdown state: Unhandled exception during run

Sineos: Edit formatting

Please attach the complete and unmodified log.

Thank you for your reply.
It took me while to figure out how to use WinSCP. :dizzy_face:
Here is the log file.
I appreciate any feedback and suggestion.

Thank you again!

klippy.log (60.6 KB)

Not sure, maybe an invalid gcode file? Does it happen with each file you want to print? Can you post the file?

Edit: I can barely imagine being possible, but does it also happen when you remove the . in 0.5 → table_saw_05in.gcode?

Thank you for checking the log.
I changed the file name to “sample” but got same error.

Do you have any idea why the lcd screen doesn’t show “Main” instead of just “…” as in the photo posted above?
When virtual sd card enabled, it should show “Start printing” I suppose?
But mine shows just ”…”
klippy.log (54.5 KB)

  1. From which version did you update to v0.91?
  2. Do you have any menu customization?
  3. Does it only happen with this file or with others as well?
  1. Updated from v0.8.0 to v0.9.1 on Jun 30, 2021
  2. No custom menus except [virtual_sdcard] though removing [virtual_sdcard] didn’t correct the problem with not showing “Main” as shown first photo posted above.
  3. Any file will cause same error. Tried bunch of files with different file names.

Thank you so much for your feedback!

For v0.9.0 the whole menu system has been overhauled.
Try replacing your menu.cfg with the stock one from klipper/menu.cfg at master · KevinOConnor/klipper · GitHub

Hi!
I replaced menu.cfg in “klipper/klippy/extras/display/menu.cfg” with the one in the link above though no luck.
I replaced printer.cfg with klipper/printer-creality-ender3-2018.cfg at master · KevinOConnor/klipper · GitHub (I use ender 3) because I noticed some changes since I first installed Klipper though unfortunately didn’t solve the problem either.

I’m completely lost! :scream:
Do you have any suggestion where I can look for?

Thank you for your help.

(never mind, I should have re-read the full thread before posting)

Well, I’m out of ideas now as well. Maybe as a last resort:

  • Backup away your printer.cfg
  • Delete the entire klipper folder
  • Checkout a fresh klipper and have it installed as per applicable documentation
  • Put back your cfg

Should be like 15 mins of work :innocent:

Hi!
Although uninstall and reinstall klipper didn’t solve the problem, I was able to get it work by overwriting menu in printer.cfg section.

I removed “and printer.virtual_sdcard.file_path” part from the menu section below.

[menu __main __sdcard __start]
type: command
enable: {(‘virtual_sdcard’ in printer) and printer.virtual_sdcard.file_path}
name: Start printing
gcode: M24

This way, I’m able to start printing from the lcd menu since “Start printing” shows up as long as [virtual sd card] enabled.

The lcd still doesn’t show “Main” though my printer seems fine with printing :sweat_smile:
My next challenge is to install Bltouch. I’ve been printing with manual bed leveling since I started 3d printing but finally ready to move on to auto bed leveling!

Anyway, thank you so much for reading my post and the logs.
I appreciate you and your time you’ve spent to help me out.

Any insights on why that code segment could be crashing klipper?

i am experiencing the same on a brand new klipper install and will try removing

“and printer.virtual_sdcard.file_path”

see if it works, but i would like to understand why it works and what that command is trying to do

Just to update i ended up fixing this issue by doing all available updates to the system and after that using make config and building and reflashing the firmware on the printer.

After that the SD card worked without any hacks