Bypass exception to always execute command?
<p>The following code works almost perfect, thanks to the help received <a href="http://stackoverflow.com/questions/7016252/python-basic-question-how-do-i-download-multiple-urls-with-urllib-request-urlr">here</a>:</p>

<pre><code>import urllib.request
import zipfile
import subprocess

urls = ["http://url.com/archive1.zip", "http://url.com/archive2.zip", "http://url.com/archive3.zip"]
filename = "C:/test/test.zip"
destinationPath = "C:/test"

for url in urls:
    try:
        urllib.request.urlretrieve(url,filename)
        sourceZip = zipfile.ZipFile(filename, 'r')
        break
    except ValueError:
        pass

for name in sourceZip.namelist():
    sourceZip.extract(name, destinationPath)
sourceZip.close()

subprocess.call(r'C:\WINDOWS\system32\cmd.exe /C "C:\test\test.exe"')
</code></pre>

<p>Except that when none of the url's successfully download, the final subprocess.call command never gets executed and I get the following error:</p>

<pre><code>Traceback (most recent call last):
  File "test.py", line 29, in &lt;module&gt;
    for name in sourceZip.namelist():
NameError: name 'sourceZip' is not defined
</code></pre>

<p>I have been playing around a bit with the try: and except, but can not come to a working solution. I believe it is because the try: except command has to be inside the sourceZip loop, but since the sourceZip variable never gets declared, it fails. How would I alter this code to have the subprocess.call always get executed at the end regardless whether the download is successfull or not? (very new to Python)</p>
