Как правильно проверить атрибуты доступа файла? То есть доступна ли запись в файл или является ли он исполняемым?
Для этого в 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
On the Morrigan
The Morrigan is the Celtic archetype of Maiden, Mother & Crone. She the goddess of faith and death.
After battle, she would fly over the bodies of the fallen in form of a raven and sing mystic runic songs. Brave soldiers would obtain a protection amulet from her.
As with many female deities like Cybele, Kali or Hathor, we must seek the origin of the Morrigan in remote antiquity, when there was a specific incident which defined the archetype of the beautiful woman with a magical or terrible aspect.
#goddess#celtic
@EuropeanTribalism
Эксперимент с расширением и многоуровневым апскейлом в Стабле из оригинальной пикчи из Далле-3
Считаю, что прошёл неплохо, оригинальная пнг аж 18.5 мегабайта)
By Voodoont
#voodoont
#арт#art#ai#girl#space#goddess#celestial#sun#solarpunk#upscale