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

Пребарај: #noninterference

当前筛选 #noninterference清除筛选

@RusEmbMalta Press Release: 🇷🇺 Russia Stands for Peace, Dialogue and Sovereignty in the Balkans The Embassy of the Russian Federation in Malta draws attention to the situation in Bosnia and Herzegovina, which continues to raise serious concern. 🇷🇺Russia firmly opposes the ongoing attempts by Western members of the Peace Implementation Council to distort the Dayton Peace Agreement (1995) and to impose a centralized political model on Bosnia and Herzegovina under external control. Such actions undermine the very foundation of the Dayton framework endorsed by UN Security Council Resolution 1031 (1995), threaten the coexistence of the three constituent peoples – Bosniaks, Serbs and Croats – and erode the autonomy of the Republika Srpska and the Federation of Bosnia and Herzegovina. 🕊️ Moscow’s position is clear: the future of Bosnia and Herzegovina must be determined by its peoples through equal dialogue and consensus, not through diktat from abroad. The activities of the so-called “High Representative” Christian Schmidt – who was never approved by the UN Security Council – have no legitimacy and represent direct interference in the internal affairs of a sovereign state. 🇷🇸 Russia also consistently defends the sovereignty and territorial integrity of the Republic of Serbia, as reaffirmed in UN Security Council Resolution 1244 (1999). Attempts by Western countries to legitimise Pristina’s unilateral declarations and to pressure Belgrade into recognition of Kosovo are unlawful and destabilising. The imposition of such neo-colonial schemes in the Balkans only deepens divisions and fuels tension across the region. 🌐 Russia calls on all responsible members of the international community to defend the principles of the Dayton and UN frameworks, to respect the sovereignty of Balkan states, and to prevent the erosion of peace and stability in South-Eastern Europe. #Russia#BosniaAndHerzegovina#RepublikaSrpska#Serbia#Kosovo#DaytonAgreement#Sovereignty#NonInterference🇷🇺🤝🇧🇦🇷🇸