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

Пребарај: #pappe

当前筛选 #pappe清除筛选
MessageInABottle

@mib_messageinabottle · Post #6804 · 17.05.2024 г., 10:24

🇺🇸#USA 🇮🇱#Israel #ISRAELI ANTI-#ZIONIST HISTORIAN ILAN #PAPPE INTERROGATED BY #FBI AT DETROIT #AIRPORT The professor said that he was interrogated about his personal connections, with the agents inquiring about his #Arab and #Muslim friends in the USA, the length of their relationships, and the nature of their interactions. Pappe responded by directing the agents to his published works in some instances, while providing brief “yes” or “no” answers in others, citing exhaustion after an eight-hour flight. He also mentioned that the #FBI agents engaged in a lengthy phone conversation with an unidentified party, which he speculated could have been an Israeli official. Following the conversation, the agents copied the contents of his phone before allowing him to enter the country. https://x.com/Resist_05/status/1791001769591627894 https://www.middleeastmonitor.com/20240516-us-ilan-pappe-interrogated-by-fbi-at-detroit-airport/