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??

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.