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

Резултати

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

Пребарај: #binourtissues

当前筛选 #binourtissues清除筛选
NEA Singapore

@NEASingapore · Post #154 · 22.01.2021 г., 10:50

Have you been returning your trays and binning used tissues? A large majority of people surveyed agreed that litter left behind poses a public health risk. However, whilst 90% felt that diners should clear their tables after eating at public dining places, the average tray return rate at most hawker centres is only around 30%. View key findings of the survey at https://www.nea.gov.sg/media/news/news/index/vast-majority-surveyed-feel-that-patrons-should-be-required-to-clear-their-tables-after-eating-at-public-dining-places We can do more to keep #OurHawkerCentres clean and safe for everyone! #ReturnOurTrays#BinOurTissues

NEA Singapore

@NEASingapore · Post #144 · 28.12.2020 г., 05:22

Phase 3 of Re-opening commences today. To accommodate the increase in group size of up to 8 persons, markings on seats and tables at the dining areas of hawker centres have been revised. While we bond over our favourite hawker food, let’s also #ReturnOurTrays and #BinOurTissues. #OurHawkerCulture is not just about the heritage, great food and bustling ambience – it is also about how it brings people from all walks of life together. Let’s keep #OurHawkerCentres clean and safe for everyone 😊 Access control and interim fencing at more markets will also be removed, details at https://www.nea.gov.sg/media/news/news/index/phase-3-of-re-opening-hawker-centres-and-markets

NEA Singapore

@NEASingapore · Post #69 · 20.06.2020 г., 03:30

We are all looking forward to dining in again at our favourite places. Let’s not forget good dining habits at #OurHawkerCentres to mitigate the spread of COVID-19! #BinOurTissues & #ReturnOurTrays, to keep the table clean for the next user and reduce the risk of disease transmission to cleaners and other members of the public. Eat from your tray, and don’t leave behind soiled tissues or wet wipes on dining tables. #FightCOVID19#SGClean

NEA Singapore

@NEASingapore · Post #67 · 17.06.2020 г., 12:55

Don’t leave your used tissues or wet wipes behind when dining at #OurHawkerCentres! It is important to dispose of used tissues or wet wipes which can be highly contaminated, to #FightCOVID19, especially as we resume our activities gradually. From 19 Jun when dining-in resumes, Safe Distancing Ambassadors at hawker centres and coffeeshops will be on hand to remind patrons to be socially responsible and observe personal hygiene. Let’s all do our part to keep ourselves and those around us safe. https://go.gov.sg/nea17jun20-hygieneathcs-toilets #BinOurTissues#ReturnOurTrays#SGClean#KeepSGClean

NEA Singapore

@NEASingapore · Post #73 · 02.07.2020 г., 00:30

Let’s remember to stay at least a metre apart from each other. We wouldn’t want all the effort and resources of the past few months to go to waste. Dining in at #OurHawkerCentres? Let’s not forget to #ReturnOurTrays and #BinOurTissues after enjoying the meal! #SGUnited#SafeDistancing#FightCOVID19