How to run Bolt IoT python library on Windows (without digital ocean or ubuntu)?

Step 1 - Download and Install Python3 from https://www.python.org/ftp/python/3.9.5/python-3.9.5-amd64.exe

Step 2 - Open CMD from Windows search and type python3

C:\Users\Aksha> python3

It will run and you will be verified that it is properly installed.

Exit the program by typing exit()

C:\Users\Aksha>python3
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

exit()

Step 3 - To install the boltiot package, Type
pip3 install boltiot
This will download the package.

Step 4 - As I asked you Type the below code in a notepad and save it as blablabla.py

from boltiot import Bolt
api_key = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
device_id = “BOLTXXXXX”
mybolt = Bolt(api_key, device_id)
response = mybolt.digitalWrite(‘0’, ‘HIGH’)
print (response)

Step 5 - Copy the blablabla.py file in the C:\Users\Aksha directory. In your case, instead of Aksha, your folder(computer username) will be different. It is present in C drive, then Users, …
Once you have copied, close the window.

(Incase you have multiple files, which might need to call/import other files, you can make a folder, and open it in the terminal using cd foldername, you can run the program from there. Else it will show directory not found )

Step 6 - Open CMD. And type

> python3 blablabla.py

Make sure to mention .py to run the program.

1 Like