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

Резултати

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

Пребарај: #monastery

当前筛选 #monastery清除筛选
Addis Standard

@addisstandardeng · Post #21670 · 10.03.2026 г., 14:32

#Ethiopia: Six reported killed in ‘heavy weapons attack’ on monastery in South Wollo, #Amhara region Six people were reportedly killed and more than 20 others injured in what witnesses described as a “heavy weapons attack” on Re'ese Adbarat Wota'eka Negest Atronse Maryam #Monastery in Mehal Sayint Woreda of #South_Wollo Zone, Amhara Region, The monastery’s administrator, Mekbib Abba Gebre-Egziabher Hailemariam, told the BBC that a mortar attack occurred on Saturday, 7 March 2026, at around 9:30 a.m. According to the administrator, who said he was present during the incident, three projectiles were fired toward the area. Another local resident who witnessed the incident told the BBC that the monastery is surrounded by forest and that residents suspect the attack may have been carried out under the assumption that militants were present in the surrounding area. He added that there had been “continuous firing” in the #Mehal_Sayint area since the attack ..... Read more: https://addisstandard.com/?p=55717