thonny.configure_backend_logging() import ast import sys args = ast.literal_eval(sys.argv[1]) try: if args["port"] is None: # remain busy while True: time.sleep(1000) elif args["port"] == "webrepl": connection = WebReplConnection(args["url"], args["password"]) else: from thonny.plugins.micropython.serial_connection import ( DifficultSerialConnection, SerialConnection, ) connection = SerialConnection(args["port"], BAUDRATE) # connection = DifficultSerialConnection(args["port"], BAUDRATE) if "circuitpython" in args.get("proxy_class", "").lower(): from thonny.plugins.circuitpython.cp_backend import CircuitPythonBackend backend = CircuitPythonBackend(connection, clean=args["clean"], args=args)
parser.add_argument("--port", type=str) parser.add_argument("--url", type=str) parser.add_argument("--password", type=str) parser.add_argument("--api_stubs_path", type=str) args = parser.parse_args() port = None if args.port == "None" else args.port try: if port is None: # remain busy while True: time.sleep(1000) elif port == "webrepl": from thonny.plugins.micropython.webrepl_connection import WebReplConnection connection = WebReplConnection(args.url, args.password) else: from thonny.plugins.micropython.serial_connection import SerialConnection connection = SerialConnection(port, BAUDRATE) vm = MicroPythonBackend(connection, clean=args.clean, api_stubs_path=args.api_stubs_path) except ConnectionFailedException as e: text = "\n" + str(e) + "\n" msg = BackendEvent(event_type="ProgramOutput", stream_name="stderr", data=text) sys.stdout.write(serialize_message(msg) + "\n")
class ExecutionError(Exception): pass def _report_internal_error(): print("PROBLEM WITH THONNY'S BACK-END:\n", file=sys.stderr) traceback.print_exc() if __name__ == "__main__": port = None if sys.argv[1] == "None" else sys.argv[1] try: if port == "webrepl": url = sys.argv[2] password = sys.argv[3] from thonny.plugins.micropython.webrepl_connection import WebReplConnection connection = WebReplConnection(url, password) else: from thonny.plugins.micropython.serial_connection import SerialConnection connection = SerialConnection(port, BAUDRATE) except ConnectionFailedException as e: msg = ToplevelResponse(error=str(e)) sys.stdout.write(serialize_message(msg) + "\n") connection = None vm = MicroPythonBackend(connection)
parser.add_argument("--url", type=str) parser.add_argument("--password", type=str) parser.add_argument("--api_stubs_path", type=str) parser.add_argument("--min_write_delay", type=float, default=0.01) args = parser.parse_args() port = None if args.port == "None" else args.port try: if port is None: # remain busy while True: time.sleep(1000) elif port == "webrepl": from thonny.plugins.micropython.webrepl_connection import WebReplConnection connection = WebReplConnection(args.url, args.password, args.min_write_delay) else: from thonny.plugins.micropython.serial_connection import SerialConnection from thonny.plugins.micropython.serial_connection import DifficultSerialConnection connection = SerialConnection(port, BAUDRATE) # connection = DifficultSerialConnection(port, BAUDRATE) vm = MicroPythonBareMetalBackend( connection, clean=args.clean, api_stubs_path=args.api_stubs_path ) except ConnectionFailedException as e: text = "\n" + str(e) + "\n" msg = BackendEvent(event_type="ProgramOutput", stream_name="stderr", data=text) sys.stdout.write(serialize_message(msg) + "\n")
logger.addHandler(file_handler) import ast import sys args = ast.literal_eval(sys.argv[1]) try: if args["port"] is None: # remain busy while True: time.sleep(1000) elif args["port"] == "webrepl": from thonny.plugins.micropython.webrepl_connection import WebReplConnection connection = WebReplConnection(args["url"], args["password"], args["min_write_delay"]) else: from thonny.plugins.micropython.serial_connection import ( DifficultSerialConnection, SerialConnection, ) connection = SerialConnection(args["port"], BAUDRATE) # connection = DifficultSerialConnection(args["port"], BAUDRATE) backend = BareMetalMicroPythonBackend(connection, clean=args["clean"], args=args) except ConnectionFailedException as e: text = "\n" + str(e) + "\n"