Closed CODeRUS closed 4 months ago
Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html
There are some steps that you can take now:
Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.
Best regards, ~ Your friendly GitIssueBot
PS: I'm just an automated script, not a human being.
looks like a sensible change? 7 thumbs up on this PR, what do you think @KevinOConnor?
Please review and accept.
Failed to complete printing several times after pause, because non-ascii comments inside gcode.
Thanks
Thanks. However, this change does not look correct to me (at least on Python2). When opening up a file in utf-8 encoding on python2 it changes the internal representation from a str()
object to a unicode()
object which has weird trickle down implications throughout the entire g-code processing stream. (This weird Python2 handling of unicode()
objects is likely why Python3 got rid of that whole system.)
I think we'll need to find the root cause of the underlying file position tracking problem. It would help if you could report the steps used to recreate the problem and whether or not it was py2 or py3.
Thanks again, -Kevin
The resume process begins at self.current_file.seek(self.file_position)
, where self.file_position
represents a byte-length offset. However, file_position
is incremented by len(line)
, which corresponds to the string length. If there are any UTF-8 characters preceding the 'PAUSE' command, the file position must be set before the occurrence of 'PAUSE'.
To address this issue, replacing the string length with the byte length is sufficient. Please find the modification below:
https://github.com/Klipper3d/klipper/pull/6469
# Before
# next_file_position = self.file_position + len(line) + 1
# After
# next_file_position = self.file_position + len(line.encode()) + 1
Hopefully this is fixed now with the merge of #6472 .
Thanks. -Kevin
This ticket is being closed because the underlying issue is now thought to be resolved.
Best regards, ~ Your friendly GitIssueBot
PS: I'm just an automated script, not a human being.
When printing file with utf-8 comments in it, pause/resume breaks printing process, it tries to resume at wrong position, caused by utf-8 (or utf-16) characters byte size.
This simple PR fixes issue