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

Резултати

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

Пребарај: #evacuation

当前筛选 #evacuation清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40339 · 16.12.2025 г., 11:00

Neon tetra fish form orderly queues when escaping through narrow spaces to avoid bumping into each other. Scientists observed groups of these fish passing calmly through small openings without clogging. This behavior helps them evacuate efficiently, unlike humans and sheep who often push and cause jams in emergencies. The study may help improve traffic flow and robot swarm designs. [Source] @googlefactss #FishBehavior🐟#Science#Evacuation#Nature#Research

International News

@intnewsagency · Post #8942 · 26.03.2026 г., 15:43

Evacuation at GES-2 Cultural Center in Moscow An evacuation is underway at the GES-2 Cultural Center in Moscow. Authorities have not yet disclosed the cause of the incident, and official information remains unavailable. Relevant services are actively ensuring the safety of visitors and staff. The situation is ongoing; stay tuned for updates. #Moscow#Evacuation#GES2#Incident The main news of Russia and the world ishere.

International News

@intnewsagency · Post #9239 · 05.04.2026 г., 14:35

Evacuation Underway in Makhachkala Due to Building Collapse Risk Residents of a multi-story building in Makhachkala are being evacuated amid fears the structure may collapse. Recent bad weather caused flooding across towns and villages in Dagestan, worsening regional infrastructure conditions. Local authorities are acting swiftly to ensure public safety. “Ensuring life support and safety is the republic’s priority,” officials stated. #Dagestan#Makhachkala#Evacuation#BadWeather#Safety The main news of Russia and the world ishere.