Skip to content

fix(reader_xlsx): add missing import subprocess (recalc silently disabled) - #38

Open
Anai-Guo wants to merge 1 commit into
ApodexAI:mainfrom
Anai-Guo:fix/reader-xlsx-missing-subprocess-import
Open

fix(reader_xlsx): add missing import subprocess (recalc silently disabled)#38
Anai-Guo wants to merge 1 commit into
ApodexAI:mainfrom
Anai-Guo:fix/reader-xlsx-missing-subprocess-import

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Sep 8, 2026

Copy link
Copy Markdown

Problem

plugins/tools/_reader_xlsx.py calls subprocess.run(...) in _x_recalc_copy (lines 133 and 149), but the module never imports subprocess:

import datetime as _dt
import os
import re
import shutil
import tempfile
import xml.etree.ElementTree as _ET
import zipfile

Because the entire body of _x_recalc_copy is wrapped in try: ... except Exception: return None, the NameError: name 'subprocess' is not defined is swallowed silently rather than crashing.

Impact

_x_recalc_copy first checks if not shutil.which("soffice"): return None, so the subprocess.run calls are only reached when LibreOffice is installed. In exactly that case, the call raises NameError, is caught, and returns None. The caller then does:

new = _x_recalc_copy(path)
if new:
    ... # recalc done
else:
    mark_uncached = True
    head.append("`recalc: soffice unavailable; empty formula caches marked uncached`")

So on any machine where soffice is available, the formula-recalc feature silently reports "soffice unavailable" and never recalculates empty formula caches — the feature is effectively dead.

Fix

Add the missing import subprocess. One line, no behavior change beyond letting the recalc path run as intended.

🤖 Generated with Claude Code

`_x_recalc_copy` calls `subprocess.run` twice but the module never imports
`subprocess`. Because the whole body is wrapped in `except Exception: return
None`, the resulting `NameError` is swallowed silently: whenever LibreOffice
(`soffice`) is actually installed, the recalc path raises, returns None, and the
workbook is marked "soffice unavailable" — so the formula-recalc feature never
works even when it could.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant