euromod_linking.env¶
Configure the euromod connector source + DLL path before it is imported.
Opt-in. If EUROMOD_CONNECTOR_SRC points at a newer connector build (one that
ships the Statistics module), that directory is prepended to sys.path so
import euromod resolves to it instead of the installed package. The connector
locates its .NET DLLs (including EM_Statistics.dll) from the EUROMOD_PATH
environment variable — set both in .env; nothing is hard-coded here.
Call configure() before the first import euromod (model_session does
this at import time).
Functions¶
|
Idempotently prepend |
|
Detach the .NET Console from the process's console handle. |
Module Contents¶
- euromod_linking.env.configure() None[source]¶
Idempotently prepend
EUROMOD_CONNECTOR_SRCtosys.pathif valid.
- euromod_linking.env.harden_dotnet_console() None[source]¶
Detach the .NET Console from the process’s console handle.
The EUROMOD engine prints progress and also prints every warning to the Windows console (EM_Common.Communicator.ReportError -> Console.WriteLine). In processes without a valid console handle — services, detached/background launches — that write throws
IOException: The handle is invalidand turns a harmless engine warning into a failed simulation.Redirecting Console.Out/Error to TextWriter.Null removes the fragile channel; nothing is lost: warnings are still delivered through the connector’s structured result (
simulation.errors), which run_simulation surfaces aseuromod_warnings/euromod_errors.Call after
import euromod(CLR loaded); idempotent, best-effort. SetEUROMOD_KEEP_CONSOLE=1to skip (e.g. when watching engine progress interactively).