ampledata / aprs

Python APRS Module
https://github.com/ampledata/aprs
Other
95 stars 53 forks source link

AttributeError: module 'aprs' has no attribute 'parse_frame' #26

Open demarcq opened 6 years ago

demarcq commented 6 years ago

Hello, I am trying to setup aprs module on a Raspberry pi but I have this error
AttributeError: module 'aprs' has no attribute 'parse_frame' with this code => frame = aprs.parse_frame('xxxx') Python 3.6.4

pip3.6 show aprs

Name: aprs Version: 7.0.0 Summary: Python APRS Module. Home-page: https://github.com/ampledata/aprs Author: Greg Albrecht Author-email: oss@undef.net License: Copyright 2017 Greg Albrecht and Contributors Location: /usr/local/lib/python3.6/site-packages Requires: kiss, requests, bitarray

Python3.6

import aprs Traceback (most recent call last): File "", line 1, in File "/home/pi/aprs.py", line 2, in frame = aprs.parse_frame('FG4KL-3>APRS:>Hello World!') AttributeError: module 'aprs' has no attribute 'parse_frame' print(aprs.version) Traceback (most recent call last): File "", line 1, in NameError: name 'aprs' is not defined

Many thanks for you help !

demarcq commented 6 years ago

I have the same problem from my Mac

iMac:~ bertrand$ pip3.6 --version pip 9.0.3 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6) iMac:~ bertrand$ pip3.6 install aprs Requirement already satisfied: aprs in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages Requirement already satisfied: requests>=2.7.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from aprs) Requirement already satisfied: kiss>6.9 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from aprs) Requirement already satisfied: bitarray>=0.8.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from aprs) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.7.0->aprs) Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.7.0->aprs) Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.7.0->aprs) Requirement already satisfied: idna<2.7,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests>=2.7.0->aprs) Requirement already satisfied: pyserial>=3.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from kiss>6.9->aprs) iMac:~ bertrand$ python3.6 aprs.py Traceback (most recent call last): File "aprs.py", line 1, in import aprs File "/Users/bertrand/aprs.py", line 2, in frame = aprs.parse_frame('FG4KL-3>APRS:>Hello World!') AttributeError: module 'aprs' has no attribute 'parse_frame'

tmx-dxiao commented 5 years ago

I ran into the same error when executing a.send(frame)

>>> a.send(frame)
2019-04-26 16:27:58,498 aprs INFO aprs.classes.send:340 - Sending frame="BG4CHU>APRS:>Hello World!"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/aprs/classes.py", line 343, in send
    _frame = bytes(frame + b'\n\r')
TypeError: unsupported operand type(s) for +: 'Frame' and 'bytes'

Any idea?

ghost commented 5 years ago

This may or may not help but I had a similar issue: Traceback (most recent call last): File "/Users/gk1016/PycharmProjects/aprs/util.py", line 11, in a = aprs.TCP('W6CRJ', '12345') File "/Users/gk1016/PycharmProjects/aprs/venv/lib/python3.7/site-packages/aprs/classes.py", line 272, in init aprs_filter = aprs_filter or b'/'.join([b'p', user]) # Unicode TypeError: sequence item 1: expected a bytes-like object, str found

It was due to the int vs byte coding. To fix it, I set two variables: payload_callsign = 'W6CRJ'.encode('utf-8') payload_passcode = '12345'.encode('utf-8')

Then inserted as follows:

a = aprs.TCP(payload_callsign, payload_passcode)

a.start() a.receive(callback=p)

As was well in the kingdom. You could also go into the source and change things around...

I apologize if this isn't the place for it, but searches specific to aprs and this issue kept kicking me to here.