Page 1 of 1

esp8266 & esp32

Posted: Thu Jul 16, 2020 9:13 am
by londostick
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'

Re: esp8266 & esp32

Posted: Thu Jul 16, 2020 2:42 pm
by Roberthh
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.