diff options
29 files changed, 99 insertions, 121 deletions
diff --git a/examples/hwapi/README.md b/examples/hwapi/README.md index f3de752f9..a1b0c5642 100644 --- a/examples/hwapi/README.md +++ b/examples/hwapi/README.md @@ -40,13 +40,13 @@ application of this idea would look like: `app.py`: from hwconfig import * - import utime + import time while True: LED.value(1) - utime.sleep_ms(500) + time.sleep_ms(500) LED.value(0) - utime.sleep_ms(500) + time.sleep_ms(500) To deploy this application to a particular board, a user will need: diff --git a/examples/hwapi/button_led.py b/examples/hwapi/button_led.py index bd6fe0172..c73bcfc89 100644 --- a/examples/hwapi/button_led.py +++ b/examples/hwapi/button_led.py @@ -1,4 +1,4 @@ -import utime +import time from hwconfig import LED, BUTTON # Light LED when (and while) a BUTTON is pressed @@ -6,4 +6,4 @@ from hwconfig import LED, BUTTON while 1: LED.value(BUTTON.value()) # Don't burn CPU - utime.sleep_ms(10) + time.sleep_ms(10) diff --git a/examples/hwapi/button_reaction.py b/examples/hwapi/button_reaction.py index e5a139a57..52bdf7938 100644 --- a/examples/hwapi/button_reaction.py +++ b/examples/hwapi/button_reaction.py @@ -1,4 +1,4 @@ -import utime +import time import machine from hwconfig import LED, BUTTON @@ -18,4 +18,4 @@ while 1: print("Well, you're *really* slow") else: print("You are as slow as %d microseconds!" % delay) - utime.sleep_ms(10) + time.sleep_ms(10) diff --git a/examples/hwapi/soft_pwm.py b/examples/hwapi/soft_pwm.py index 72291b0ec..466de08f0 100644 --- a/examples/hwapi/soft_pwm.py +++ b/examples/hwapi/soft_pwm.py @@ -1,4 +1,4 @@ -import utime +import time from hwconfig import LED @@ -15,10 +15,10 @@ def pwm_cycle(led, duty, cycles): for i in range(cycles): if duty: led.on() - utime.sleep_ms(duty) + time.sleep_ms(duty) if duty_off: led.off() - utime.sleep_ms(duty_off) + time.sleep_ms(duty_off) # At the duty setting of 1, an LED is still pretty bright, then diff --git a/examples/network/http_client.py b/examples/network/http_client.py index 0791c8066..661c286b7 100644 --- a/examples/network/http_client.py +++ b/examples/network/http_client.py @@ -1,7 +1,4 @@ -try: - import usocket as socket -except: - import socket +import socket def main(use_stream=False): diff --git a/examples/network/http_client_ssl.py b/examples/network/http_client_ssl.py index 83f685fdf..323971c0e 100644 --- a/examples/network/http_client_ssl.py +++ b/examples/network/http_client_ssl.py @@ -1,17 +1,11 @@ -try: - import usocket as _socket -except: - import _socket -try: - import ussl as ssl -except: - import ssl +import socket +import ssl def main(use_stream=True): - s = _socket.socket() + s = socket.socket() - ai = _socket.getaddrinfo("google.com", 443) + ai = socket.getaddrinfo("google.com", 443) print("Address infos:", ai) addr = ai[0][-1] diff --git a/examples/network/http_server.py b/examples/network/http_server.py index 76be3ab81..a6ed53154 100644 --- a/examples/network/http_server.py +++ b/examples/network/http_server.py @@ -1,7 +1,4 @@ -try: - import usocket as socket -except: - import socket +import socket CONTENT = b"""\ diff --git a/examples/network/http_server_simplistic.py b/examples/network/http_server_simplistic.py index a9831127f..09936b9d9 100644 --- a/examples/network/http_server_simplistic.py +++ b/examples/network/http_server_simplistic.py @@ -1,9 +1,6 @@ # Do not use this code in real projects! Read # http_server_simplistic_commented.py for details. -try: - import usocket as socket -except: - import socket +import socket CONTENT = b"""\ diff --git a/examples/network/http_server_simplistic_commented.py b/examples/network/http_server_simplistic_commented.py index da042c6c8..d4710ad61 100644 --- a/examples/network/http_server_simplistic_commented.py +++ b/examples/network/http_server_simplistic_commented.py @@ -8,10 +8,7 @@ # details, and use this code only for quick hacks, preferring # http_server.py for "real thing". # -try: - import usocket as socket -except: - import socket +import socket CONTENT = b"""\ diff --git a/examples/network/http_server_ssl.py b/examples/network/http_server_ssl.py index 1116c71e9..7766fa7ea 100644 --- a/examples/network/http_server_ssl.py +++ b/examples/network/http_server_ssl.py @@ -1,10 +1,6 @@ -import ubinascii as binascii - -try: - import usocket as socket -except: - import socket -import ussl as ssl +import binascii +import socket +import ssl # This self-signed key/cert pair is randomly generated and to be used for diff --git a/examples/unix/machine_bios.py b/examples/unix/machine_bios.py index 878f3fd8f..40aae4cce 100644 --- a/examples/unix/machine_bios.py +++ b/examples/unix/machine_bios.py @@ -4,6 +4,6 @@ # It is expected to print 0xaa55, which is a signature at the start of # Video BIOS. -import umachine as machine +import machine print(hex(machine.mem16[0xC0000])) diff --git a/extmod/uasyncio/event.py b/extmod/uasyncio/event.py index 43d47eb5f..8a9053459 100644 --- a/extmod/uasyncio/event.py +++ b/extmod/uasyncio/event.py @@ -40,9 +40,9 @@ class Event: # that asyncio will poll until a flag is set. # Note: Unlike Event, this is self-clearing after a wait(). try: - import uio + import io - class ThreadSafeFlag(uio.IOBase): + class ThreadSafeFlag(io.IOBase): def __init__(self): self.state = 0 diff --git a/extmod/uasyncio/stream.py b/extmod/uasyncio/stream.py index 875353c94..ac297cce0 100644 --- a/extmod/uasyncio/stream.py +++ b/extmod/uasyncio/stream.py @@ -101,8 +101,8 @@ StreamWriter = Stream # # async def open_connection(host, port): - from uerrno import EINPROGRESS - import usocket as socket + from errno import EINPROGRESS + import socket ai = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0] # TODO this is blocking! s = socket.socket(ai[0], ai[1], ai[2]) @@ -154,7 +154,7 @@ class Server: # Helper function to start a TCP stream server, running as a new task # TODO could use an accept-callback on socket read activity instead of creating a task async def start_server(cb, host, port, backlog=5): - import usocket as socket + import socket # Create and bind server socket. host = socket.getaddrinfo(host, port)[0] # TODO this is blocking! diff --git a/ports/esp32/modules/_boot.py b/ports/esp32/modules/_boot.py index a7d981309..651fc7b10 100644 --- a/ports/esp32/modules/_boot.py +++ b/ports/esp32/modules/_boot.py @@ -1,10 +1,10 @@ import gc -import uos +import os from flashbdev import bdev try: if bdev: - uos.mount(bdev, "/") + os.mount(bdev, "/") except OSError: import inisetup diff --git a/ports/esp32/modules/inisetup.py b/ports/esp32/modules/inisetup.py index 426a47a6b..35d1c6bc9 100644 --- a/ports/esp32/modules/inisetup.py +++ b/ports/esp32/modules/inisetup.py @@ -1,4 +1,4 @@ -import uos +import os from flashbdev import bdev @@ -33,9 +33,9 @@ by firmware programming). def setup(): check_bootsec() print("Performing initial setup") - uos.VfsLfs2.mkfs(bdev) - vfs = uos.VfsLfs2(bdev) - uos.mount(vfs, "/") + os.VfsLfs2.mkfs(bdev) + vfs = os.VfsLfs2(bdev) + os.mount(vfs, "/") with open("boot.py", "w") as f: f.write( """\ diff --git a/ports/esp8266/boards/GENERIC/board.md b/ports/esp8266/boards/GENERIC/board.md index b93ca509f..fa0cf410d 100644 --- a/ports/esp8266/boards/GENERIC/board.md +++ b/ports/esp8266/boards/GENERIC/board.md @@ -6,7 +6,7 @@ Note: v1.12-334 and newer (including v1.13) require an ESP8266 module with 2MiB of flash or more, and use littlefs as the filesystem by default. When upgrading from older firmware please backup your files first, and either erase all flash before upgrading, or after upgrading execute -`uos.VfsLfs2.mkfs(bdev)`. +`os.VfsLfs2.mkfs(bdev)`. ### OTA builds Over-The-Air (OTA) builds of the ESP8266 firmware are also provided. diff --git a/ports/esp8266/boards/GENERIC_1M/board.md b/ports/esp8266/boards/GENERIC_1M/board.md index 4a0e67707..17cc6e3a6 100644 --- a/ports/esp8266/boards/GENERIC_1M/board.md +++ b/ports/esp8266/boards/GENERIC_1M/board.md @@ -2,4 +2,4 @@ The following are daily builds of the ESP8266 firmware tailored for modules with only 1MiB of flash. This firmware uses littlefs as the filesystem. When upgrading from older firmware that uses a FAT filesystem please backup your files first, and either erase all flash before upgrading, or after upgrading execute -`uos.VfsLfs2.mkfs(bdev)`. +`os.VfsLfs2.mkfs(bdev)`. diff --git a/ports/esp8266/modules/_boot.py b/ports/esp8266/modules/_boot.py index 1f77d8802..06b372990 100644 --- a/ports/esp8266/modules/_boot.py +++ b/ports/esp8266/modules/_boot.py @@ -1,12 +1,12 @@ import gc gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) -import uos +import os from flashbdev import bdev if bdev: try: - uos.mount(bdev, "/") + os.mount(bdev, "/") except: import inisetup diff --git a/ports/esp8266/modules/espnow.py b/ports/esp8266/modules/espnow.py index 2f9c256c6..1d2b94655 100644 --- a/ports/esp8266/modules/espnow.py +++ b/ports/esp8266/modules/espnow.py @@ -2,7 +2,7 @@ # MIT license; Copyright (c) 2022 Glenn Moloney @glenn20 from _espnow import * -from uselect import poll, POLLIN +from select import poll, POLLIN class ESPNow(ESPNowBase): diff --git a/ports/esp8266/modules/inisetup.py b/ports/esp8266/modules/inisetup.py index e5ce00138..fa6a93fd8 100644 --- a/ports/esp8266/modules/inisetup.py +++ b/ports/esp8266/modules/inisetup.py @@ -1,13 +1,13 @@ -import uos +import os import network from flashbdev import bdev def wifi(): - import ubinascii + import binascii ap_if = network.WLAN(network.AP_IF) - ssid = b"MicroPython-%s" % ubinascii.hexlify(ap_if.config("mac")[-3:]) + ssid = b"MicroPython-%s" % binascii.hexlify(ap_if.config("mac")[-3:]) ap_if.config(ssid=ssid, security=network.AUTH_WPA_WPA2_PSK, key=b"micropythoN") @@ -32,7 +32,7 @@ def fs_corrupted(): """\ The filesystem starting at sector %d with size %d sectors looks corrupt. You may want to make a flash snapshot and try to recover it. Otherwise, -format it with uos.VfsLfs2.mkfs(bdev), or completely erase the flash and +format it with os.VfsLfs2.mkfs(bdev), or completely erase the flash and reprogram MicroPython. """ % (bdev.start_sec, bdev.blocks) @@ -44,17 +44,17 @@ def setup(): check_bootsec() print("Performing initial setup") wifi() - uos.VfsLfs2.mkfs(bdev) - vfs = uos.VfsLfs2(bdev) - uos.mount(vfs, "/") + os.VfsLfs2.mkfs(bdev) + vfs = os.VfsLfs2(bdev) + os.mount(vfs, "/") with open("boot.py", "w") as f: f.write( """\ # This file is executed on every boot (including wake-boot from deepsleep) #import esp #esp.osdebug(None) -import uos, machine -#uos.dupterm(None, 1) # disable REPL on UART(0) +import os, machine +#os.dupterm(None, 1) # disable REPL on UART(0) import gc #import webrepl #webrepl.start() diff --git a/ports/nrf/modules/scripts/_mkfs.py b/ports/nrf/modules/scripts/_mkfs.py index 00522ffbb..02e8dabce 100644 --- a/ports/nrf/modules/scripts/_mkfs.py +++ b/ports/nrf/modules/scripts/_mkfs.py @@ -1,19 +1,19 @@ -import uos, nrf +import os, nrf try: - from uos import VfsLfs1 + from os import VfsLfs1 - uos.VfsLfs1.mkfs(nrf.Flash()) + os.VfsLfs1.mkfs(nrf.Flash()) except ImportError: try: - from uos import VfsLfs2 + from os import VfsLfs2 - uos.VfsLfs2.mkfs(nrf.Flash()) + os.VfsLfs2.mkfs(nrf.Flash()) except ImportError: try: - from uos import VfsFat + from os import VfsFat - uos.VfsFat.mkfs(nrf.Flash()) + os.VfsFat.mkfs(nrf.Flash()) except ImportError: pass except OSError as e: diff --git a/ports/rp2/modules/rp2.py b/ports/rp2/modules/rp2.py index f145cbd60..a34e8e92a 100644 --- a/ports/rp2/modules/rp2.py +++ b/ports/rp2/modules/rp2.py @@ -34,9 +34,9 @@ class PIOASMEmit: pull_thresh=32, fifo_join=0 ): - # uarray is a built-in module so importing it here won't require + # array is a built-in module so importing it here won't require # scanning the filesystem. - from uarray import array + from array import array self.labels = {} execctrl = 0 diff --git a/ports/samd/modules/_boot.py b/ports/samd/modules/_boot.py index 5fe2bc640..1ff51de59 100644 --- a/ports/samd/modules/_boot.py +++ b/ports/samd/modules/_boot.py @@ -1,19 +1,19 @@ import gc -import uos +import os import samd bdev = samd.Flash() # Try to mount the filesystem, and format the flash if it doesn't exist. -fs_type = uos.VfsLfs2 if hasattr(uos, "VfsLfs2") else uos.VfsLfs1 +fs_type = os.VfsLfs2 if hasattr(os, "VfsLfs2") else os.VfsLfs1 try: vfs = fs_type(bdev, progsize=256) except: fs_type.mkfs(bdev, progsize=256) vfs = fs_type(bdev, progsize=256) -uos.mount(vfs, "/") +os.mount(vfs, "/") -del vfs, fs_type, bdev, uos, samd +del vfs, fs_type, bdev, os, samd gc.collect() del gc diff --git a/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py b/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py index fe34ce122..3c741e575 100644 --- a/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py +++ b/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py @@ -73,7 +73,7 @@ import struct, os try: import machine, stm - from ubinascii import crc32 + from binascii import crc32 from micropython import const except ImportError: # cpython diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index 4bf07f5a3..78a8d7365 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -3,7 +3,7 @@ from micropython import const import struct, time -import uzlib, machine, stm +import zlib, machine, stm # Constants to be used with update_mpy VFS_FAT = 1 @@ -36,7 +36,7 @@ def dfu_read(filename): if hdr == b"Dfu": pass elif hdr == b"\x1f\x8b\x08": - f = uzlib.DecompIO(f, 16 + 15) + f = zlib.DecompIO(f, 16 + 15) else: print("Invalid firmware", filename) return None @@ -231,7 +231,7 @@ def update_app_elements( # Check firmware is of .dfu or .dfu.gz type try: with open(filename, "rb") as f: - hdr = uzlib.DecompIO(f, 16 + 15).read(6) + hdr = zlib.DecompIO(f, 16 + 15).read(6) except Exception: with open(filename, "rb") as f: hdr = f.read(6) diff --git a/tools/mpremote/mpremote/commands.py b/tools/mpremote/mpremote/commands.py index 45acb8da1..ef1a7643c 100644 --- a/tools/mpremote/mpremote/commands.py +++ b/tools/mpremote/mpremote/commands.py @@ -137,14 +137,14 @@ def do_filesystem(state, args): raise CommandError("'cp -r' source files must be local") _list_recursive(src_files, path) known_dirs = {""} - state.transport.exec_("import uos") + state.transport.exec_("import os") for dir, file in src_files: dir_parts = dir.split("/") for i in range(len(dir_parts)): d = "/".join(dir_parts[: i + 1]) if d not in known_dirs: state.transport.exec_( - "try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d + "try:\n os.mkdir('%s')\nexcept OSError as e:\n print(e)" % d ) known_dirs.add(d) state.transport.filesystem_command( diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 668926609..eeb9cbd98 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -317,7 +317,7 @@ _BUILTIN_COMMAND_EXPANSIONS = { # Disk used/free. "df": [ "exec", - "import uos\nprint('mount \\tsize \\tused \\tavail \\tuse%')\nfor _m in [''] + uos.listdir('/'):\n _s = uos.stat('/' + _m)\n if not _s[0] & 1 << 14: continue\n _s = uos.statvfs(_m)\n if _s[0]:\n _size = _s[0] * _s[2]; _free = _s[0] * _s[3]; print(_m, _size, _size - _free, _free, int(100 * (_size - _free) / _size), sep='\\t')", + "import os\nprint('mount \\tsize \\tused \\tavail \\tuse%')\nfor _m in [''] + os.listdir('/'):\n _s = os.stat('/' + _m)\n if not _s[0] & 1 << 14: continue\n _s = os.statvfs(_m)\n if _s[0]:\n _size = _s[0] * _s[2]; _free = _s[0] * _s[3]; print(_m, _size, _size - _free, _free, int(100 * (_size - _free) / _size), sep='\\t')", ], # Other shortcuts. "reset": { diff --git a/tools/mpremote/mpremote/transport_serial.py b/tools/mpremote/mpremote/transport_serial.py index 84822fe69..09025c309 100644 --- a/tools/mpremote/mpremote/transport_serial.py +++ b/tools/mpremote/mpremote/transport_serial.py @@ -292,14 +292,14 @@ class SerialTransport(Transport): def fs_exists(self, src): try: - self.exec("import uos\nuos.stat(%s)" % (("'%s'" % src) if src else "")) + self.exec("import os\nos.stat(%s)" % (("'%s'" % src) if src else "")) return True except TransportError: return False def fs_ls(self, src): cmd = ( - "import uos\nfor f in uos.ilistdir(%s):\n" + "import os\nfor f in os.ilistdir(%s):\n" " print('{:12} {}{}'.format(f[3]if len(f)>3 else 0,f[0],'/'if f[1]&0x4000 else ''))" % (("'%s'" % src) if src else "") ) @@ -311,7 +311,7 @@ class SerialTransport(Transport): def repr_consumer(b): buf.extend(b.replace(b"\x04", b"")) - cmd = "import uos\nfor f in uos.ilistdir(%s):\n" " print(repr(f), end=',')" % ( + cmd = "import os\nfor f in os.ilistdir(%s):\n" " print(repr(f), end=',')" % ( ("'%s'" % src) if src else "" ) try: @@ -328,8 +328,8 @@ class SerialTransport(Transport): def fs_stat(self, src): try: - self.exec("import uos") - return os.stat_result(self.eval("uos.stat(%s)" % (("'%s'" % src)), parse=True)) + self.exec("import os") + return os.stat_result(self.eval("os.stat(%s)" % (("'%s'" % src)), parse=True)) except TransportError as e: reraise_filesystem_error(e, src) @@ -422,13 +422,13 @@ class SerialTransport(Transport): self.exec("f.close()") def fs_mkdir(self, dir): - self.exec("import uos\nuos.mkdir('%s')" % dir) + self.exec("import os\nos.mkdir('%s')" % dir) def fs_rmdir(self, dir): - self.exec("import uos\nuos.rmdir('%s')" % dir) + self.exec("import os\nos.rmdir('%s')" % dir) def fs_rm(self, src): - self.exec("import uos\nuos.remove('%s')" % src) + self.exec("import os\nos.remove('%s')" % src) def fs_touch(self, src): self.exec("f=open('%s','a')\nf.close()" % src) @@ -595,7 +595,7 @@ class SerialTransport(Transport): def umount_local(self): if self.mounted: - self.exec('uos.umount("/remote")') + self.exec('os.umount("/remote")') self.mounted = False self.serial = self.serial.orig_serial @@ -616,18 +616,18 @@ fs_hook_cmds = { } fs_hook_code = """\ -import uos, uio, ustruct, micropython +import os, io, struct, micropython SEEK_SET = 0 class RemoteCommand: def __init__(self): - import uselect, usys + import select, sys self.buf4 = bytearray(4) - self.fout = usys.stdout.buffer - self.fin = usys.stdin.buffer - self.poller = uselect.poll() - self.poller.register(self.fin, uselect.POLLIN) + self.fout = sys.stdout.buffer + self.fin = sys.stdin.buffer + self.poller = select.poll() + self.poller.register(self.fin, select.POLLIN) def poll_in(self): for _ in self.poller.ipoll(1000): @@ -710,7 +710,7 @@ class RemoteCommand: self.fout.write(self.buf4, 1) def wr_s32(self, i): - ustruct.pack_into('<i', self.buf4, 0, i) + struct.pack_into('<i', self.buf4, 0, i) self.fout.write(self.buf4) def wr_bytes(self, b): @@ -721,7 +721,7 @@ class RemoteCommand: wr_str = wr_bytes -class RemoteFile(uio.IOBase): +class RemoteFile(io.IOBase): def __init__(self, cmd, fd, is_text): self.cmd = cmd self.fd = fd @@ -934,8 +934,8 @@ class RemoteFS: def __mount(): - uos.mount(RemoteFS(RemoteCommand()), '/remote') - uos.chdir('/remote') + os.mount(RemoteFS(RemoteCommand()), '/remote') + os.chdir('/remote') """ # Apply basic compression on hook code. diff --git a/tools/pyboard.py b/tools/pyboard.py index 0ce2d291e..723e43c01 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -509,14 +509,14 @@ class Pyboard: def fs_exists(self, src): try: - self.exec_("import uos\nuos.stat(%s)" % (("'%s'" % src) if src else "")) + self.exec_("import os\nos.stat(%s)" % (("'%s'" % src) if src else "")) return True except PyboardError: return False def fs_ls(self, src): cmd = ( - "import uos\nfor f in uos.ilistdir(%s):\n" + "import os\nfor f in os.ilistdir(%s):\n" " print('{:12} {}{}'.format(f[3]if len(f)>3 else 0,f[0],'/'if f[1]&0x4000 else ''))" % (("'%s'" % src) if src else "") ) @@ -528,7 +528,7 @@ class Pyboard: def repr_consumer(b): buf.extend(b.replace(b"\x04", b"")) - cmd = "import uos\nfor f in uos.ilistdir(%s):\n" " print(repr(f), end=',')" % ( + cmd = "import os\nfor f in os.ilistdir(%s):\n" " print(repr(f), end=',')" % ( ("'%s'" % src) if src else "" ) try: @@ -545,8 +545,8 @@ class Pyboard: def fs_stat(self, src): try: - self.exec_("import uos") - return os.stat_result(self.eval("uos.stat(%s)" % (("'%s'" % src)), parse=True)) + self.exec_("import os") + return os.stat_result(self.eval("os.stat(%s)" % (("'%s'" % src)), parse=True)) except PyboardError as e: raise e.convert(src) @@ -639,13 +639,13 @@ class Pyboard: self.exec_("f.close()") def fs_mkdir(self, dir): - self.exec_("import uos\nuos.mkdir('%s')" % dir) + self.exec_("import os\nos.mkdir('%s')" % dir) def fs_rmdir(self, dir): - self.exec_("import uos\nuos.rmdir('%s')" % dir) + self.exec_("import os\nos.rmdir('%s')" % dir) def fs_rm(self, src): - self.exec_("import uos\nuos.remove('%s')" % src) + self.exec_("import os\nos.remove('%s')" % src) def fs_touch(self, src): self.exec_("f=open('%s','a')\nf.close()" % src) @@ -737,9 +737,9 @@ def filesystem_command(pyb, args, progress_callback=None, verbose=False): _injected_import_hook_code = """\ -import uos, uio +import os, io class _FS: - class File(uio.IOBase): + class File(io.IOBase): def __init__(self): self.off = 0 def ioctl(self, request, arg): @@ -756,10 +756,10 @@ class _FS: raise OSError(-2) # ENOENT def open(self, path, mode): return self.File() -uos.mount(_FS(), '/_') -uos.chdir('/_') +os.mount(_FS(), '/_') +os.chdir('/_') from _injected import * -uos.umount('/_') +os.umount('/_') del _injected_buf, _FS """ |