equal
deleted
inserted
replaced
44 -c - WAMP client config file or "off" (default:wampconf.json) |
44 -c - WAMP client config file or "off" (default:wampconf.json) |
45 -e - python extension (absolute path .py) |
45 -e - python extension (absolute path .py) |
46 |
46 |
47 working_dir - directory where are stored PLC files |
47 working_dir - directory where are stored PLC files |
48 """ % sys.argv[0] |
48 """ % sys.argv[0] |
|
49 |
49 |
50 |
50 try: |
51 try: |
51 opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:h") |
52 opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:h") |
52 except getopt.GetoptError, err: |
53 except getopt.GetoptError, err: |
53 # print help information and exit: |
54 # print help information and exit: |
157 |
158 |
158 if __name__ == '__main__': |
159 if __name__ == '__main__': |
159 __builtin__.__dict__['_'] = unicode_translation |
160 __builtin__.__dict__['_'] = unicode_translation |
160 # __builtin__.__dict__['_'] = wx.GetTranslation |
161 # __builtin__.__dict__['_'] = wx.GetTranslation |
161 |
162 |
|
163 |
162 if enablewx: |
164 if enablewx: |
163 try: |
165 try: |
164 import wxversion |
166 import wxversion |
165 wxversion.select(['2.8', '3.0']) |
167 wxversion.select(['2.8', '3.0']) |
166 import wx |
168 import wx |
464 if self.servicepublisher is not None: |
466 if self.servicepublisher is not None: |
465 self.servicepublisher.UnRegisterService() |
467 self.servicepublisher.UnRegisterService() |
466 self.servicepublisher = None |
468 self.servicepublisher = None |
467 self.daemon.shutdown(True) |
469 self.daemon.shutdown(True) |
468 |
470 |
|
471 |
469 if enabletwisted: |
472 if enabletwisted: |
470 import warnings |
473 import warnings |
471 with warnings.catch_warnings(): |
474 with warnings.catch_warnings(): |
472 warnings.simplefilter("ignore") |
475 warnings.simplefilter("ignore") |
473 try: |
476 try: |
535 def LogException(*exp): |
538 def LogException(*exp): |
536 if pyroserver.plcobj is not None: |
539 if pyroserver.plcobj is not None: |
537 pyroserver.plcobj.LogMessage(0, '\n'.join(traceback.format_exception(*exp))) |
540 pyroserver.plcobj.LogMessage(0, '\n'.join(traceback.format_exception(*exp))) |
538 else: |
541 else: |
539 traceback.print_exception(*exp) |
542 traceback.print_exception(*exp) |
|
543 |
540 |
544 |
541 sys.excepthook = LogException |
545 sys.excepthook = LogException |
542 |
546 |
543 |
547 |
544 def installThreadExcepthook(): |
548 def installThreadExcepthook(): |
553 raise |
557 raise |
554 except: |
558 except: |
555 sys.excepthook(*sys.exc_info()) |
559 sys.excepthook(*sys.exc_info()) |
556 self.run = run_with_except_hook |
560 self.run = run_with_except_hook |
557 threading.Thread.__init__ = init |
561 threading.Thread.__init__ = init |
|
562 |
|
563 |
558 installThreadExcepthook() |
564 installThreadExcepthook() |
559 |
565 |
560 if havetwisted: |
566 if havetwisted: |
561 if webport is not None: |
567 if webport is not None: |
562 try: |
568 try: |