diff --git a/silhouette/Graphtec.py b/silhouette/Graphtec.py index febbd167..c0405b3a 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): @@ -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()