Repository navigation
fix: raise AnalyzerError when an analyzer fails to load - #49
Merged
ddehilster merged 2 commits intoOct 29, 2026
Merged
Conversation
analyze() and compile() returned normally when the analyzer was missing, its KB did not load, or a pass did not build. The engine returned -1 and said why only on its own stderr, which Python cannot capture on Windows, so callers got "" back and had to guess a build failure from every output coming back empty. The binding now throws on a negative return from the engine, and Engine raises NLPPlus.AnalyzerError (an EngineException and an Exception, like AnalysisStopped). It carries the logs/make_ana.log and logs/cgerr.log that the failed call wrote, and its message repeats the lines that are not routine, eg "2 2 [Syntax error.]" for pass 2, line 2. tests/test_load_errors.py also covers two engine fixes in nlp-engine 4.2.52: logs/ is made on Linux and macOS, and a CRLF .kbb loads there. test_logs_are_written and test_crlf_kbb_loads fail on Linux until the submodule is bumped to that release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The package still pins engine 4.2.51, which kept the '\r' of every .kbb line on Linux, so the test failed CI there. It runs again once the submodule bump to 4.2.52 lands. test_logs_are_written already passes on 4.2.51: the docstring no longer says it needs the engine fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
analyze()andcompile()returned normally when the analyzer was missing, its KB did not load, or a pass did not build. The engine returned -1 and said why only on its own stderr, which Python cannot capture on Windows. Callers got""back and had to guess a build failure from every output coming back empty.Change
bindings.cpp:analyzeandcompilethrowRuntimeErrorwhen the engine returns a negative value. Direct users ofNLP_ENGINEno longer get a silent"".Engine.analyze()/Engine.compile()raiseNLPPlus.AnalyzerError. LikeAnalysisStopped, it is both anEngineExceptionand anException..logholds thelogs/make_ana.logandlogs/cgerr.logthat the failed call wrote. Logs left by earlier runs are ignored.Related: VisualText/nlp-engine#815 (4.2.52, merged)
That PR makes a
.kbbwith CRLF line endings load on Linux and macOS.test_crlf_kbb_loadsskips on engines before 4.2.52 and starts running once the submodule bump to 4.2.52 lands. Nothing else here depends on it:logs/make_ana.logis already written on Linux at 4.2.51, soAnalyzerErrorcarries the build errors there today.Testing
Ran the full suite on wheels built with engine 4.2.51 plus nlp-engine#815:
🤖 Generated with Claude Code