Skip to content

[Bug] Connecting to hub using updated Prime Hub and Pybricksdev environment #2496

@johnscary-ev3

Description

@johnscary-ev3

Describe the bug
After upgrading Prime Hub firmware, and Pybricksdev using Poetry and upgrading to Python 3.12, my PC program which uses Pybricksdev to talk to hub will not connect.

Using Visual Code IDE, I have problems with Python code below which used to work but now gives one of two errors shown below. This is not my full program but just the part giving the connection errors.

The hub work fine using the latest Pybricks Beta environment.

Something is different now but I can't figure out new connection method.
Maybe I am using the wrong hub= statement now?

To reproduce
Steps to reproduce the behavior:

from pybricksdev.connections.pybricks import PybricksHub, StatusFlag
from pybricksdev.ble import find_device

async def main():
    print('main: Start')
    hub = PybricksHub()
    device = await find_device()
    print("main: Found device =", device)

    #Old Code using device variable
    await hub.connect(device)

   #New code with no parameter
    await hub.connect()

   Old code gives this error:
   TypeError: PybricksHub.connect() takes 1 positional argument but 2 were given

   New code gives this error:
   AttributeError: 'PybricksHub' object has no attribute '_client_connect'

   The find_device print statement gives:
   main: Found device = 21:38:DB:B0:F2:35: Pybricks Hub
   

Expected behavior
What did you expect to happen instead?
Should Connect.

Screenshots
There is a saying that a picture is worth a 1000 words. Screenshots really help to identify and solve problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    software: pybricksdevIssues related to the pybrickdev Python packagesupportRequest for technical support for a problem that is not a bug or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions