# Why is SageMath generating errors during compilation?

Whenever compile the following codes, it generates errors. But I don't know why is such errors occurred.

```
F.<x> = GF(3^15)
def NP(a):
return F(a.digits(3))
import random
b=[0,0]
for r in srange(0,2):
b[r]=random.randint(0,3^15-1)
for i in srange(1,4):
q=NP(b[0])+NP(b[1])
print q
```

Here are the errors:

```
File "file.sage.py", line 16, in <module>
q=NP(b[_sage_const_0 ])+NP(b[_sage_const_1 ])
File "file.sage.py", line 8, in NP
return F(a.digits(_sage_const_3 )) #integer 2 polynomial
AttributeError: 'int' object has no attribute 'digits'
```