esp8266 & esp32

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
londostick
Posts: 1
Joined: Thu Jul 16, 2020 8:07 am

esp8266 & esp32

Post by londostick » Thu Jul 16, 2020 9:13 am

how can i check if path exist in micropython:
if not os.path.exists(b):
os.mkdir(b)
if not os.path.exists(vers):
os.mkdir(vers)
doesn't work i got this error: :?:
AttributeError: 'module' object has no attribute 'path'

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: esp8266 & esp32

Post by Roberthh » Thu Jul 16, 2020 2:42 pm

You can use os.stat() in a tray(except clause to check, if the file exists. or you can just try to create the directory in a try/execpt clause.

Post Reply