TypeError: 'sage.rings.integer.Integer' object is not iterable

asked 2020-01-01 16:01:06 -0500

ZooX gravatar image

This is my code:

for i in range(0,10):
lp = 0
lnp = 0
for j in range(0,100):
    N,p,q,d = gen_par(up,down)
    priv, h = keygeneration(N,p,q,d)
    m = randompolyBinary(d)
    e = enc(m, h, d)
    a = dec(e, priv)
    if(m == a):
        lp+=1
    else:
        lnp+=1

When i try to compile it, i have this problem:

    *** WARNING: Code contains non-ascii characters    ***
    Traceback (most recent call last):
    File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1191, in execute
flags=compile_flags), namespace, locals)
        File "", line 5, in <module>
TypeError: 'sage.rings.integer.Integer' object is not iterable

Can someone help me?

edit retag flag offensive close merge delete

Comments

What do you mean by "When I try to compile it" Do you mean when you run it? I can't reproduce the problem because your code sample has several presumably custom-written functions. What does the full traceback show? This "WARNING: Code contains non-ascii characters" is also mysterious. The code you showed us does not obviously contain any non-ascii characters. In short, without at least knowing what gen_par, up, down, keygeneration, randompolyBinaryenc, dec, are there's no way to tell you what the problem is. But apparently you are trying to iterate over an integer somewhere.

Iguananaut gravatar imageIguananaut ( 2020-01-07 09:25:53 -0500 )edit