My application dll is not loaded correctly when launching the application via Python Script

I used below script to run my application.

import subprocess
subprocess.call('C:\Program Files (x86)\Terrain\Track3D\TRACK™.exe')

      

I can run the application, but several dlls of my application are not loaded. The app launches fine when manually started.

Many errors appear, of which several:

1) Failed to load type for SchedulesController modules. Error: Could not load file or assembly "Schedules.dll" or one of its dependencies. The system cannot find the file specified. System.IO.File Not Found exception.

2) The error window has the title "Microsoft.Practices.Prism.ModuleTypeLoadingException"

Can anyone give me a solution to this problem?

+3


source to share


1 answer


A feature of python in windows is forward slash in paths that need to be escaped, and directory or file names containing spaces must be enclosed in quotes. Also, you have unicode (tm) at the end of the filename.

    import subprocess
    subprocess.call('C:\\"Program Files (x86)"\\Terrain\\Track3D\\r"TRACK™.exe"')

      



Three changes made:

  • Python for Windows requires '\\' not '\' in path names
  • File / directory names with spaces need quotes
  • r "TRACK ™ .exe" instructs python to use the raw string (to represent (tm) correctly)
-1


source







All Articles