Marlin
Marlin copied to clipboard
Update Python scripts (mostly)
Description
Update Python scripts with exception to \buildroot\bin\use_example_configs.
Some changes are simple, like remove a typo or import [missing module].
Any formal formatting has moved here #27503.
- Added debug info
- Updated pinsformat.py with some "-h"/"--help" options.
- Updated schema.py, "-h"/"--help" gave "Unknown Option".
- Removed languageUtil.py, moved to languageExport.py.
- Improved g29_auto.py, which removed errors, added color in
print()messages + debugging, also include G0 moves. - Updated svg2cpp.py, had typo and errors, plus outdated instructions, and it now automatically outputs a file utilizing the header.
Requirements
Benefits
Configurations
Related Issues
Unsure About:
- In g29_auto.py, is this meant to read G-code files with lowercase commands?
g29_keyword = 'g29'
g29_keyword = g29_keyword.upper()
- fix this error in share/scripts/g29_auto.py:
"None" is not iterable
"__iter__" method not defined
while len(gcode) > i:
- try:
- z, i = find_z(gcode, i + 1)
- except TypeError:
- break
while len(gcode) > i:
+ result = find_z(gcode, i + 1)
+ if result is None:
+ break
+ z, i = result
-start, end = get_lines(gcode, min_g1)
+layer_range = get_lines(gcode, min_g1)
+if layer_range is None:
+ print("Error: Unable to determine layer range. Exiting.")
+ exit(1)
+start, end = layer_range
[!NOTE] Doesnt have to say
"Error: Unable to determine layer range. Exiting."per say, or toexit, but its suggested
also, near the end of this file, you will see
out_file = open(output_file, 'w')
in_file = open(input_file, 'r')
# other code ....
file.close()
out_file.close()
previously, file.close() should be in_file.close(), but the code has since been improved.
- In pinsformat.py, is this correct?
src_file = args.infile or 'stdin'
dst_file = args.outfile or None
This was added along with argparse to add "help".
Also, I'm unsure of what the purpose is when running
the file with no arguments, because it stalls.
so with Ctrl+C:
line 76, in format_pins
file_text = sys.stdin.read()
^^^^^^^^^^^^^^^^
KeyboardInterrupt
________________________
and debugging gives me :
FileNotFoundError: [Errno 2] No such file or directory: 'stdin'