Replies: 1 comment
-
|
Supplemental testing confirms the documented Python behavior that os.add_dll_directory() requires a valid, fully qualified directory path. A minimal PyInstaller executable was created that derives the DLL folder directly from sys.executable and resolves pywin32_system32 as an absolute path. This executable successfully loaded pywintypes312.dll and imported win32api in both local Windows (C:) and Citrix (W:\ mapped drive) environments with identical folder structure. This directly confirms that DLL resolution works in Citrix when a valid absolute path is used, and aligns with observed Python guidance that invalid or improperly constructed paths (e.g., drive-relative W:) result in failure. Therefore, the root cause is that core.exe is constructing an invalid DLL path at runtime rather than using a valid absolute directory derived from its execution context. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
End-user here.
I am attempting to execute core.exe in a restricted Citrix environment and encountering a consistent startup failure.
Environment
• Citrix (restricted enterprise environment)
• Python is not installed (intended use is standalone executable)
• Execution location is a mapped network drive (W:)
• UNC execution and relocation to local disk are blocked by policy
Behavior
• core.exe runs successfully in a standard Windows environment
• The same executable fails when run in Citrix from the mapped drive
Error
OSError: [WinError 87] The parameter is incorrect: 'W:pywin32_system32'
This occurs during the PyInstaller bootstrap phase (inside pyimod04_pywin32.py), before any user command is processed.
Observed Root Cause
Based on testing, the failure appears to be caused by incorrect runtime path resolution inside the packaged executable:
• The executable constructs:
• W:pywin32_system32
• Instead of the expected valid absolute path:
• W:\pywin32_system32
This results in an invalid path being passed to:
os.add_dll_directory()
which triggers the WinError 87 exception.
Key Findings from Testing
• The failure occurs before application logic executes
• Changing:
-PATH
-working directory
-command-line invocation
-DLL placement
has no effect
• The issue is reproducible across all execution methods from the mapped drive
• The same executable works normally when run in a non-mapped (local) environment
Constraints
Due to Citrix policy, I cannot:
• Run the executable from a UNC path (\server\share)
• Move the executable to a local drive
• Install Python or modify the runtime environment
Request
Please confirm whether this behavior is expected in this scenario.
Specifically:
• Is this a known limitation with PyInstaller or the pywin32 runtime hook when running from mapped drives?
• Is the executable incorrectly resolving its base path (using W: instead of an absolute W:...)?
• If so, what change is required during packaging to ensure correct path resolution?
This appears to be a packaging/runtime path resolution issue rather than an environmental misconfiguration, but I would appreciate confirmation and guidance on the correct approach. A Python package without .dll executes successfully in this environment.
thanks
Beta Was this translation helpful? Give feedback.
All reactions