Using Python for manufacturing question
Posted: Wed Mar 20, 2019 7:36 pm
I'm tasked to come up with a manufacturing system for our ESP32 based modules. I'm an old school C programmer and new to Python programming, but figured that Python would be ideal for scripting a build system since the tools are based on Python. My initial manufacturing script is going to start off with erasing the flash and creating an NVS partition file to write to flash along with the factory partition. I've got the NVS defined in a CSV file and now trying to run the NVS partition generation utility, but hit a snag.
I'm trying to run $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py, but it fails to find the file. Since the IDF_PATH doesn't get expanded, I used os.environ['IDF_PATH'] to get the string to prepend to the rest of the file path. Unfortunately it doesn't find the file. At first I thought that because I'm running in MSYS that the "E:" at the beginning was the problem, so I tried manually changing it to... "/e/esp-idf-v3.1.1", but that didn't work either.
Also just trying to run esptool.py --help for simplicity gets the same problem.
Neither....
$ python make_sag2.py
python: can't open file 'E:/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help': [Errno 2] No such file or directory
nor...
$ python make_sag2.py
python: can't open file '/e/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help': [Errno 2] No such file or directory
But this works....
$ python /e/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help
My Python looks like this....
esp_tool = "/components/esptool_py/esptool/esptool.py"
nvs_tool = "/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py"
idf_path = "/e/esp-idf-v3.1.1"
subprocess.call(['python', idf_path + esp_tool + ' ' + '--help'])
Any advice for this Python handicapped coder?
I'm trying to run $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py, but it fails to find the file. Since the IDF_PATH doesn't get expanded, I used os.environ['IDF_PATH'] to get the string to prepend to the rest of the file path. Unfortunately it doesn't find the file. At first I thought that because I'm running in MSYS that the "E:" at the beginning was the problem, so I tried manually changing it to... "/e/esp-idf-v3.1.1", but that didn't work either.
Also just trying to run esptool.py --help for simplicity gets the same problem.
Neither....
$ python make_sag2.py
python: can't open file 'E:/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help': [Errno 2] No such file or directory
nor...
$ python make_sag2.py
python: can't open file '/e/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help': [Errno 2] No such file or directory
But this works....
$ python /e/esp-idf-v3.1.1/components/esptool_py/esptool/esptool.py --help
My Python looks like this....
esp_tool = "/components/esptool_py/esptool/esptool.py"
nvs_tool = "/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py"
idf_path = "/e/esp-idf-v3.1.1"
subprocess.call(['python', idf_path + esp_tool + ' ' + '--help'])
Any advice for this Python handicapped coder?