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

TGINSIGHT SIMILAR POSTS

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

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

Мы уже знаем, что на текущую сессию интерпретатора изменение PYTHONPATH никак не повлияет. Но если вы запустите дочерний процесс, то он унаследует окружение текущего процесса, а значит и изменения в любых переменных будут на него влиять. Вот небольшой пример: Объявляем переменную user@host:~$ export PYTHONPATH=/path1 Запускаем интерпретатор user@host:~$ python3 Проверим что в sys.path >>> import sys >>> print(sys.path) ['', '/path1', '/usr/lib/...', ...] Добавляем что-то в переменную >>> import os >>> os.emviron['PYTHONPATH'] = '/path1:/path2' >>> print(sys.path) ['', '/path1', '/usr/lib/...', ...] Изменений нет. Но давайте запустим дочерний процесс и посмотрим там >>> os.system('python3') # теперь мы находимся в другом процессе >>> import sys >>> print(sys.path) ['', '/path1', '/path2', '/usr/lib/...', ...] Тоже самое будет и с subprocess, так как по умолчанию текущее окружение тоже наследуется. >>> import subprocess >>> subprocess.call(['python3', '-c', 'import sys;print(sys.path)']) ['', '/path1', '/path2', '/usr/lib/...', ...] ______________________ Лучшей практикой является передача энвайронмента явно через аргумент env! import subprocess subprocess.call(cmd, env={'PYTHONPATH': '...'}) Это поможет точно понимать какое окружение будет у запускаемого процесса и при этом не изменять окружение текущего процесса. #basic

Hashtags

Резултати

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

Пребарај: #castopod

当前筛选 #castopod清除筛选
Libreware

@libreware · Post #931 · 20.04.2021 г., 21:48

Castopod Host Castopod Host is an open-source server made for podcasters who want engage and interact with their audience. Please note that Castopod Host is still under heavy development: it may not be 100% stable and some features are still being developed. We are a team of entrepreneurs and developers who spent the last ten years developing media content solutions. We have always been advocates for the open source community, but we coud not find open source solutions for podcasts that suited our needs, so we decided to start The Podlibre Iniative. The past two decades of organic growth were driven by original audio content producers. Major digital players and audio content industry are now investing on Podcasts. Yet, compared to the standards in Social Media and Search Engines, Podcasts - technology, user experience - have not evolved much for the past 20 years. It is time for all players - Podcasters, Radio Networks, Journalists, Writers and all Voice lovers - to power up podcasts! https://podlibre.org/tag/castopod-host/ https://code.podlibre.org/podlibre/castopod/-/releases #castopod#podcast#opensource#alternative 📡@nogoolag📡@libreware