getting error on Bluetooth LE Console steps

Hi Support Team,

Have a nice day.

Board: NRF5340DK


Python version: 3

nRF Connect SDK version 2.6.99

We are selecting the NRF5340DK for development purposes and are developing a peripheral testing command on the Zephyr shell. Currently, we can test through the UART Zephyr shell.

We want to perform the same tests through BLE. I found an NRF note about the Bluetooth LE Console here.

As per the provided link, we are trying to compile the code from the repository, but we are encountering errors with Python 3. Could you provide the steps to compile this code in the latest Python environment?

Thank you.

Parents
  • It would be helpful to know which Linux distribution you try to use in what version, and what error messages you got.

  • 1.

    Linux version:

    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.4 LTS
    Release: 22.04
    2 . Resolved Error when we executed with $ python3 BluetoothConsole.py and now we are getting BLE console

      $ python3 BluetoothConsole.py
      Traceback (most recent call last):
      File "/home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py", line 19, in <module>
      from BlueZ_communication import BluetoothConnection
      File "/home/soho/.local/share/Trash/files/ble_console/BlueZ_communication.py", line 184 
      print e.args
      ^^^^^^^^^^^^
      SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
     

      $ python3 BluetoothConsole.py
      Traceback (most recent call last):
      File "/home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py", line 19, in <module>
      from BlueZ_communication import BluetoothConnection 
      File "/home/soho/.local/share/Trash/files/ble_console/BlueZ_communication.py", line 50
      bashCommand = 'bluetoothd -v'
      TabError: inconsistent use of tabs and spaces in indentation

    But when we executed the below steps, the BLE device did not show our BT_NUT_shell hostname. before executing it is seen

    nano /etc/systemd/system/bluetooth.service

    ExecStart=/usr/lib/bluetooth/bluetoothd -E

    sudo service bluetooth restart

  • Script is br0ken since at least NCS v2.2.0 - and nobody noticed that yet. I don't have older versions on my disk here to check.

  • $ python3 BluetoothConsole.py
    /home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py:68: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: wiki.gnome.org/.../InitializerDeprecations
    filem = Gtk.MenuItem("File")
    /home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py:71: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: wiki.gnome.org/.../InitializerDeprecations
    exit = Gtk.MenuItem("Exit")
    /home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py:76: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: wiki.gnome.org/.../InitializerDeprecations
    connect_item = Gtk.MenuItem("Select device")
    /home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py:140: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: wiki.gnome.org/.../InitializerDeprecations
    dev_menu_item = Gtk.CheckMenuItem(self.get_device_name(dev) + ' (' + dev + ')')
    Traceback (most recent call last):
    File "/home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py", line 165, in connect_disconnect
    self.connect(self.address_from_menu_label(widget.get_label()))
    File "/home/soho/.local/share/Trash/files/ble_console/BluetoothConsole.py", line 176, in connect
    self.add_terminal(device, self.get_device_name(device))
    File "/home/soho/.local/share/Trash/files/ble_console/TerminalNotebook.py", line 161, in add_terminal
    self.send_data_to_device(device, '\n')
    File "/home/soho/.local/share/Trash/files/ble_console/BlueZ_communication.py", line 176, in write_bluetooth
    message.extend(text)
    TypeError: 'str' object cannot be interpreted as an integer

    i able to connect BLe shell but i getting above error if you have any idea on this error

  • Hi,

    The Bluetooth LE Console is outdated and requiers python 2. It should be python 3 compatible if you fix the print staement in BlueZ_communication.py line 176, though (add parenthesises as print is a function call in python 3). There may be other issues with recent distroes also, though.

    May I ask for wha tyou intend to use it? Perhaps there are other alternative approaches that would be better?

Reply Children
No Data
Related