call of non-function (type string) error
Andrew Kuchling
akuchlin at mems-exchange.org
Wed Apr 11 12:37:02 EDT 2001
Graham Guttocks <graham_guttocks at yahoo.co.nz> writes:
> >>> CIPHER = "DES3"
> >>> import Crypto.Cipher
> >>> cipher = getattr(Crypto.Cipher, CIPHER)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: DES3
I don't think the Cipher package automatically imports all
subpackages, and this is a case where you really do need to use exec.
Obviously the Cipher package should provide a function to retrieve the
module for a given name...
--amk
More information about the Python-list
mailing list