Skip to content
Open
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
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/formula_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
import re
import json

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass

# OOXML SpreadsheetML namespace
NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NSP = f"{{{NS}}}"
Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/libreoffice_recalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
import tempfile
import argparse

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


# ── LibreOffice discovery ───────────────────────────────────────────────────

Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/shared_strings_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
import html
import argparse

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
SST_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/style_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
import tempfile
import shutil

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass

NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NSP = f"{{{NS}}}"

Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_add_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
import xml.dom.minidom
import xml.etree.ElementTree as ET

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass

NS_SS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"

Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_insert_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
import xml.dom.minidom
import xml.etree.ElementTree as ET

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass

NS_SS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"

Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
import zipfile
import xml.etree.ElementTree as ET

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


def validate_xml_files(source_dir: str) -> list[str]:
"""Return list of XML files that fail to parse."""
Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
import argparse
from pathlib import Path

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


# ---------------------------------------------------------------------------
# Format detection and loading
Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_shift_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
import xml.etree.ElementTree as ET
import xml.dom.minidom

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


def col_letter(n: int) -> str:
"""Convert 1-based column number to Excel column letter(s)."""
Expand Down
8 changes: 8 additions & 0 deletions skills/minimax-xlsx/scripts/xlsx_unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
import shutil
import xml.dom.minidom

# Windows pipes default to a legacy codepage (e.g. cp1252) that cannot encode
# the ✓/→ characters these tools print - degrade to "?" instead of crashing.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(errors="replace")
except (AttributeError, ValueError):
pass


def pretty_print_xml(content: bytes) -> str:
"""Pretty-print XML bytes. Returns original content on parse failure."""
Expand Down