Problem in python library setup


and comes error when i run the program for checking the online status of my bolt module

Follow these steps:

  1. sudo apt-get -y update
  2. sudo apt install python3-pip
  3. sudo pip3 install boltiot
    now for open the text editor on Linux system and write the code for checking the status
  4. sudo nano device_status.py

This is how the code for checking the status will look like===

from boltiot import Bolt
api_key = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
device_id = “BOLTXXXXXX”
mybolt = Bolt(api_key, device_id)
response = mybolt.isOnline()
print (response)

  1. sudo python3 device_status.py

Make sure that the program you are running is present in the same directory, if not then the program may not work!
To check your current location of directory you can paste the below command on the Linux system :

pwd

hope this helps!

Hi @divish.karthikeyan

In python, you can not name a file same as the inbuilt function/packages name. For example. email is an inbuilt package of python and I think you have created a file with name random.py also in your current directory.

To show the list of file in your current directory. Type listing command as below.

ls

Then remove the random.py file from your directory.

sudo rm random.py

Now run your program again and also send the screenshot of ls command.

Do let me know in case you need any other information.