osdir.com


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

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


srinivasan <srinivasan.rns at gmail.com> writes:
> 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
> ...
> *$ pip3 install bluetoothctl*
> *Collecting bluetoothctl*
> *  Could not find a version that satisfies the requirement bluetoothctl
> (from versions: )*
> *No matching distribution found for bluetoothctl*

"pip[*]" is a tool to install Python packages -- typically from
the Python package index (-->"https://pypi.org";).
The error message above indicates that "bluetoothctl" is not
managed by this package index.

I assume that it is not a Python package at all (but rather some
command line utility in some operating system package). At least
on my Ubuntu 18.04, "bluetoothctl" is an operating system utility.

*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)

I do not know the "sh" package. It might be a utility
that turns a command line utility into a Python callable --
implicitely on "import" of the corresponding name.

If this is the case, it may confuse "PyCharm" (which does not
expect such dynamism). You could then safely ignore this confusion.

Try to execute your code. Should you get an exception
(e.g. an `ImportError: cannot import "bluetoothctl" from module "sh"`),
then come back.