JCF
JCF

Reputation: 309

Command returned non-zero exit status 9

I am using Windows 10. I wrote the code below to automate the backup of key files. It is part of a python module that is launched as part of an ms-dos batch file.

When the script reaches the code shown in section 3, it returns a cryptic message: Command '['WinRAR.exe', (...)] returned non-zero exit status 9.

Impossible to know more about the root cause and what lies behind this 'exit status 9'.

After checking the subprocess doc for any possible root cause for this "exit status 9", I looked on Stack, and, last resort, I googled it. Nothing I could use to have an idea of what to investigate.

if FileName1 not in Dropbox_archives: print("Compressing "+FileName1) try: subprocess.check_call(["WinRAR.exe", "U", "-ibck", "-r", "-s", "-t", "-inul", "-m5", "-rr3P", "-y", "-pPwd00", "F:\10. Summaries\"+FileName1, "C:\Users\JCF\Dropbox\*.*"])

    except subprocess.CalledProcessError as err:
        print(err)

This code should create a winrar archive with name (FileName1) that contains the date the archive was created.

Due to the try / except wrapper, I get the message in the command prompt windows.

Upvotes: 0

Views: 2391

Answers (2)

pepr
pepr

Reputation: 20762

The error code is returned by WinRAR. It is not directly related to your Python solution (but it can be related indirectly). When searching for the meaning of the code, you can find:

9   File create error.

(Found at https://chmlib.com/WinRAR/html/HELPExitCodes.htm .) Try to run the exact same WindRAR command from the commandline. The reason may be more visible.

Upvotes: 2

JCF
JCF

Reputation: 309

The very same script is now working without a single modification. This "exit status 9" is then probably due to some Windows contextual state, such as number of available processes or memory. Unfortunately, I did not find any documentation about what lies behind this figure '9', nor any hint on how to retrieve the actual message sent back from the command line instead of this exit status.

Upvotes: 0

Related Questions