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

Пребарај: #spacehazards

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

@cosmomyst · Post #211 · 02.09.2025 г., 16:11

🪐 The asteroid (136617) 1994 CC is a rare triple system, meaning it consists of one main asteroid about 700 meters wide and two smaller moons orbiting it. This near-Earth object follows a path that occasionally brings it close enough to be watched by planetary defense teams, as its complex system could create unpredictable trajectories in the event of a gravitational nudge. ✨ #asteroids⚡#spacehazards⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #491 · 11.11.2025 г., 12:21

🪐 Asteroid (2023) JK, discovered in May 2023, is about 200 meters wide and passed within 730,000 kilometers of Earth—closer than twice the distance to the Moon. Its swift approach was detected less than a week before its closest pass, demonstrating how new near-Earth objects can still surprise astronomers and reminding us that even mid-sized space rocks can appear on short notice. ✨ #asteroids⚡#nearearth⚡#spacehazards⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #94 · 07.08.2025 г., 13:11

🪐 The asteroid (2340) Hathor, measuring about 300 meters across, belongs to the Aten group—asteroids whose orbits bring them very close to Earth's path around the Sun. Its periodic close approaches make it one of hundreds of "near-Earth objects" that astronomers carefully watch, since changes in their orbits could potentially pose a threat to our planet in the future. ✨ #asteroids⚡#nearEarth⚡#spacehazards⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #669 · 09.02.2026 г., 12:21

🪐 Asteroid (29075) 1950 DA is one of the most closely monitored potentially hazardous asteroids, as it has a slim chance of impacting Earth in the year 2880. This kilometer-sized space rock spins so fast—completing a rotation every 2.1 hours—that its own gravity barely holds it together, making it a real cosmic oddity among dangerous near-Earth objects. ✨ #asteroids⚡#planetarydefense⚡#spacehazards⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​