-
Notifications
You must be signed in to change notification settings - Fork 14
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
Editing printer.cfg from within Octoklipper nulls the printer.cfg #9
Comments
you may used special characters? or comma instead of point? For me this was the cause in the old version.. |
Not as far as I know. I was editing the file that I was using between prints to lower a stepper current. From 600 to 550 and then saved. After that it was just a blank file. Actually just checked and didn't see any special characters or commas that weren't in commented out lines. |
Me too! 🙈🙈😤😤 |
same issue |
This is an old issue related to precision in floating point numbers such as in the extruder step distance. |
@girrrrrrr2 and @tvercruysse Could you please provide a copy of your config file for testing? |
@mental405 I think this is most likely the case. I will attempt to recreate the issue but so far my config has saved. It's possible my config is not replicating the issue properly. |
Just add , or ö ä ü or ß to your config and Press save. Or add more numbers after a dot:. 0.00000000000000009 for extruder step distance |
This should fix issue #9 but may leave users open to issue with python2's handling of strings.
Ok. I need testers who are using python2 and testers who are using python3. Please Uninstall the plugin then manually install the following branch in octoprint. https://github.com/AliceGrey/OctoprintKlipperPlugin/archive/configUnicodeFix.zip. As always. Make sure you have backups and know what you're doing and can fix issues with your octoprint install if they arise. Thank you! |
I blame javascript because it is always javascript. Regardless of whether it can get fixed or not, I think it would be a good idea to write the current config out to a backup file and add a check around line 104 to check the length of the string or something before blindly overwriting the config file. |
@mental405 It looks to be the unicode conversion in python actually. I definitely agree the handling of saving the file is really rough and needs more sanity checking. There is a lot of sanity checking that I've been working on adding to the plugin. It's just not done yet. |
Another thing that would be useful and idk how to do it with the oprint events.. .but maybe there is an on_terminal_string event or something... basically the plugin should reload the config file if the config file is altered outside of the plugin. Example |
I can not trigger this, either with unicode or numbers in the regular branch? Ive triggered the unicode bug in mmone/OctoprintKlipperPlugin before though. I am running python 2 though. |
@mental405 So in my fork this shouldn't happen anymore. I changed it so the file is reloaded whenever the settings page is opened to look at the config file. It shouldn't be opening a cached copy. That could be a browser/JS issue though. Edit: If this is still happening though open an issue and I'll take a look at it 👍 |
Ah cool I haven't had a chance to download and run yours yet. I have been on vacation and someone mentioned that OctoKlipper was under new management so I thought I would pop in and check the commit history and open issues to see if this exact thing had been fixed yet :P I plan on loading it up as soon as I get back. |
hellooo! I'm Here |
Happened to me too while changing the temperature inside
upon the reboot of the printer (to apply the config) |
@AliceGrey I have an automated image building process going on so I can quickly build images to test whichever branch of the plugin you want. Check https://github.com/goeland86/ReFactor. I'm currently validating the build with the py3 plugin works, as soon as my pi4 spits out a valid image to test I'll be testing it with py2 and py3 on a "sandbox" Beaglebone + Replicape setup. |
Hi, I tested it with python 3 and it seems to work, I can edit and save the cfg file and it doesn't get wiped anymore |
@definitely-not-a-t-rex Thank you. I just need someone to test and verify in python 2 then I'll merge the fix. It works in my local dev environment but I'd like confirmation. |
If nobody does it by Friday I can clone the install and try reverting to python 2 and test it there too, I'm really busy until then but after I should have a few days of freedom from uni |
I plan on testing it tonight with my py2 install. Although I could not trigger the original bug, it might be a good smoke test. |
To recreate the original bug, wouldn't trying to use one of the attached configs at the top of the ticket do the trick? I'm happy to do it on my sandbox - building a py2 image right now. |
Tried with the attached config, tried adding lots of zeroes to numbers and some unicode characters. Still no bug. |
Uhm. I dont know what to say. ^ This build clears the config at once for me with py2! The original branch from this repo, not a single time. Is this a py2/py3 issue? Either that or I am doing something really stupid. |
@sandos Yes this is a python 2 vs python 3 issue. Python 3 strings are unicode by default. The original developer had a unicode conversion that doesn't work in python 3 but worked in python 2. @goeland86 Could you please test the build in your py2 image. |
@AliceGrey I tried it on Py2... But when I do a change in OctoKlipper, it isn't saved to the file on disk. |
Actually, found this in the Octoprint log file:
|
Huh. Uninstalling the plugin in OctoPrint, then reinstalling it allows me to save known good changes. |
@AliceGrey ok - so I confirm what @sandos reported. If there's a UTF-8 character in the config (I used æøå in a comment), it clears out the entire file. Plugin was installed from URL using https://github.com/AliceGrey/OctoprintKlipperPlugin/archive/configUnicodeFix.zip |
Ok I'll work on a python 2/3 fix that works for both. |
Fixes issue #9 but keeps unicode conversion for python2 users.
@goeland86 and @sandos please test the newest version of https://github.com/AliceGrey/OctoprintKlipperPlugin/archive/configUnicodeFix.zip. It now includes an if statement to keep the old code for py2. It is tested and working on my python2 and python3 dev environment. |
@AliceGrey I confirm that with the newer version, the comment with |
And I confirm it works on py3 build as well 👍 |
Fixes issue #9 but keeps unicode conversion for python2 users.
Works perfectly, thanks! |
octopi,
Octoprint version 1.4.2
Octopi Version 0.17.0
octoprint.log
When updating the klipper Printer.cfg from within octoklipper it nulls your printer CFG config.
Im not sure exactly how that happens, the file chmod is 0777.
Ive confirmed it twice on accident by editing and having to recover/remake my file
The text was updated successfully, but these errors were encountered: