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

Пребарај: #lifelesson

当前筛选 #lifelesson清除筛选
Oreo's Space

@OreosSpace · Post #385 · 06.01.2023 г., 12:27

Habits we need to Avoid which drain our energy... 🙅🏼‍♂️❌ × Gossiping. × Overthinking. × Over stressed. × Sleeping in late. × Having a poor diet. × Holding on to the past. × Complaining all the time. × Taking things personally. × Fueling drama in the mind. × Always checking social media. #lifeLesson ━━━━━━━━━━━━━━━ Join us @OreosSpace🥀

Hashtags

Oreo's Space

@OreosSpace · Post #356 · 12.12.2022 г., 12:30

THINGS THAT CAN CHANGE YOUR LIFE FOR THE BETTER • Stop complaining and appreciate how lucky you are everyday. • Embrace loneliness and renew yourself in the process. • Say goodbye to the people that don't bring positive energy in your life. • Set limit to the time you spend on the internet. • Pick one skill and put all your effort into developing it. • Commit to the goals you set and never look back. • Exercise everyday to boost your mood. • Learn from every mistake you make. #lifelesson @OreosSpace

Hashtags

🌿Suffering and Desire🦋 Buddha taught that there is suffering in this world, it is inevitable, and the root cause of suffering is mainly the desires we feel. We want something, always, and feel miserable when we don't get it. Stoicism teaches us to live in accordance with nature and to accept that suffering will manifest in different ways in our lives. #Tuesday#Day-2 #Biographies#Inspiration #lifelesson#Thought

BBC Learning English

@english_bbc_learning · Post #3658 · 15.07.2025 г., 18:29

🤔 Did something bad happen to you when you weren’t expecting it? You’re not going to put yourself in that situation again, are you? 😄 Learn this useful English expression that summarises this life lesson. Give this post a like, and ✍️ put your answer in the comments! Do you have a similar expression in your language?⁣ ⁣ 🤩 Click on the link in our bio to learn some modern idioms!⁣ ⁣ Images: Getty⁣ ⁣ #learnenglish#advice#idioms#esl#efl#vocabulary#englishclass#phrases#expressions#oncebitten#britishenglish#lifelesson#inspiration#slang