Read-Sensor-Resistances/ESP32Driver.py

16 lines
1.1 KiB
Python
Raw Normal View History

2022-08-16 20:51:21 +00:00
# This is a sample Python script.
2022-08-17 18:25:44 +00:00
import os, requests # TODO: we don't have 'requests' package build-in, and it kind of not works in conda environment, should we just use urllib.request instead?
2022-08-16 20:51:21 +00:00
from zipfile import ZipFile
URL = "https://www.silabs.com/documents/public/software/CP210x_Universal_Windows_Driver.zip"
response = requests.get(URL)
open('ESP32driver', 'wb').write(response.content)
# need to change user destination figure out how to get it to downloads
# 11/5/22 --> Saving to downloads folder. No change made. Possible make a change in the inf file: https://learn.microsoft.com/en-us/windows-hardware/drivers/install/specifying-the-source-and-target-locations-for-device-files
2022-08-16 20:51:21 +00:00
with ZipFile('ESP32driver', 'r') as zipObj:
2022-08-17 18:20:41 +00:00
zipObj.extractall(os.path.join(os.path.expanduser("~"), "Downloads", "ESP32driver"))
# TODO: after extract the file, run the .inf file in it to actually install the driver
# 11/5/22 --> Created bash script with same name to run files and control destination folder. MUST RUN AS AN ADMINISTRATOR
2023-02-01 09:54:27 +00:00
# TODO: integrate the bash script into the python script so ppl don't have to run/have seperate files in their device