Set shell=False .
Set the output directory to be '-o%s' % directory.
You are prepending a space before the directory on the 7z command line.
Question
I try extract my archive using the subprocess:
subprocess.call(['7z', 'x', '-r', '-y', '-o %s' % os.path.normpath("C:/temp"), archivePath], shell = True)
but I get an error:
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: \172.16.0.30\TestFarm\testdata\testdata.7z
Error: Can not create output directory C:\temp\
System error: The filename, directory name, or volume label syntax is incorrect.
2
How can I do it? Why it happens? If I use command line console it work perfect.
Solution
Set shell=False .
Set the output directory to be '-o%s' % directory.
You are prepending a space before the directory on the 7z command line.