TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #303 · 27 дек.

Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения os.getenv(NAME) И её "сестра" для создания или изменения переменных окружения os.putenv(NAME, VALUE) Но почему-то putenv() не работает как должно. Энвайромент не обновляется! os.putenv('MYVAR', '1') print(os.getenv('MYVAR')) ... и ничего 😴 Почему так? На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ. Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get() В то время как putenv() это built-in С-функция. Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет. В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__(). То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так: >>> os.putenv('MYVAR', '123') >>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"') 123 Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ. Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы. Итого ▫️ Удобней всего явно обновлять переменные через os.environ ▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать! ▫️os.environ это просто обертка для built-in функций putenv() и unsetenv(). #basic

Hashtags

Резултати

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

Пребарај: #splinternet

当前筛选 #splinternet清除筛选
Libreware

@libreware · Post #968 · 05.07.2021 г., 01:41

SplinterNet Android app designed to create an unblockable Twitter like network that uses no cellular or Internet communications. All messages are transmitted over Bluetooth between users, creating a true peer-to-peer messaging system. All messages are anonymous to prevent retaliation by government authorities. SplinterNet is a true peer-to-peer network in that it requires physical proximity to other people to transmit messages. In the current version this happens over a close range Bluetooth connection. To illustrate how SplinterNet works, here is an example scenario: You take a picture of a protest happening near your home. Fearing a spread of the protest the government shuts down cellular and Internet access to most citizens. You write a short message about the protest in SplinterNet and attach the picture. When you next meet with your friends, you sync SplinterNet with them. They now have your photo and will spread it to their friends. You also now have all their messages, which includes photos taken of protests happening in other parts of the country. Any person who can reach a working Internet connection can post all of these photos to any sharing service or send directly to journalists to publicize. If you fear capture, you can press a single button and all the messages in your copy of SplinterNet are deleted. Features Create a post with text and an optional single image. Mark posts as important to increase their spread within the network. These posts will be sent first during syncing and will be highlighted for the people you sync with. Delete posts to stop their spread. The contents of the network reflect what users of the network think is important and appropriate. You don't have to spread anything you don't want to. Project Status This is an experimental project still in development. All of the features listed here should work, they just haven't been tested in large networks. Please let us know how it works! https://raw.githubusercontent.com/megamattron/SplinterNet/master/other/splinterNet-infosheet.png https://github.com/megamattron/SplinterNet 📡@nogoolag📡@libreware #SplinterNet#im#messaging#p2p#bt#bluetooth