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

Пребарај: #yeshiwas

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

@addisstandardeng · Post #21371 · 11.02.2026 г., 14:05

News: #EPRP says politician #Yeshiwas Assefa arrested, calls for immediate release The #Ethiopian People’s Revolutionary Party (EPRP) has announced that politician Yeshiwas Assefa has been arrested, saying it confirmed the development through his family members. In a statement issued today, the party said Yeshiwas was taken into custody yesterday, describing the arrest as part of what it called the government’s continued crackdown on citizens engaged in peaceful political activity. “This is one of the countless acts that demonstrate the government’s ongoing suppression of citizens engaging in peaceful political activities,” the statement read. The EPRP further argued that such actions cast doubt on the credibility of the upcoming elections, which ruling party officials have repeatedly pledged will be free, fair and democratic. Instead, the party said, the current https://web.facebook.com/AddisstandardEng/posts/pfbid0haYBwZFd8QeABk6i1v9kN4LtHyVXkPGG4mFcjx4T6UPUAx1SVkJ5PCi2FpXQ74Col

Addis Standard

@addisstandardeng · Post #21376 · 12.02.2026 г., 06:36

#Ethiopia: Politician #Yeshiwas Assefa released hours after arrest Politician Yeshiwas Assefa has been released from custody hours after his arrest was confirmed by his party, the Ethiopian People’s Revolutionary Party (#EPRP). Mistresellassie Tamrat, General Secretary of EPRP, confirmed to Addis Standard that Yeshiwas was released yesterday at approximately 5:00 PM. She said the politician, who is also an EPRP election candidate, was freed after being detained yesterday. Earlier in the day, EPRP said it had verified through family members that Yeshiwas had been arrested. In a statement, the party described the arrest as “one of the countless acts demonstrating the government's ongoing suppression of citizens engaged in peaceful political activities.” Yeshiwas, who previously served as chairman of the Ethiopian Citizens for Social Justice (#EZEMA), has faced prior.... https://web.facebook.com/AddisstandardEng/posts/pfbid0joxCZicZF8EgEDFQmHdS2DJTZw56NdhZHg3pkF7p2bwbMKPTLtWMyroD9duASBtvl