[Tutor] cant get a program run as installer .exe

Brett brett42@flex.com
Thu, 22 Feb 2001 20:41:27 -1000


I'm using python 2.0 on windows98.  I made a small program that uses 
urllibto get html source from a web page and save it locally.  It worked as 
a python file.  Then I  used installer(standalone.py)  to make it into an 
.exe, but when I try to run the executable it crashes at the part when it 
should call 'urllib.urlopen' it gives a traceback with 
'attributeerror:compile'.   Installer successfully made an executable for a 
simple x=input(), print x program, so its not totally screwed.  Does 
installer usually work with urllib? anyone have any idea why it 
crashes?  Here's the code:

import urllib
print 'if this works it should use urllib to get the source for a web 
page.  it should also copy the web page to source.htm'
theurl=raw_input('enter url(needs http:// and filename) or type <1> for an 
example \n')
if theurl=='1':
     theurl='http://bigempire.com/filthy/index.html'
www=urllib.urlopen(theurl) #here's where it crashes
source=www.read()
txt=open('source.htm','w')
txt.write(source)
txt.close()
stuff=input('done')

When Schrodinger's cat's away,
the mice may or may not play,
no one can tell.