From: ansonc <an...@al...> - 2015-05-16 06:06:59
|
hi, I'm using python2.7 py2exe-0.6.7 to pack my tftp application which I found the socket not working. And I wrote a testing script of socket to confirm the issue and the result is the socket could not work after pack to exe. The socket script and setup.py is as followed, please see what I missed. Many thanks.#sockexe.pyimport socketif __name__ == '__main__': import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('0.0.0.0', 8001)) sock.listen(5) while True: connection,address = sock.accept() try: connection.settimeout(5) buf = connection.recv(1024) if buf: print buf connection.send(buf) except socket.timeout: print 'time out' connection.close()#setup.pyfrom distutils.core import setupimport py2exesetup( console=[{"script": "exepack.py", "icon_resources": [(1, "v.ico")] }], name='whatever', ) |