I have a python 3.5 script running under Windows that is calling an external problem (tblastn from the BLAST+ suite to be precise) on a number of files. With most of these files it runs fine but on some it fails with return code 0xC0000005. If I take the exact same command line call and run it from the console in the same current working directory it executes fine.
I am currently running the command with
subprocess.Popen, like this:
childProcess = subprocess.Popen(blast_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True,shell=True)
and then calling
subprocess.poll() until it completes. I am multi-threading this by running four processes simultaneously but it still happens if I force it to run one at a time. The same thing happens with
subprocess.check_call() and it happens whether I set
Which file(s) it fails on is/are the same each time I run the code but the same file will work if put into a different list of files to process. Changing the calling method sometimes changes which files fail so using
os.system can cause different files to fail compared to
subprocess.Popen. Thus it doesn't appear to be down to which file I am invoking tblastn on.
Does anyone have any idea what might be causing this behaviour?
Or if anyone knows what could be different between running in created process (the documentation says it uses
CreateProcess()) as compared to running from the command line then at least I'd have somewhere to start?
the error code is likely to be "Access Denied" (although there are 4 code constructs in the windows header files, the Access Denied is the most likely:
# for hex 0xc0000005 / decimal -1073741819 FILE_LOG_INFORMATION_FAILED iasmsg.h # Information for the %1 log could not be logged to the text # file %2 in the path %3. Error code: %0 STATUS_ACCESS_VIOLATION ntstatus.h # The instruction at 0x%08lx referenced memory at 0x%08lx. # The memory could not be %s. USBD_STATUS_DEV_NOT_RESPONDING usb.h # as an HRESULT: Severity: FAILURE (1), FACILITY_NULL (0x0), Code 0x5 # for hex 0x5 / decimal 5 ERROR_ACCESS_DENIED winerror.h # Access is denied.
I would start by looking at the user priviledges/credentials which are used to run the original (launching/parent) script, which the childprocess/subprocess inherits its credentials from... then compare this to the credentials which are used when you "run this on cmd prompt" as you have described.