Commit dfdcfc1
Fix Excel attach: bind via GetActiveObject, not xlwings hwnd-walk
The server timed out on every Excel-touching call once the ModelChoice
add-in was loaded into Excel. Root cause: xlwings binds to Excel by walking
window handles (AccessibleObjectFromWindow -> .Application), and that path
fails with OLE 0x800A01A8 — and can hang the call outright — when the
Excel-DNA add-in is present. The ROT-based GetActiveObject('Excel.Application')
dispatch is reliable.
_book now injects that dispatch into app.impl._xl before any worksheet
access (per call, so an Excel restart can't strand a handle). Verified live
end to end against a loaded add-in: write_tree, render, list_trees, roll_up,
run_evpi, run_evii, and verify_rollback all work (root EV 1460 from the
add-in's MC_V_ cells matched the Python rollback exactly).
No-ops off Windows / if win32com is unavailable, so the fake-bridge tests
are unaffected. 50 tests pass; ruff + mypy clean. Version 0.0.13.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 670fea6 commit dfdcfc1
4 files changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
61 | 81 | | |
62 | 82 | | |
63 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments