2032 redirect=redirect) |
2032 redirect=redirect) |
2033 else: |
2033 else: |
2034 if sys.argv[1] == '--no-encoding': |
2034 if sys.argv[1] == '--no-encoding': |
2035 self.noencoding = True |
2035 self.noencoding = True |
2036 del sys.argv[1] |
2036 del sys.argv[1] |
|
2037 |
2037 if sys.argv[1] == '': |
2038 if sys.argv[1] == '': |
2038 del sys.argv[1] |
2039 del sys.argv[1] |
|
2040 |
2039 try: |
2041 try: |
2040 port = int(sys.argv[1]) |
2042 port = int(sys.argv[1]) |
2041 except (ValueError, IndexError): |
2043 except (ValueError, IndexError): |
2042 port = -1 |
2044 port = -1 |
2043 try: |
2045 |
2044 redirect = int(sys.argv[2]) |
2046 if sys.argv[2] == "True": |
2045 except (ValueError, IndexError): |
|
2046 redirect = True |
2047 redirect = True |
|
2048 elif sys.argv[2] == "False": |
|
2049 redirect = False |
|
2050 else: |
|
2051 try: |
|
2052 redirect = int(sys.argv[2]) |
|
2053 except (ValueError, IndexError): |
|
2054 redirect = True |
|
2055 |
2047 try: |
2056 try: |
2048 ipOrHost = sys.argv[3] |
2057 ipOrHost = sys.argv[3] |
2049 if ':' in ipOrHost: |
2058 if ':' in ipOrHost: |
2050 remoteAddress = ipOrHost |
2059 remoteAddress = ipOrHost |
2051 elif ipOrHost[0] in '0123456789': |
2060 elif ipOrHost[0] in '0123456789': |
2052 remoteAddress = ipOrHost |
2061 remoteAddress = ipOrHost |
2053 else: |
2062 else: |
2054 remoteAddress = self.__resolveHost(ipOrHost) |
2063 remoteAddress = self.__resolveHost(ipOrHost) |
2055 except Exception: |
2064 except Exception: |
2056 remoteAddress = None |
2065 remoteAddress = None |
|
2066 |
2057 sys.argv = [''] |
2067 sys.argv = [''] |
2058 if '' not in sys.path: |
2068 if '' not in sys.path: |
2059 sys.path.insert(0, '') |
2069 sys.path.insert(0, '') |
|
2070 |
2060 if port >= 0: |
2071 if port >= 0: |
2061 if not self.noencoding: |
2072 if not self.noencoding: |
2062 self.__coding = self.defaultCoding |
2073 self.__coding = self.defaultCoding |
2063 self.connectDebugger(port, remoteAddress, redirect) |
2074 self.connectDebugger(port, remoteAddress, redirect) |
2064 self.__interact() |
2075 self.__interact() |