Мы уже знаем, что на текущую сессию интерпретатора изменение 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
@MaxDeleteAll_Bot
Qué puede hacer este bot?
Este bot te ayuda a eliminar gran cantidad de mensajes en tus grupos o canales
use use /delall si desea que se eliminen todos los mensajes
use use /delfrom (punto inicial) & /delto (punto final) antes de usar /delsel si desea eliminar esos & todos los mensajes posteriores.
Idioma: Inglés
(visto en @BotsGram_cu)
#delete
Fast FB Delete Tool
by marcelja
Fast Facebook Activity Deletion
This program can be used to clean up a facebook account without deleting the entire account.
https://github.com/marcelja/facebook-delete
#fb#facebok#delete
Redact
Allows you to automatically clean up your old posts from services like Twitter, Reddit, Facebook, Discord and more all in one place
https://redact.dev
#redact#delete#fb#twitter#reddit
@MassActionBot
Qué puede hacer este bot?
Este bot puede realizar múltiples acciones en tu Chat. ¿Cuál? Ahí lo tienes.:
- Eliminar todos los mensajes
- Kick all
- Ban all
- Silencio todo
- Unban all
- Activar todo
Idioma: Inglés
(visto en @BotsGram_cu)
#chanel, #groups, #delete, #ban, #kick, #mute
@daysandbox_bot
Qué puede hacer este bot?
Este bot elimina las publicaciones reenviadas y que contienen enlaces de los nuevos usuarios del grupo
(visto en @BotsGram_cu)
#gestión, #grupo, #chat, #unión, #bienvenido, #mute, #delete
@shiiinabot
Qué puede hacer este bot?
Un bot para eliminar automáticamente los mensajes no deseados predefinidos del grupo.
Idioma: Portugués
(visto en @BotsGram_cu)
#delete, #group, #notification, #message, #regex, #spam, #picture, #remove
@GitHubBot
Qué puede hacer este bot?
Este es un bot de GitHub. Puede notificarle sobre eventos en sus repositorios públicos de GitHub. También puede responder a tus mensajes para publicar comentarios en GitHub directamente desde Telegram.
Idioma: Inglés
(visto en @BotsGram_cu)
#telegram, #notify, #events, #github, #delete, #public, #command, #messages, #repository
@DeleteEventsBot
Qué puede hacer este bot?
Este bot elimina mensajes de eventos (también conocidos como mensajes de acción) en supergrupos.
Idioma: Inglés
(visto en @BotsGram_cu)
#delete, #service, #message, #spam, #helper, #group, #supergroup, #join, #left, #pinned