@QuietWorld · Post #6675 · 10.10.2019 г., 00:00
Fair play isprimarilynot blaming others for anything that is wrong with us. — Eric Hoffer – #quotes#truth#selfdevelopment @quietworld🍃
Hashtags
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
Пребарај: #selfdevelopment
@QuietWorld · Post #6675 · 10.10.2019 г., 00:00
Fair play isprimarilynot blaming others for anything that is wrong with us. — Eric Hoffer – #quotes#truth#selfdevelopment @quietworld🍃
Hashtags
@englishmeta1 · Post #94 · 14.03.2022 г., 08:51
Learn to refuse! Such a skill can be useful to get away from pressure and extortion from manipulators, especially if you are a soft, compliant person and are afraid to refuse someone, even at the cost of your own comfort and peace of mind. Start with a softer option: “I don’t think”, “I won’t succeed”, “I can’t”. To begin with, it is important to understand that there is the very possibility of failure, then it will become easier. But in the end, you need to come to a firm “no” without explaining your refusal or justifying your decision to others. *** Next post: Life Tips ♡ ㅤ ⎙ㅤ ⌲ 🔔 ˡᶦᵏᵉ ˢᵃᵛᵉ ˢʰᵃʳᵉ unmute #psychology#Selfdevelopment 📝 Requests: @Guidancee_bot ©@This_is_psychology
Hashtags
@QuietWorld · Post #6683 · 10.10.2019 г., 09:30
Often we change..; jobs, friends and spouses.. instead of ourselves. — Akbarali H. Jetha – #quotes#reflection#selfdevelopment @quietworld🍃