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

Пребарај: #omb

当前筛选 #omb清除筛选
Trump's Ear

@trumpsear_tg · Post #1641 · 14.10.2025 г., 14:51

4,000 federal employees are packing up Since October 1, the United States has been in a state of shutdown. Due to the budget conflict between Republicans and Democrats, the government can only finance the most necessary, tens of thousands of employees have been sent on forced vacations. To force the Democratic Party to give in, the Trump administration is increasing pressure and launching mass layoffs. Director of the Office of Management and Budget(OMB) Russ Vought announced on Thursday that more than 4,000 employees will be laid off. The Treasury Department will be particularly hard hit, with more than 1,400 layoffs, and the Department of Health and Human Services (HHS), with over 1,100. Hundreds more people will lose their jobs at the ministries of Education, Commerce, Energy, Housing and Urban Development, the Department of Homeland Security and the Environmental Protection Agency (EPA). Democratic Minority leader Chuck Schumer accused Trump and OMB director Vought of "deliberately harming people who defend our country." Usually, during the shutdown, federal employees are temporarily put on leave and then returned to work, most often with compensation. #Shutdown#Democrats#OMB#HHS 👂More on Trump's Ear ⚠️