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

Резултати

Пронајдени 4 слични објави

Пребарај: #russiamalta

当前筛选 #russiamalta清除筛选

@RusEmbMalta: 🇷🇺Commentary by the Russian Ambassador to Malta Andrey Lopukhov on the "Times of Malta" editorial “A Far More Complex Reality” (published on 29 September 2025 in Times of Malta). 🔗 Read in full here. 🔹 The Minsk Agreements were designed to resolve the issues of Russian-speakers through autonomy within Ukraine. Their failure resulted from Kiev and its Western guarantors refusing to implement them. 🔹 Russian-speaking citizens in Ukraine faced systemic pressure: language and media bans, party closures, and discrimination against the canonical Orthodox Church. 🔹 NATO’s eastward expansion was among the key drivers of the Ukranian crisis and a real strategic risk for Russia’s security. 🔹 Russia is a nation with immense strategic potential, a resilient economy, and a proven efficiency Army. Any plans to “defeat” it are doomed to fail. 🔹 Europe’s future lies either in continuing self-deception and escalation, or in recognizing reality and seeking a genuine balance of interests. #UkrainianCrisis#RussiaMalta

@RusEmbMalta: 🇷🇺 Comment by the Russian Ambassador to Malta, Andrey Lopukhov on the article by Edward Zammit Lewis, Chairperson of the Foreign and European Affairs Parliamentary Standing Committee, Malta, published in Times of Malta. Key points: 🔹 Any “tribunals” or “funds” without UN Security Council mandate are legally null and void. 🔹 Malta’s neutrality cannot mean one-sided support for Ukraine alone. 🔹 Root causes of the crisis: Kiev’s refusal to implement the Minsk agreements, discrimination of Russian speakers, and NATO’s expansionist course. 🔹 Ignoring Kiev’s violations is not neutrality, but bias. 🔹 Confiscation of Russian assets in Europe = violation of the principle of property inviolability. 🔹 History shows: pressure and force against Russia have never worked. 👉 Full text: read #RussiaMalta#RussiaEU#UkraineCrisis#InternationalLaw