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

Резултати

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

Пребарај: #dwarfs

当前筛选 #dwarfs清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #417 · 13.10.2025 г., 15:21

🪐 Deep in the Milky Way, the star J0247-25B is a true cosmic oddball—it’s a rare "pre-helium white dwarf," meaning it’s caught in the act of shedding its outer layers before becoming a typical white dwarf star. This unusual star is much hotter than normal for its size, giving scientists a unique chance to watch stellar evolution unfold before their eyes and providing clues about how stars change shape and temperature toward the end of their lives. ✨ #unusualstars⚡#milkyway⚡#white⚡#dwarfs⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #366 · 03.10.2025 г., 12:21

🪐 One of the most unusual stars known is SDSS J122859.93+104032.9, a "carbon-rich white dwarf" about 1,000 light-years from Earth. Unlike typical white dwarfs—stellar remnants made mostly of hydrogen and helium—this star's atmosphere is packed with carbon, giving it a faint, bluish glow and defying expectations about how dying stars shed their outer layers. ✨ #unusualstars⚡#white⚡#dwarfs⚡#stardust⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #469 · 31.10.2025 г., 12:21

🪐 The star HD 49798, located about 2,000 light-years away in the constellation Puppis, is an unusual subdwarf that forms a pair with a mysterious, ultra-dense white dwarf companion. The white dwarf is spinning at a record-breaking speed of just 13 seconds per rotation, making it one of the fastest-spinning white dwarfs ever found and offering a glimpse into rare, exotic outcomes of stellar evolution. ✨ #unusualstars⚡#white⚡#dwarfs⚡#HD49798⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​