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 слични објави

Пребарај: #hassan

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

@addisstandardeng · Post #21313 · 05.02.2026 г., 05:34

#Somali president orders urgent drought response as famine fears grow Somali President #Hassan Sheikh Mohamud on Wednesday ordered all government institutions to prioritise emergency drought response after visiting the National Disaster Management Agency’s emergency operations centre. The president received a detailed briefing from agency officials on the worsening drought, including the hardest-hit areas, displacement, environmental degradation and reported loss of life. Officials warned the crisis had reached a critical stage and risked tipping into famine if urgent action is not taken. Mohamud called on government officials, Somali business leaders, humanitarian organisations and international partners to unite in responding to the growing humanitarian emergency and to prevent further human suffering. He also instructed the country’s financial authorities to exempt from taxes all aid, donations and.... https://shabellemedia.com/somali-president-orders-urgent-drought-response-as-famine-fears-grow/

Addis Standard

@addisstandardeng · Post #21378 · 12.02.2026 г., 08:30

News: #Somali president witnesses #Egyptian troop deployment to AU mission in Somalia Somali President #Hassan Sheikh Mohamud has witnessed the formation of Egyptian forces assigned to the #African_Union Support and Stabilization Mission in Somalia (#AUSSOM), according to a report by Egypt Today, citing a statement from Egypt’s military spokesman. The formation ceremony was attended by Egypt’s Minister of Defense and Military Production Gen. Abdel Mageed Saqr, Chief of Staff Lt. Gen. Ahmed Khalifa, and senior Egyptian military commanders. The military spokesman said the visit included briefings on the preparation, equipping, and operational readiness of Egyptian troops designated for the mission. The program also featured training exercises and a display of vehicles intended for deployment, with officials stating the forces had completed intensive professional training to ensure.... https://web.facebook.com/AddisstandardEng/posts/pfbid02D7ibS3RJJRGZzoYDziFEYk4VKn5vmQXDQVkAtLaU2C4EuxFtVrj8HUbHXYrD4eFSl