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

Резултати

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

Пребарај: #russiaday2023

当前筛选 #russiaday2023清除筛选

🇷🇺 On June 10, 2023, a state reception on the occasion of the national holiday - #RussiaDay was held at the Russian Embassy in Malta. Among the guests were compatriots, public figures, entrepreneurs, representatives of education, science and culture. ❗️Russian Ambassador to Malta H.E. Andrey Lopukhov addressed the audience with a welcoming speech, emphasizing the importance of this annual event for the consolidation of the Russian community living in Malta. He also noted that Russia is ready to cooperate with those countries that declare their readiness and willingness to cooperate with us. 📷The photo exhibitions "Achievements of Russia" and "Beauty of Russia" were presented to the audience. 🎵The evening was accompanied by live performances of Russian and Maltese musical compositions. The guests were offered dishes of the traditional Russian cuisine. The reception was held in a warm and friendly atmosphere. #RussiaDay2023🇷🇺🇷🇺🇷🇺

Russian Mission to ASEAN

@aseanrussia · Post #482 · 17.06.2023 г., 15:37

🇷🇺 On June 15, 2023, the state reception on the occasion of #RussiaDay was held at the Hotel Mulia Senayan in Jakarta. The celebration was attended by esteemed representatives of the Indonesian government, socio-political, business, academic, creative and religious circles, compatriots, journalists, as well as foreign diplomats. 🎙️Welcoming remarks at the function were delivered by H.E. Mrs Lyudmila Vorobyeva, Ambassador of the Russian Federation to the Republic of Indonesia (read in full), H.E. Mr Evgeny Zagaynov, Ambassador of the Russian Federation to ASEAN, and H.E. Mr Budi Gunadi Sadikin, Minister of Health of the Republic of Indonesia, as the Guest of Honour. 💬Ambassador Lyudmila Vorobieva: It is a pleasure to welcome you all at the reception on the occasion of the Day of Russia. We are celebrating the unity and the strength of our country which is one of the main players on the global arena and whose people is looking into the future with confidence and pride. Russia and Indonesia have a long history of successful cooperation traditionally based on principles of friendship, mutual understanding and trustworthy dialogue. 🎵 The cultural programme of the event included works of great Russian composers P.I.Tchaikovsky and S.V.Rachmaninov played by graduates of Russian musical universities, as well as pieces by local dance ensembles and musicians. The Indonesian song "Rayuan Pulau Kelapa" performed in two languages — Russian and Indonesian — took a special place in the programme of the evening. 📸 The Embassy also organised an art exhibition of Russian landscapes which allowed guests to experience the authentic character of our Motherland and to enjoy picturesque views from various parts of Russia. #RussiaDay #RussiaDay2023

Russian Mission to ASEAN

@aseanrussia · Post #473 · 12.06.2023 г., 03:49

🇷🇺 On June 12, we celebrate #RussiaDay across the entire country and abroad. It reflects #Russia’s contemporary development, as well as its centuries-old path, endeavours & achievements. 🇷🇺 Happy Russia Day! #RussiaDay#RussiaDay2023#Russia1Love#WeAreRussia