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

Пребарај: #contents

当前筛选 #contents清除筛选
Quiet World 🍁

@QuietWorld · Post #6661 · 07.10.2019 г., 13:00

Sometimes, I scrolled back to my previous #thoughts posts so that I can reread and remember what I said to myself to calm myself down & to assure that I can cope, so that I can cope again & again & again – & this is the main reason I started this channel last year & I'm glad I did, although I started to quite neglect it a lot this year 🥺 & I'm thankful for those of you who subscribed and stayed in this channel, especially those who responded to my #poll, interacted with us through our @qw_qwbot, & view our posts, because tbh it makes me feel like there's someone 'listening' to me and that is enough and much appreciated ❤ Thanks dear subscribers. Anyway, just for the update, we only have two admins now; Conan & me, but Conan seems to be occupied with his work since he started working this year, so because of those two reasons mentioned earlier, there might be less frequent posts in this channel 😅 But worry not, because we'll still be providing you with the best #contents we can 🤗 As for the new subscribers, welcome! 🥰🥳 #channelupdate#chupdate @quietworld🍃

Tg Links

@TgDict · Post #9 · 09.03.2021 г., 11:27

#Start#contents#index#mark This channel publishes groups and channels according to a main directory and several subject sub-directories for index search The search keywords are as follows: One type of keywords: Nine categories of first-level keywords Two types of keywords: Second-level keywords + geographic region + language family 1. Telegraph #telegram#Promotion #Group#channel#robot #Search#index#navigation 2. Resources #Resources#Share #Sharing#Welfare#moive#music#Books 3. Broadcasting #Broadcasting #message#info#news#blog 4. Chat category #Chat #chitchat#communication#city#area #Chinese#English#language#country #Mainland#HongKong#Taiwan 5. Computer category #Computer #Hardware#software#VPN#programming 6. Life category #life #Entertainment#Game#Funny#Anime #Live#tourism 7. Subjects #Subjects #Interest#hobbies#topic 8.Industry #Industry#business 9.To be classified #notes Unclassified