equal
deleted
inserted
replaced
46 tb = tb.tb_next |
46 tb = tb.tb_next |
47 return tb |
47 return tb |
48 |
48 |
49 |
49 |
50 lib_ext = { |
50 lib_ext = { |
51 "linux2": ".so", |
51 "linux2": ".so", |
52 "win32": ".dll", |
52 "win32": ".dll", |
53 }.get(sys.platform, "") |
53 }.get(sys.platform, "") |
54 |
54 |
55 |
55 |
56 def PLCprint(message): |
56 def PLCprint(message): |
57 sys.stdout.write("PLCobject : "+message+"\n") |
57 sys.stdout.write("PLCobject : "+message+"\n") |
58 sys.stdout.flush() |
58 sys.stdout.flush() |
83 |
83 |
84 def AutoLoad(self): |
84 def AutoLoad(self): |
85 # Get the last transfered PLC if connector must be restart |
85 # Get the last transfered PLC if connector must be restart |
86 try: |
86 try: |
87 self.CurrentPLCFilename = open( |
87 self.CurrentPLCFilename = open( |
88 self._GetMD5FileName(), |
88 self._GetMD5FileName(), |
89 "r").read().strip() + lib_ext |
89 "r").read().strip() + lib_ext |
90 if self.LoadPLC(): |
90 if self.LoadPLC(): |
91 self.PLCStatus = "Stopped" |
91 self.PLCStatus = "Stopped" |
92 except Exception: |
92 except Exception: |
93 self.PLCStatus = "Empty" |
93 self.PLCStatus = "Empty" |
94 self.CurrentPLCFilename = None |
94 self.CurrentPLCFilename = None |
558 exec script in kwargs |
558 exec script in kwargs |
559 except Exception: |
559 except Exception: |
560 _e_type, e_value, e_traceback = sys.exc_info() |
560 _e_type, e_value, e_traceback = sys.exc_info() |
561 line_no = traceback.tb_lineno(get_last_traceback(e_traceback)) |
561 line_no = traceback.tb_lineno(get_last_traceback(e_traceback)) |
562 return (-1, "RemoteExec script failed!\n\nLine %d: %s\n\t%s" % |
562 return (-1, "RemoteExec script failed!\n\nLine %d: %s\n\t%s" % |
563 (line_no, e_value, script.splitlines()[line_no - 1])) |
563 (line_no, e_value, script.splitlines()[line_no - 1])) |
564 return (0, kwargs.get("returnVal", None)) |
564 return (0, kwargs.get("returnVal", None)) |