Skip to content

Commit

Permalink
Yet another float/int fix for Python 3.10+, don't assume every proble…
Browse files Browse the repository at this point in the history
…m is unicode related

Fixes #1302
  • Loading branch information
hroncok authored and kliment committed Jan 26, 2023
1 parent 8fd9b8b commit 2cf3b27
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def addtexttolog(self, text):
max_length = 20000
current_length = self.logbox.GetLastPosition()
if current_length > max_length:
self.logbox.Remove(0, current_length / 10)
self.logbox.Remove(0, current_length // 10)
currentCaretPosition = self.logbox.GetInsertionPoint()
currentLengthOfText = self.logbox.GetLastPosition()
if self.autoscrolldisable:
Expand All @@ -775,8 +775,10 @@ def addtexttolog(self, text):
self.logbox.SetInsertionPointEnd()
self.logbox.AppendText(text)

except:
except UnicodeError:
self.log(_("Attempted to write invalid text to console, which could be due to an invalid baudrate"))
except Exception as e:
self.log(_("Unhanded exception: "), repr(e))

def clear_log(self, e):
self.logbox.Clear()
Expand Down

0 comments on commit 2cf3b27

Please sign in to comment.