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

Пребарај: #shrovetide

当前筛选 #shrovetide清除筛选
Learn RCRussian🤍💙❤️

@learnrcrussian · Post #4284 · 01.03.2025 г., 12:00

🥞Russian Blini: A Quick Recipe Ingredients: ☆1 cup milk ☆1 cup flour ☆1 egg ☆1 tablespoon sugar ☆Pinch of salt ☆2 tablespoons melted butter (plus extra for greasing) Instructions: 1. Whisk together milk, egg, sugar, and salt. 2. Gradually add flour, whisking until smooth. 3. Stir in melted butter. 4. Let batter rest for 15-30 minutes. 5. Lightly grease a hot pan. 6. Pour 1/4 cup batter onto the pan for each blini. 7. Cook for 1-2 minutes per side, until golden brown. 8. Serve warm with your favourite toppings (sour cream, jam, red caviar). 💢 By the way: • Печь блины [pech bli-ny] doesn't only mean to bake blini but also to skip pebbles on the water. Did you know it? Video: AI Pinterest 😋Yummy! What's your favourite topping/filling for Russian blini? #Russian_cuisine #holidays #Shrovetide 😎 Stay with @learnRCRussian

Learn RCRussian🤍💙❤️

@learnrcrussian · Post #4287 · 02.03.2025 г., 07:19

🌝С Масленицей! Happy Shrovetide! 🔻Maslenitsa (or Shrovetide), a week-long traditional Russian festival before Lent, culminates in Forgiveness Sunday. 🔻This significant day precedes Great Lent, marking a time for asking forgiveness and reconciliation. 🔻The week-long celebration leading up to it features the vibrant Russian tradition of Maslenitsa, including feasts, games like the thrilling greased pole climb, the burning of a winter scarecrow, and joyous performances of folk songs, lively chastushki (short humorous Russian songs), and energetic Russian folk dances. 🔻Maslenitsa remains incredibly popular, showcasing Russia's rich cultural heritage and is celebrated by Russians not only in Russia but in other countries as well. Video: an episode from Russian film Сибирский цирюльник by Nikita Mikhalkov (1998) #Maslenitsa #Shrovetide #holidays #Russian_culture #ForgivenessSunday 😎 Stay with @LearnRCRussian