title: How can I call WinRar in Python on Windows? STILL Problematic
body: <p>Using the zipfile module I have created a script to extract my archived files, but the method is corrupting everything other than txt files. </p>
  
  <pre><code>def unzip(zip):
           filelist = []
           dumpfold = r'M:\SVN_EReportingZones\eReportingZones\data\input\26012012'
           storage = r'M:\SVN_EReportingZones\eReportingZones\data\input\26012012__download_dump'
           file = storage + '\\' + zip
           unpack = dumpfold + '\\' + str(zip)
           print file
  
           try:
  
                       time.sleep(1)
                       country = str(zip[:2])
                       countrydir =  dumpfold + '\\' + country
                       folderthere = 0
                       if exists(countrydir):
                          folderthere = 1           
  
                       if folderthere == 0:
                         os.makedirs(countrydir)
  
                       zfile = zipfile.ZipFile(file, 'r')
  ##                     print zf.namelist()
                       time.sleep(1)
                       shapepresent = 0
  </code></pre>
  
  <p>Here I have a problem - by reading and writing the zipped data, the zipfile command seems to be rendering it unusable by the programs in question - I am trying to unzip shapefiles for use in ArcGIS...</p>
  
  <pre><code>                     for info in zfile.infolist():
                           fname = info.filename
                           data = zfile.read(fname)
                           zfilename = countrydir + '\\' + fname
                           fout = open(zfilename, 'w')# reads and copies the data
                           fout.write(data)
                           fout.close()
                           print 'New file created ----&gt; %s' % zfilename
  
  
  
  
  
           except:
                          traceback.print_exc()
                          time.sleep(5)
  </code></pre>
  
  <p>Would it be possible to call WinRar using a system command and get it to do my unpacking for me? Cheers, Alex</p>
  
  <p>EDIT</p>
  
  <p>Having used the wb method, it works for most of my files but some are still being corrupted. When I used winRar to manually unzip the problematic files they load properly, and they also show a larger ile size.</p>
  
  <p>Please could somebody point me in the direction of loading winRar for the complete unzip process? </p>