TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #198 · 6 јан.

Первая директория в sys.path 🔸 Когда вы запускаете Python-интерпретатор в интерактивном режиме, в системные пути (sys.path) в самое начало добавляется текущая рабочая директория >>> for path in sys.path: ... print(f'"{path}"') "" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... Первая строка пустая, что и означает текущую рабочую директорию. 🔸 Если вы запускаете интерпретатор передавая скрипт как аргумент, то история получается иная. На первом месте будет директория в которой располагается скрипт. А текущая рабочая директория игнорируется. Пишем скрипт с таким содержанием: # script.py import sys for path in sys.path: print(f'"{path}"') Запускаем python3 /home/user/dev/script.py Получаем "/home/user/dev" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... 🔸 Если вы запускаете скрипт по имени модуля то на первом месте будет домашняя директория текущего юзера python3 -m script "/home/user" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... Скрипт должен быть доступен для импорта На что это влияет? На видимость модулей для импорта. Если вы ждёте, что, запустив скрипт по пути, сможете импортировать модули из текущей рабочей директории, то вы ошибаетесь. Придётся добавлять путь os.getcwd() в sys.path самостоятельно или заранее объявлять переменную PYTHONPATH. #basic

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #posix

当前筛选 #posix清除筛选

#UNIX#POSIX 问题:如何正确理解 Permission denied 和 Operation not permitted 之间的区别? 答案: TL;DR: Permission denied: 老兄,你越界了,这个真不行。 Operation not premitted: 老兄,你在说什么鬼话? Permission denied 通常用于表示明确的因为权限设置导致的拒绝。 Operation not premitted 通常用于表示因为设计原因所不被允许的操作。 不过在实际的开发中,有的人似乎并不care这些,因此你也会见到因为权限策略拒绝时返回的 Operation not premitted 错误。(例如SELinux)

Hashtags

AIGC

@aigcrubbish · Post #84 · 06.11.2025 г., 16:21

Freedesktop.org now hosts the Filesystem Hierarchy Standard 文件系统层次结构标准(FHS)现已由Freedesktop.org托管和管理。FHS定义了POSIX操作系统如何组织系统和用户数据,被Linux、BSD及其他遵循POSIX规范的系统广泛采用。这一变动结束了此前关于FHS未来发展的讨论。 新规范页面可在此查看:https://specifications.freedesktop.org/fhs/latest/ #Linux#POSIX#文件系统标准#开源 #AIGC Read more

GitHub Trends

@githubtrending · Post #15246 · 24.10.2025 г., 13:30

#go#blob_storage#cloud_drive#distributed_file_system#distributed_storage#distributed_systems#erasure_coding#fuse#hadoop_hdfs#hdfs#kubernetes#object_storage#posix#replication#s3#s3_storage#seaweedfs#tiered_file_system SeaweedFS is a fast, simple, and highly scalable distributed file system designed to store billions of files and serve them quickly, especially small files. It uses a master server to manage volumes on volume servers, which handle file data and metadata, enabling very fast file access with minimal disk reads. It supports features like replication, erasure coding, cloud integration for elastic storage, and compatibility with many metadata stores and APIs including Amazon S3. This means you get efficient, cost-effective storage with fast access, easy scaling, and flexible deployment options for large-scale file storage needs. https://github.com/seaweedfs/seaweedfs