meshtastic / python

The Python CLI and API for talking to Meshtastic devices
https://meshtastic.org
364 stars 154 forks source link

TCP connection problem in version 1.2.46 #168

Closed ANS-spb closed 2 years ago

ANS-spb commented 2 years ago

If I'm trying connect to radio via WiFi from python, I'm getting error:

    interface = meshtastic.TCPInterface(hostname='192.168.1.28')
AttributeError: module 'meshtastic' has no attribute 'TCPInterface'

Everything worked on the previous version 1.2.45

I'm used this method: interface = meshtastic.TCPInterface("192.168.1.28")

Method from manual not working too interface = meshtastic.TCPInterface(hostname='192.168.1.28')

Meshtastic-python ver. 1.2.46

mkinney commented 2 years ago

What does the import statements look like?

ANS-spb commented 2 years ago

What does the import statements look like?

import meshtastic
import time
from pubsub import pub

According to the manual from https://meshtastic.org/docs/software/python/python-usage

mkinney commented 2 years ago

Sorry, I broke that accidentally recently when adding pylint and unit testing. I’m not at a computer right now, but will be in a few hours.

For this new version of meshtastic, you’ll have to temp change imports, or your could downgrade to prior version of the library.

I can be more specific on both options after I verify them myself.

mkinney commented 2 years ago

For now, the easiest fix would be to:

pip install meshtastic==1.2.44

ANS-spb commented 2 years ago

Thank you 👍

mkinney commented 2 years ago

I don't like it, but I think we now have to add another import statement and change the call to the TCPInterface class.

This is because the TCPInterface class in prior releases was all in the init.py file. This class has been broken out to the tcp_interface.py file.

mkinney commented 2 years ago

Also updated that doc: see https://github.com/meshtastic/Meshtastic/pull/148