osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot find reference 'bluetoothctl' in 'sh.py' less... (Ctrl+F1)


Dear Python Experts,

As am newbie to python, I am planning to automate BT functionality test
using Bluez "bluetoothctl" utility  by writing python wrapper and robot
framework integrated with Jenkins

I came across the below link:
https://www.reddit.com/r/raspberry_pi/comments/4bxu2o/bluetoothctl_in_python_program/

In the above link, I saw the below code snippet
*code:*

*from sh import bluetoothctl*
*mac = "AA:BB:CC:DD:EE"*
*bluetoothctl("connect",mac)*


And firstly I wanted to verify BT functionality with my PC and the
bluetooth device (basically turned on BT option in my phone and trying to
discover my phone as a BT device) And I have installed the below packages
in my ubuntu 18.04 desktop PC
$* pip3 install sh*
Collecting sh
  Downloading
https://files.pythonhosted.org/packages/4a/22/17b22ef5b049f12080f5815c41bf94de3c229217609e469001a8f80c1b3d/sh-1.12.14-py2.py3-none-any.whl
Installing collected packages: sh
Successfully installed sh-1.12.14
*$ pip3 install bluetoothctl*
*Collecting bluetoothctl*
*  Could not find a version that satisfies the requirement bluetoothctl
(from versions: )*
*No matching distribution found for bluetoothctl*
$ *pip3 install pexpect*
Collecting pexpect
  Downloading
https://files.pythonhosted.org/packages/89/e6/b5a1de8b0cc4e07ca1b305a4fcc3f9806025c1b651ea302646341222f88b/pexpect-4.6.0-py2.py3-none-any.whl
(57kB)
    100% |????????????????????????????????| 61kB 1.5MB/s
Collecting ptyprocess>=0.5 (from pexpect)
  Downloading
https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Installing collected packages: ptyprocess, pexpect
Successfully installed pexpect-4.6.0 ptyprocess-0.6.0
$

When I try to paste the below code on pycharm and try to point on the word
"bluetoothctl" in the beginning of the line "*from sh import bluetoothctl*"

*from sh import bluetoothctl*

*mac = "your bluetooth mac"*
*bluetoothctl("connect", mac)*

In the pycharm, I see the below error message :

*Cannot find reference 'bluetoothctl' in 'sh.py' less... (Ctrl+F1) *
*Inspection info: This inspection detects names that should resolve but
don't. Due to dynamic dispatch and duck typing, this is possible in a
limited but useful number of cases. Top-level and class-level items are
supported better than instance items.*

Could you please help me to resolve the above issue, like why am I seeing
the above issue it seems to be some importing "bluetoothhctl" module issue
(sorry if my understanding is wrong)

Kindly do the needful
Many Thanks in advance