unsupported operand type(s) for pow(): 'unicode', 'long', 'long': Pycrypto

Kayode Odeyemi dreyemi at gmail.com
Fri Oct 7 14:54:31 EDT 2011


On Fri, Oct 7, 2011 at 7:23 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:

> On Fri, Oct 7, 2011 at 11:16 AM, Kayode Odeyemi <dreyemi at gmail.com> wrote:
> > Hello everyone,
> >
> > I'm writing a fairly large app which uses Oauth (python-oauth2). I am
> trying
> > to generate a
> > public/private key pair on user supplied parameters
> (whitespaced-delimited
> > strings basically).
> >
> > When trying to encrypt the key, I'm getting the "unsupported operand
> type(s)
> > for pow(): 'unicode', 'long', 'long'"
> >
> > From Interactive shell, the program worked successfully.
> >
> > My question is do I have to make the user supplied data of a non-unicode
> > string to make this work?
>
> Please include the traceback and the snippet of code where you make
> the call that is failing.  Without that, it is not at all clear
> exactly what you are doing, especially since python-oauth2 does not
> seem to provide any encryption API.
>

Thanks for writing in.

I had this:

encrypted = public_key.encrypt(params, 16)

I was able to fix it with:

encrypted = public_key.encrypt(str(params), 16)

pow() needs params in non-unicode.

I understand python-oauth2 does not have encryption API built-in. I'm
creating one
before using it.


-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111007/3e70c7fa/attachment-0001.html>


More information about the Python-list mailing list