[Twisted-Python] Freezing twisted successfully?

Ralf Schmitt ralf at brainbot.com
Thu Feb 16 02:53:39 EST 2006

Gabe Rudy wrote:
> On Wednesday 15 February 2006 4:14 pm, Gabe Rudy wrote:
>> Anybody have any luck using cx_Freeze or PyInstaller to freeze a program
>> with a threaded reactor?
> I checked into it a bit more and I'm not sure threads has anything to do with 
> it.
> sshsimpleclient.py found at
> http://twistedmatrix.com/projects/conch/documentation/examples/
> also seems to have problems when frozen. Specifically defer.succeed(1) from 
> verfiyHostKey does not seem  to work as the log shows
> 2006/02/15 16:54 MST [SimpleTransport,client] Disconnecting with error, code 9
>         reason: bad host key

running python -v sshsimpleclient.py results in the following output:
2006/02/16 08:49 CET [SimpleTransport,client] kex alg, key alg: 
diffie-hellman-group-exchange-sha1 ssh-rsa
2006/02/16 08:49 CET [SimpleTransport,client] client->server: aes256-ctr 
hmac-sha1 none
2006/02/16 08:49 CET [SimpleTransport,client] server->client: aes256-ctr 
hmac-sha1 none
2006/02/16 08:49 CET [SimpleTransport,client] host key fingerprint: 
2006/02/16 08:49 CET [SimpleTransport,client] 
dlopen("/usr/lib/python2.4/site-packages/Crypto/Cipher/AES.so", 2);
2006/02/16 08:49 CET [SimpleTransport,client] import Crypto.Cipher.AES # 
dynamically loaded from 
2006/02/16 08:49 CET [SimpleTransport,client] starting service ssh-userauth
2006/02/16 08:49 CET [SSHService ssh-userauth on SimpleTransport,client] 
can continue with: ['publickey', 'password']

Adding a dummy function for dependency tracking solved the problem for me:

def __dependencies_for_freezing():
     import Crypto.Cipher.AES

I guess that you may have to add even more ciphers depending on
your ssh config.

- Ralf

More information about the Twisted-Python mailing list