"""Explicit frozen module paths; repairs launch only, never scientific source.""" import os from pathlib import Path import sys ROOT = Path('/data/digital-drosophila') MODEL = ROOT/'models/male-cns-lif/terminal-scope-diagnostic-v1' EXP = ROOT/'experiments/phase4ab-terminal-scope' PARENT = ROOT/'models/male-cns-lif' names = ['deterministic-runtime-v2', 'credit-v3', 'timing-audit-v1', 'timing-credit-v1', 'timing-stability-v1', 'odor-timing-generalization-v1', 'csus-audit-v1', 'late-kc-audit-v1', 'dpm-hypothesis-v1', 'pn-feedback-audit-v1', 'transmitter-audit-v1'] sys.path[:0] = [str(MODEL), str(PARENT)] + [str(PARENT/n) for n in names] os.environ['PYTHONDONTWRITEBYTECODE'] = '1' import diagnostic _, _, _, _, save, digest, _, _ = diagnostic.load_context() save(EXP/'protocol/launch-addendum.json', { 'previous_attempt': 'ModuleNotFoundError: phase4v before run-start and before simulation', 'only_fix': 'Add explicit existing frozen dependency directories to module lookup', 'model_source_edited': False, 'protocol_parameters_changed': False, 'launcher_sha256': digest(Path(__file__)), 'module_paths': [str(PARENT/n) for n in names]}) try: diagnostic.run() finally: loaded = {} for name, mod in list(sys.modules.items()): filename = getattr(mod, '__file__', None) if filename: p = Path(filename) if p.is_file() and p.is_relative_to(PARENT) and '.venv' not in p.parts: loaded[name] = {'path': str(p.relative_to(ROOT)), 'sha256': digest(p)} save(EXP/'protocol/imported-code-hashes.json', loaded)