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

Пребарај: #artprotection

当前筛选 #artprotection清除筛选
AI & Law

@ai_and_law · Post #151 · 29.10.2023 г., 09:48

🌟 AI Sunday Wonders: New Tool Empowers Artists in the Fight Against Unauthorized AI Training Hello everyone! This Sunday Here's the latest from the world of AI and art. Meet "Nightshade," a groundbreaking tool enabling artists to safeguard their work from being used in AI model training without their consent. By subtly altering the pixels in their artwork before posting it online, artists can introduce invisible changes that, when incorporated into AI training data, can cause unpredictable distortions in the AI-generated output. This tool is designed to challenge AI companies that exploit artists' creations without authorization to train their models. The result? Future iterations of image-generating AI models may produce bizarre results: dogs might become cats, cars could transform into cows, and so on. Nightshade aims to shift the balance of power back to artists. It serves as a potent deterrent against AI companies that disregard artists' copyrights and intellectual property. #AIandArt#ArtProtection#AIInnovation#NightshadeTool#AIandCopyright