Hello, I've lately been working on a couple of little scripts to bot some websites for me inlcuding this script:

# -*- coding: iso-8859-15 -*-

import urllib
import urllib2
import time
import random
import os.path

opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
currentdir = os.curdir
downloaded = os.path.join(currentdir, "downloaded pages")
while (1):
    page = opener.open('http://de.wikipedia.org/wiki/Spezial:Zuf%C3%A4llige_Seite')
    stuff = page.read()
    name = page.geturl()
    name = urllib.unquote(name)
    name = name+".html"
    result = name.rpartition("/")
    name = result[2]
    name = downloaded+"/"+name
    file = open(unicode(name,"utf-8"), "w")
    rand = random.randint(7,15)
    print "Done with "+unicode(result[2].replace("_"," "),"utf-8")+"."
    print "Restarting in "+str(rand)+" seconds."

Now after running converting it to an exe with py2exe it crashes very quickly after startup and I have no idea why.
This is the setup.py I used:

from distutils.core import setup
import py2exe

options = {"py2exe": {"packages": ["encodings"]}}

Any help?