Hi all… I’m working on the following script
sevenZip_KEY = "SOFTWARE\\7-Zip"
hk_user = _winreg.HKEY_CURRENT_USER
key = _winreg.OpenKey(hk_user, sevenZip_KEY)
sevenZipPath = _winreg.QueryValueEx(key, "Path")[0]
print sevenZipPath
rarFile = "2B01 - p1121485 - TAY YU - Mars Robot Rig.rar"
tempPath = "D:/media/work/ADRG/2012 - 2013 - Semester 2/test/2B01 - p1121485 - TAY YU/CA01 - 12-03-16-50-52 - Mars Robot Rig"
runSevenZip = "\"" + sevenZipPath + "7z.exe\" x -y \"" + tempPath + "/" + rarFile + "\"" + " -o\"" + tempPath + "\""
print runSevenZip
testCMD = "\"" + sevenZipPath + "7zFM.exe\"" # <-- this testCMD works if used like below
# os.system(testCMD)
os.system(runSevenZip)
#os.system(r"%s" %runSevenZip)
basically I want to use 7zip in circumstances where I have to deal with archives other than zip…
First part is to find the path of 7zip…
After that all the various paths and filenames are parsed together into the variable runSevenZip
I then attempt to pass that variable to the system with will throw the following
‘c:\program’ is not recognized as an internal or external program
which I know is something to do with the space. But…
if I paste the output of print runSevenZip directly into a CMD window it works perfect…
or if I use testCMD instead of runSevenZip it’ll accept the space in the path… and launch the GUI of 7zip
any tips or helpful pointers is much appreciated!
cheers
Jamie
and Merry Christmas for the other day… Happy New Year too…