1

I'm running an exe application using the subprocess.run():

process = subprocess.run(EXECUTABLE, env=my_env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

The process ends up with returncode=3221225781, which means it can't find some DLL, but both stdout and stderr are empty.

Is there any way to figure out programmatically which dll is missing?

Jaa-c
  • 5,017
  • 4
  • 34
  • 64
  • 1
    Run the `EXECUTABLE` from a terminal, won't it say which dll is missing there? If that fails, use [this](https://learn.microsoft.com/en-us/sysinternals/downloads/listdlls) or have a look at this: https://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency or – Torxed Jan 31 '19 at 12:03
  • @Torxed I run that script on a server and I don't have direct access to it. That's why I'm trying to figure out what path is missing in my environment programmatically... – Jaa-c Jan 31 '19 at 12:08
  • Those tools can be used on a server as well. I'm assuming the external command is out of your "jurisdiction" since it's not really programming-relevant. There for, asking/finding out which dependencies are needed an be done on a test-server or on the server in question. – Torxed Jan 31 '19 at 12:08
  • What would you do with this information in an automated fashion other than log the missing DLL? To that end you could enable loader snaps (via gflags.exe or the edit the registry "Image File Execution Options" for the executable, GlobalFlag value of 2) and run the executable under a debugger, or act as the debugger yourself (i.e. `DEBUG_PROCESS` creation flag and implement a debugging event loop via `WaitForDebugEventEx` and `ContinueDebugEvent`) and log the debug strings from the loader. – Eryk Sun Jan 31 '19 at 13:22
  • @eryksun Logging the missing DLL is all I need. I just need to find out which one is missing so I can fix my PATH... I'll look into the option you described, thanks. – Jaa-c Jan 31 '19 at 13:32

0 Answers0