Как правильно проверить атрибуты доступа файла? То есть доступна ли запись в файл или является ли он исполняемым?
Для этого в Python есть функция os.access()
Проверять так:
os.access(path, flag)
Функция вернёт bool в зависимости от наличия указанного флага.
Всего есть 4 флага проверки:
os.F_OK - наличие файла на диске
os.R_OK - доступ на чтение
os.W_OK - доступ на запись
os.X_OK - доступ на исполнение
Например, вместо try-except лучше делать так (пример из документации):
if os.access("myfile", os.R_OK):
with open("myfile") as fp:
return fp.read()
#basic#libs
#SKL/USDT analysis :
#SKL is currently facing rejection at the resistance zone. The price is expected to decline from this point and continue to decrease, testing the support levels. Previous lows are likely to be tested. Wait for pullback for short entry.
TF : 4h
Entry : $0.04237
Target : $0.03509
SL : $0.04648
#SKL/USDT analysis :
#SKL has been rejected from the high time frame (HTF) resistance zone and has broken the support level. This indicates that the price is likely to continue declining further and test the previous swing low.
TF : 15min
Entry : $0.03413
Target : $0.03211
SL : $0.03541