open() with r, w, a, plus b | Yes | |
open() with x or + | No | |
f.read(), f.readline(), f.readlines(), f.seek(), f.tell() | Yes | The whole file is read at once. |
f.write() | Yes | Each call is written at once. |
for line in f, f.truncate(), f.fileno() | No | |
Path.open, read_text, read_bytes, write_text, write_bytes | Yes | |
os.stat, Path.stat, exists, is_file, is_dir, is_symlink | Yes | In TypeScript, use the named fields (st.st_size), not st[6]. |
os.lstat, os.fstat | No | |
os.listdir, Path.iterdir | Yes | |
os.scandir, os.walk, Path.glob, Path.rglob | No | |
os.mkdir, os.makedirs, Path.mkdir | Yes | |
os.rmdir, Path.rmdir, os.remove, os.unlink, Path.unlink | Yes | |
os.rename, os.replace, Path.rename | Yes | Raises OSError across mounts. |
os.getcwd, Path.cwd, Path.resolve | Yes | The shell’s working directory. |
os.chdir | Python SDK | Lasts for the run. Raises RuntimeError in TypeScript. |
os.environ, os.getenv | Yes | The session’s environment, never the host’s. |
argv, stdin globals | Yes | The words after the script, and the piped input. |
sys.argv, sys.stdin | No | Use argv and stdin. |
os.urandom | Yes | Up to 1 MiB per call. |
os.path | No | |
os.open and file descriptors, os.truncate | No | |
os.symlink, os.readlink, os.link | No | |
os.utime, os.chmod, Path.touch, os.getxattr | No | |
json.load, json.dump | No | Use json.loads(f.read()) and f.write(json.dumps(value)). |
glob, shutil, subprocess, socket | No | Importing one fails. |