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

Резултати

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

Пребарај: #thng

当前筛选 #thng清除筛选

Raffle-airdrop $THNG from Drop Hunter and a mini-review of the token 😀 Things Token plans to launch an RWA platform for buying and selling real assets. It is hosted on our 🪙#TON blockchain and is already available on DEX platforms. You can learn more about the project. The conditions for the #Airdrop are below: 🟡Launch the bot. 🟡Subscribe to the channel. 🟡Invite 5 friends (old referrals count). 🟡Buy 1 ticket and wait for the results to be announced. Two-tier token system: ➖$THNGP: A token with voting rights in the DAO, mined through mining and participation in the presale. Can be exchanged for 👁#THNG at a ratio of 1:10. The transfer of this token is limited to a single transaction (for example, if you need to change your wallet). It can only be freely sent and received through mining, voting, and exchange (conversion) smart contracts. Do not attempt to sell these tokens or transfer them to exchanges. 😀$THNG: A freely tradable token for trading, transferring and other purposes. 🟡Drop type - Raffle. 🟡Total volume - 28 million $THNG coins 🟡Total winners - 400 people. 🟡For each user – $65,000 THNG for 1 ticket (50,000 points = 1 ticket) 😀 At the moment, THNG 2.0 staking is available with an APR of ~ 160% from August 23 to September 24. 🔥Keep farming and participate in all activities of DropHunters #farm#drop#TON#web3