[Twisted-Python] twistd and passphrase

Manlio Perillo manlio_perillo at libero.it
Thu Sep 7 18:07:31 EDT 2006

Lorenzo Allegrucci ha scritto:
> [...]
> To start my daemon I use 'twistd -y myserver.py' and everything works
> fine except for the fact that I have to "hardwire" the passphrase in
> 'getPassphraseCB'.
> Of course this in not what I want and I would like to rewrite
> getPassphraseCB as:
>    def getPassphraseCB(self, repeat=False, *data):
>         return self.passphrase
> where self.passphrase should be set (somehow) _before_ twistd makes my
> application a daemon, but I couldn't find a way to do it yet.

Just use twisted.python.util.getPassword(forceTTY=True).
However (I ignore why) in this way no prompt is written on the screen.

Note that getPassword does not return a deferred, so you should not call
it when the reactor is running (not sure about this).

Regards  Manlio Perillo

More information about the Twisted-Python mailing list