From 29bbe507b073676e4e8f638c7a767f90a5fdd42c Mon Sep 17 00:00:00 2001 From: mooomooo Date: Sat, 12 Sep 2020 23:01:57 -0700 Subject: [PATCH 1/2] fixed DeprecationWarning: invalid escape sequence --- silhouette/Graphtec.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index febbd167..f37d3f96 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -395,7 +395,7 @@ def __init__(self, log=sys.stderr): print("Searching for bt devices on OSX", file=log) # on osx a rfcomm port is created and linked automatically when the cameo is connected # TODO add support for other machines. I would expect files like CAMEO3-... and PORTRAIT2-... - pat = re.compile("tty\.(PORTRAIT2|CAMEO3|CAMEO4)-.*") + pat = re.compile("tty.(PORTRAIT2|CAMEO3|CAMEO4)-.*") # get first matching port rfcomms = [f for f in os.listdir("/dev/") if pat.match(f)] rfcomm = rfcomms[0] if rfcomms else None @@ -414,7 +414,7 @@ def __init__(self, log=sys.stderr): else: # linux print("Searching for bt devices on Linux", file=log) - pat = re.compile("tty\.(PORTRAIT2|CAMEO3|CAMEO4)-?.*") + pat = re.compile("tty.(PORTRAIT2|CAMEO3|CAMEO4)-?.*") # get first matching port rfcomms = [f for f in os.listdir("/dev/") if pat.match(f)] rfcomm = rfcomms[0] if rfcomms else None @@ -1125,7 +1125,7 @@ def draw_mm_cmd(self, mmy, mmx): return "D%d,%d" % (_mm_2_SU(mmy), _mm_2_SU(mmx)) def upper_left_mm_cmd(self, mmy, mmx): - """ \y,x """ + r""" \y,x """ return "\\%d,%d" % (_mm_2_SU(mmy), _mm_2_SU(mmx)) def lower_right_mm_cmd(self, mmy, mmx): From b842ced3fd3fd1c32d94de9ebb013ce45a8e78a3 Mon Sep 17 00:00:00 2001 From: mooomooo Date: Sun, 13 Sep 2020 11:13:17 -0700 Subject: [PATCH 2/2] Sometimes cmd_list is an empty list? --- silhouette/Graphtec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index f37d3f96..c0405b3a 100644 --- a/silhouette/Graphtec.py +++ b/silhouette/Graphtec.py @@ -1398,7 +1398,8 @@ def plot(self, mediawidth=210.0, mediaheight=297.0, margintop=None, self.draw_mm_cmd(bbox['ury'], bbox['llx'])] # potentially long command string needs extra care - self.safe_send_command(cmd_list) + if cmd_list: + self.safe_send_command(cmd_list) self.wait_for_ready()