Как правильно проверить атрибуты доступа файла? То есть доступна ли запись в файл или является ли он исполняемым?
Для этого в 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
In a situation where the market is not in a good condition, #TRXUSDT's trend is still upward.
After reaching the bottom of the channel and the support level of $0.1100-0.1050, the price started to grow and first broke the small dynamic resistance.
According to the general situation of this currency and the registered candles, it can be expected that the price will grow again up to the ceiling of the channel.
Signal for a futures trade
#TRXUSDT.P
📌 Logged into SHORT
Entry: ±$0.08521
Take profit: $0.084; $0.082; $0.0805
Stop loss: $0.0867
The price broke through the trend support and left the bottom. Also against the downside is a “flat-bottomed triangle” formation. I expect the decline to continue.