-1

Hello, I made some code using Pydev, python.

codes worked well and resulted good.

but when I run it on the raspberryPi, errors occurred and it didn't work well. Of course, I couldn't get proper results..

print ser.readline()
AttributeError: 'int' object has no attribute 'readline'

File "gpste.py", line 103, in sav_loc
    line = str(location.address)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)

what's the problem??

and when i insert Ctrl+c, it didn't work. why and how can I stop the program in the middle of process??

2
Contributors
1
Reply
27
Views
2 Years
Discussion Span
Last Post by snippsat
0

Need to see code to,and not just Traceback.
Do print(ser) and print(type(ser)),then i think you see that's ser is an integer and not a fileobject.
To create same Traceback.

>>> ser = 5
>>> ser.readline()
(most recent call last):
  File "<interactive input>", line 1, in <module>
AttributeError: 'int' object has no attribute 'readline'
>>> print(type(ser))
<class 'int'>

UnicodeEncodeError: 'ascii' codec can't

This can be an decode/encode problem,maybe need to include utf-8.
Are you using Python 2 or 3 on raspberryPi?

Edited by snippsat

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.