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

Пребарај: #criticalinfrastructure

当前筛选 #criticalinfrastructure清除筛选
Crypto M - Crypto News

@CryptoM · Post #64721 · 09.04.2026 г., 16:04

🚀 U.S. Treasury Launches Cybersecurity Initiative for Digital Assets The U.S. Treasury's Office of Cybersecurity and Critical Infrastructure Protection (OCCIP) announced a new initiative on April 9 aimed at bolstering cybersecurity within the digital asset sector. According to BlockBeats, this initiative will provide eligible U.S. digital asset companies and industry organizations with timely and actionable cybersecurity information. The goal is to enhance their ability to identify, prevent, and respond to cyber threats targeting their customers and networks. This action implements a key recommendation from the President's Working Group on Financial Markets report titled 'Strengthening U.S. Leadership in Digital Financial Technology.' #USTreasury#Cybersecurity#DigitalAssets#OCCIP#CriticalInfrastructure#FinancialMarkets#CyberThreats#DigitalFinancialTechnology

Crypto M - Crypto News

@CryptoM · Post #64739 · 09.04.2026 г., 17:11

🚀 U.S. Treasury Expands Cybersecurity Service to Crypto Firms The U.S. Treasury has announced the extension of its cybersecurity information-sharing service to eligible cryptocurrency firms via its Office of Cybersecurity and Critical Infrastructure Protection. According to NS3.AI, this initiative aims to provide participating companies with timely and actionable warnings similar to those received by traditional financial institutions. This move comes after a recommendation from the President’s Working Group on Digital Asset Markets last year. #USTreasury#cybersecurity#cryptofirms#informationsharing#cyberprotection#digitalassets#criticalinfrastructure#financialinstitutions#NS3AI#PresidentWorkingGroup#crypto