-
Notifications
You must be signed in to change notification settings - Fork 101
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
Info: Special characters in JINJA2 templates can be done using HTML code #26
Comments
Thank you for that. I will add it to the readme. Honestly Python2 installation need to “die”. Kiauh now supports setting up a Python3 based Klipper so you can switch in Minutes. And MainsailOS also setups a Python3. |
I used that feature in KIAUH (for python3), but if you look at /home/pi/klippy-env/bin/ path which is the Virtual Environment for Klipper I still see the python2 is still installed. I do not know if all the Klipper .py files are converted over to python3. I thinks some are not yet done yet. Do you know? |
We checked kiauh it should build a new env based on py3. But I will talk to the kiauh def and test it with him again. Can you describe how you did the switch between 2 and 3. No there are still a few scripts that make problems but that are debug scripts that the regular user does not use at all. |
Let me see if I can find it. |
Well, the doc in no longer there. What I recall is that they used KIUAH can used the option to use a custom Klipper branch that was updated to Python3. I suppose Bigtreetech took it down because, that was over a year ago and the branch probably did not stay up to date with Klipper. From what I have found out today is that Klipper mainly is still pyton2 but is moving to python3. So Klipper does use both versions of python . The last entry I saw was that Kevin was saying that python3 was slower with some things in Klipper than python2 and that is why the move has not been made yet. If you know differently, please inform me. |
Yes Kevin’s tells more than a year he is switching to py3. The main problem is that at Debian 11 (bullseye) some packages are not available anymore. That’s e.g. the reason why the switch for the IS post processing script to py3 was mandatory. I run my V2 now more than a year on a py3 only install with speeds up to 450 mm/s and 8k accel. So I can not buy that argument. And anyhow py2 is obsolete the Service live is also over so that there will be no other choice anyhow. And furthermore the main stuff runs on both now only some debug scripts do not. The process to get a machine to py3 using kiauh is very simple:
Doing that you will see that your v-env only contains Python3. That has nothing to do with that your current of has installed both. But if you would do a fresh install with a bullseye lite image you would see that Python 2 is not installed at all. |
I just checked we have more than 10k MainsailOS 1.0.1 and ~7k MainsailOS 1.0.0 downloads. So at least all these machines run in a Python3 only environment. https://endoflife.software/operating-systems/linux/debian Debian10 (buster) is EOL since August 2022. That’s the reason why a switch to bullseye was so important for us at the mainsail-crew. LTS for buster may run until June 30th, 2024 |
And much worse for Python 2.7 😉 https://devguide.python.org/versions/#python-release-cycle.That was EOL 2020. |
In your README.md you have the following;
Your README
If you use Python2 or Python3 you can still use one uniform method to translate special characters. JINJA2 template engine is meant to render HTML pages. HTML has special codes for special symbols.
So In your PRINT_START routine, you have the following:
which causes errors for python2 users. But instead of using the unicode character you could do this instead:
the
º
is the special coding for HTML page for ° or the symbol calledmasculine ordinal indicator
You can find all special characters representation for HTML at https://www.html.am/reference/html-special-characters.cfm
Here is another example, you have this in your CANCEL_PRINT:
But it can be written as follows and will work no matter if you are using python2:
Here is the HTML code for the degree symbol
Below is my output to the UI console:
Here is the code I used:
I hope this helps other.
The text was updated successfully, but these errors were encountered: