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

Пребарај: #newdevelopmentbank

当前筛选 #newdevelopmentbank清除筛选

✒️Ambassador Albert P. Khorev's Interview with the TASS News Agency(February 9, 2026) Key points: #Priorities Currently, we are prioritizing contacts in the field of regional security and the fight against international terrorism. We are also coordinating efforts in multilateral forums, primarily the UN and the SCO. Cooperation between the cities and regions of our respective countries also shows promise. Moscow, the Republic of Tatarstan, and Primorsky Krai in Russia, as well as the provinces of Punjab and Sindh in Pakistan, have already expressed interest in this regard. #Education#Science#Culture We are paying special attention to strengthening ties in education, science, and culture. We are actively working to promote the Russian language in Pakistan, including through the federal project "Russian Teachers Abroad." We also facilitate the organization of joint scientific conferences and cultural and sporting events. #PakistanStillMills#Insulin In the coming years, it is crucial to promote mutual trade, develop reliable alternative payment mechanisms, and implement large-scale joint projects. These projects include the revival of the Pakistan Still Mills, establishing rail connections between Russia and Pakistan, collaborating on hydropower, and creating joint ventures to produce medicines, including insulin. #Oil Pakistan is interested in cooperating with our country in oil exploration and production. Russia is ready to help Pakistan strengthen its energy sovereignty. We already have positive experience in this area. It was the USSR that helped Pakistan establish the state-owned oil and gas company, the Oil and Gas Development Company Limited, in the 1960s, and it assisted in discovering a number of oil and gas fields in Pakistan. #SCO We acknowledge the constructive collaboration with our Pakistani partners within the SCO. Ensuring regional security and combating terrorism and organized transnational crime are our priorities. #BRICS#NewDevelopmentBank Russia welcomes Pakistan's interest in joining BRICS. One practical step toward integrating Pakistan into BRICS could be Islamabad's accession to the New Development Bank, which finances infrastructure projects in developing countries. #DiplomatsDay On February 10, the Russian Foreign Service celebrates Diplomats' Day. On this festive occasion, I would like to wish my colleagues in Moscow and at foreign missions happiness, good health, endless inspiration, and success in promoting Russia's position on the world stage. #RussiaPakistan