STMicroelectronics / BlueSTSDK_Python

Bluetooth Low Energy Sensors Technology Software Development Kit (Python version for Linux Gateways)
https://www.st.com/en/embedded-software/bluest-sdk.html
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

No module named blue_st_sdk.manager ? #4

Closed g40 closed 5 years ago

g40 commented 5 years ago

I really must be missing something simple. But, following all instructions to the letter ...

TAIA.

$ echo $PYTHONPATH
/home/user/src/BlueSTSDK_Python

$ ls $PYTHONPATH
blue_st_examples  blue_st_sdk  docs  LICENSE  README.md

$ ls $PYTHONPATH/blue_st_sdk
features     manager.py  python_utils.py
feature.py        __init__.py  node.py     utils

~/src/BlueSTSDK_Python/blue_st_examples$ sudo python example_ble_1.py 
Traceback (most recent call last):
  File "example_ble_1.py", line 51, in <module>
    from blue_st_sdk.manager import Manager
ImportError: No module named blue_st_sdk.manager

$ python --version
Python 2.7.13
NeeoKevin commented 5 years ago

I have exactly the same issue. But didn't find any solution until now

g40 commented 5 years ago

One hack is to move the examples so that blue_st_sdk is a sub-directory. i.e. . contains example_bly_X.py

. 
├── blue_st_sdk
│   ├── features
│   │   └── standard_characteristics
│   └── utils
└── docs
    └── source
davidroid commented 5 years ago

Hello g40 and NeeoKevin, Thank you for using the BlueSTSDK.

Please note that you are running the python script as super user (because the Bluetooth requires this), so you need to set the PYTHONPATH variable of the super user. I suggest you to first become super user with the "sudo su" command, set the PYTHONPATH variable, and then run the python script.

Hope this helps. Cheers, Davide

NeeoKevin commented 5 years ago

Hi daviddroid Awesome that was the root cause. Thanks a lot for your support! Cheerio Kev

davidroid commented 5 years ago

You're welcome!

Davide

g40 commented 5 years ago

Thank you Davide, that was indeed the problem.