Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion praxis/web-client/src/app/core/workers/python.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ async function initializePyodide(id?: string) {
{ file: 'web_serial_shim.py', name: 'WebSerial' },
{ file: 'web_usb_shim.py', name: 'WebUSB' },
{ file: 'web_ftdi_shim.py', name: 'WebFTDI' },
{ file: 'web_hid_shim.py', name: 'WebHID' }
{ file: 'web_hid_shim.py', name: 'WebHID' },
{ file: 'pyodide_io_patch.py', name: 'PyodideIOPatch' }
];

for (const shim of shims) {
Expand All @@ -303,6 +304,19 @@ async function initializePyodide(id?: string) {
}
}

// Execute IO Patching (must happen before other code uses PLR)
try {
await pyodide.runPythonAsync(`
try:
import pyodide_io_patch
print("Pyodide IO Patch imported successfully")
except Exception as e:
print(f"Failed to import Pyodide IO Patch: {e}")
`);
} catch (err) {
console.error('Error running IO patch:', err);
}

// Verify files exist
try {
const files = pyodide.FS.readdir('.');
Expand Down
3 changes: 0 additions & 3 deletions praxis/web-client/src/assets/shims/web_serial_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,6 @@ async def write(self, data: bytes) -> int:
except Exception as e:
raise RuntimeError(f"Write failed: {e}")

async def read(self, num_bytes: int = 1) -> bytes:
"""Read data from the serial port."""

async def read(self, num_bytes: int = 1) -> bytes:
"""Read data from the serial port."""
# Bypass check for FTDI
Expand Down