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

Резултати

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

Пребарај: #ancientgreece

当前筛选 #ancientgreece清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40219 · 29.11.2025 г., 15:04

The custom of putting candles on cakes dates back to the ancient Greeks, who honored the goddess Artemis by placing lit candles on round, moon-shaped cakes. They believed that the smoke from the candles carried their wishes and prayers up to the gods in the sky. @googlefactss#history#ancientgreece

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40693 · 22.02.2026 г., 23:01

The name Ethiopia comes from the ancient Greek word “Aithiopia.” It comes from “aithō” (to burn) and “ops” (face), meaning “burnt face.” Ancient Greeks used this word to describe dark-skinned people living south of Egypt. The word appears in the works of Homer, who lived around the 8th century BCE. 🌍🔥 #Ethiopia#History#AncientGreece#DidYouKnow@googlefactss

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40123 · 18.11.2025 г., 19:01

In ancient Greece, rhaphanidosis was a documented punishment for adultery 📜. Those convicted would have a radish root inserted into their anus as both physical penalty and public shaming . [Source] 🍑🥕 @googlefactss#AncientGreece#History#HistoricalFacts#Vegetables

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40239 · 02.12.2025 г., 19:00

The first vending machine was invented in the 1st century AD by Greek engineer Heron of Alexandria. It dispensed holy water when a coin was inserted—the weight tilted a lever, opening a valve to release water before the coin dropped. 💧⚖️ [Learn more] @googlefactss #History#Inventions#Engineering#AncientGreece

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40236 · 02.12.2025 г., 07:04

🌍 Over 2,200 years ago, the Greek mathematician Eratosthenes calculated Earth’s circumference using only a stick and his brain — and he was almost exactly right! 📏 By observing shadows in two cities, he calculated the Earth was about 40,000 km around. Ancient genius at its finest! [Source] @googlefactss#AncientGreece#ScienceHistory#Eratosthenes#EarthCircumference#AncientScience

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40689 · 21.02.2026 г., 23:01

In ancient Athens, some elite men formed socially recognized relationships with adolescent boys called eromenos. The adult, erastes, acted as a mentor, teaching the boy skills and introducing him to society. These relationships were accepted at the time and had strict social rules: the boy had to be young and not fully grown. Once he reached adulthood, remaining in that role was considered inappropriate.. 🏛️📜 @googlefactss#AncientGreece#History#Athens#Culture#Mentorship#Elite#law