fix(reader_xlsx): add missing import subprocess (recalc silently disabled) - #38
Open
Anai-Guo wants to merge 1 commit into
Open
fix(reader_xlsx): add missing import subprocess (recalc silently disabled)#38Anai-Guo wants to merge 1 commit into
import subprocess (recalc silently disabled)#38Anai-Guo wants to merge 1 commit into
Conversation
`_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
plugins/tools/_reader_xlsx.pycallssubprocess.run(...)in_x_recalc_copy(lines 133 and 149), but the module never importssubprocess:Because the entire body of
_x_recalc_copyis wrapped intry: ... except Exception: return None, theNameError: name 'subprocess' is not definedis swallowed silently rather than crashing.Impact
_x_recalc_copyfirst checksif not shutil.which("soffice"): return None, so thesubprocess.runcalls are only reached when LibreOffice is installed. In exactly that case, the call raisesNameError, is caught, and returnsNone. The caller then does:So on any machine where
sofficeis 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