only create directory for stocks when necessary

This avoids printing an inacurate error every time.
This commit is contained in:
Hong Jiang 2023-09-10 12:53:40 +08:00
parent 109e058f07
commit b18d25eaa4

View File

@ -82,7 +82,8 @@ class Stocks(inkycal_module):
tmpPath = '/tmp/inkycal_stocks/'
try:
os.mkdir(tmpPath)
if not os.path.exists(tmpPath):
os.mkdir(tmpPath)
except OSError:
print(f"Creation of tmp directory {tmpPath} failed")
else: