上面是EXE运行时的状况;
下面试代码:
#! /usr/bin/python
-*- coding: utf-8 -*-
import urllib.request,urllib.error
try:
resp=urllib.request.urlopen('http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png')
html=resp.read()
spath="e:/1.png"
f=open(spath,"wb") # Opens file for writing.Creates this file doesn't exist.
f.write(html)
f.close()
#print(html)
except urllib.error.HTTPError as err:
print(err.code )
except urllib.error.URLError as err:
print(err.code )
当我使用cx_freeze打包一些简单的输入输出时完全可以运行