"incorect command line error" when compressing file via subprocess

  7zip, python, windows

I need to compress a batch of files via subprocess and 7z.exe. Their names start with "-".
It seems that 7z cannot accept that. There is no problem with other files starting with "+".

Is there a workaround?

thank you!

import os
import subprocess


subprocess.call(['7z.exe', 'a', '-01+005_compressed.txt', '-01+005_orig.txt', '-mx9'], shell=True)

Error:

Incorrect command line

Source: Windows Questions

LEAVE A COMMENT