I truly can not figure out what #python wants from me to cleanly and reliably stop subprocesses that are sharing Queues.
There's some intricate dance of Event.set, Queue.close, Queue.join_thread, Process.join but I've tried just about every permutation and pretty much everything hangs
The only thing that works is to make sure none of the Queues ever block and never ever EVER calling Process.join without first calling Process.terminate.
Queue.close/join_thread does absolutely nothing anywhere that I can tell.
And even in this maximally-working case I suspect I'm going to have race conditions where it doesn't work.
Why is there not a multiprocessing.cleanup() that Just Handles It?
Fun times enjoying Planetary Science and Robotics at Cape Town Science Centre Open day with the SAPIENT.rocks mars rover for #humanrightsday in #capetown #SouthAfrica
#mars #robotics #robot #python #planetaryscience
https://SAPIENT.rocks
Alors en fait je vois qu'il y a un autre moyen d'aboutir à mon objectif, en m'attaquant à l'itérable utilisé pour créer l'itérable de tuple :
objects_needing_specials = [obj for obj in universe_objects if random.random() < base_chance]
for e in empire_home_systems :
objects_needing_specials = [obj for obj in objects_needing_specials if obj not in fo.systems_within_jumps_unordered(5, [e])]
Ça peut marcher de filtrer la liste à partir d'elle-même ?
Cette syntaxe est acceptable ?
📰 5 Useful DIY Python Functions for Error Handling
Debugging Python doesn’t need to be complicated. These 5 DIY functions simplify error handling and improve code reliability.
📰 Source: KDnuggets
🔗 Link: https://www.kdnuggets.com/5-useful-diy-python-functions-for-error-handling

Ktoś zatruł popularną pythonową paczkę z 97 milionami pobrań…
Wczoraj, 24 marca, na oficjalnym repozytorium PyPI pojawiła się złośliwa wersja szalenie popularnej biblioteki LiteLLM (wersje 1.82.7 oraz 1.82.8). Czym jest LiteLLM? To opensource’owa “bramka”, która ułatwia programistom łączenie się z wieloma modelami językowymi (LLM) za pomocą jednego interfejsu API. To nie jest niszowy projekt, paczka ma na liczniku ponad 97 milionów pobrań.
Wystarczyło zainstalować. Nie trzeba było nawet uruchamiać!Atakujący wykorzystali mechanizm ukrywania kodu w plikach z rozszerzeniem “.pth” (tzw. Python Startup Hooks). Wrzucony przez nich do zatrutej paczki plik “litellm_init.pth” był automatycznie wykonywany przy każdym uruchomieniu interpretera Pythona.
To oznacza, że programiści-ofiary nie musieli wcale pisać “import litellm” w swoim kodzie. Wystarczyło, że zainstalowali paczkę (np. poprzez pobranie innego projektu, który używał LiteLLM jako zależności), a ukryty złośliwy skrypt uruchamiał się w tle przy każdym wywołaniu Pythona. Złośliwy kod wykradał z systemu:
Klucze SSH, zmienne środowiskowe (a więc i klucze API), i pliki z konfiguracją Dockera.
Dane uwierzytelniające do chmur AWS, GCP, Azure oraz całe konfiguracje klastrów Kubernetes.
Klucze prywatne TLS, hasła do baz danych (PostgreSQL, MySQL, Redis) i pliki portfeli kryptowalutowych.
Historia powłoki (bash_history, zsh_history), gdzie często lądują hasła wpisywane “z palca”.
Wszystkie te dane są pakowane do archiwum tpcp.tar.gz, szyfrowane i wysyłane na serwer kontrolowany przez napastników: “models.litellm[.]cloud“. Wiecie więc już czego szukać w logach… Szacuje się, że ofiarą tego ataku mogło paść nawet 500 000 urządzeń. Ale mogło być gorzej…
Wpadka hakera zmniejszyła katastrofęCo ciekawe, atakujący popełnili głupi błąd. Jak informuje [...]
#AI #Hacked! #LiteLLM #Programowanie #PyPI #Python
https://niebezpiecznik.pl/post/litellm-pypi-python-hack/
Как я построил «аниме-завод»: систему, которая сама превращает эпизоды в YouTube Shorts
Привет, Хабр! Последние месяцы я строил систему, которую внутри называю «аниме-заводом»: на вход она получает исходный эпизод, а на выходе собирает готовый YouTube Shorts с динамическим кадрированием, субтитрами, постобработкой и метаданными для публикации. Интереснее всего здесь не сам факт автоматического монтажа, а то, что значительную часть такой работы удалось разложить на инженерные этапы: транскрибацию, анализ аудио и сцены, поиск удачных моментов, управление «виртуальной камерой» и контур обратной связи по метрикам. В статье я покажу, как устроен этот пайплайн, почему я пошел в модульную архитектуру вместо end-to-end black box, где система ломалась и какие решения в итоге сделали ее реально рабочей.
https://habr.com/ru/articles/1014810/
#анализ_видео #Python #computer_vision #автоматизация #YouTube_Shorts #обработка_аудио #субтитры #OpenCV #Whisper #media_pipeline
Conditionals in python
python
if <condition>:
Code
elif <condition>:
Code
else:
Code
📖 Read more: https://sajalchoudhary.net/til/conditionals-in-python/
Very interesting new incident the global cybersecurity community is talking about right now, even Elon Musk has mentioned it... cybercriminals used AI-generated malware to poison a popular Python coding package called LiteLLM that helps manage AI API keys that provide access for more than 100 AI models to huge organisations including Nasa, Netflix, Nvidia, Adobe and Stripe.
The main reason the attack was discovered was that the malware was incredibly sloppily coded. If it hadn't been, no one would have noticed.
And the hilarious part was that the hackers got so upset that the cybersecurity researchers criticised the low quality of their code, even contacting one directly to argue that it was nevertheless indeed *successful* as millions of machines were infected 🤣
I have availability this week to provide commentary on this news and both the cybersecurity and AI aspects, so feel free to reach out😉
#cybersecurity #LiteLLM #AI #malware #cyberattack #Python #LLMs #technology #technews

OpenAI ha comprato Astral, l'azienda dietro uv e ruff. Ma non è solo un'acquisizione: è il terzo caso in pochi mesi di una AI company che compra infrastruttura open source. Anthropic con Bun, Cloudflare con Astro, ora OpenAI con Astral.
Il pattern è chiaro: non stanno comprando i rubinetti, stanno comprando i tubi.
https://youtu.be/qoYazaaQGzU?si=RRqYpswON9VspLH2
#openai #astral #python #opensource
Ursina 3D-игры. Определение расстояния между двумя объектами
В этом руководстве мы разберёмся, как в игровом движке Ursina определять расстояние между объектами. Это очень важно для создания интерактивных игр: чтобы враги замечали игрока, предметы можно было подбирать, а интерфейс реагировал на действия пользователя. Также приведено несколько практических примеров с подробными комментариями для начинающих: 1. Простое обнаружение стены 2. Подбор предмета (альтернатива distance) 3. Пуля и враг 4. Система подбора предметов 5. ИИ врага — зона обнаружения 6. Столкновения в Pong
https://habr.com/ru/articles/1014780/
#python #ursina #3d_игры #программирование #расстояние_между_объектами
🛠️ Wir suchen technische Verstärkung!
Python, Rails, DNS oder M365? Dann komm zu opencampus.sh in Kiel!
Minijob (ca. 40h/Monat, 15 €/h, hybrid) – von Website-Pflege und Backend-Entwicklung bis Raspberry-Pi-Setup bei Events.
📩 Bewerbung mit Motivationsschreiben + Lebenslauf an team@opencampus.sh
#Kiel #Minijob #TechJobs #WebDev #Python #RubyOnRails #Linux #OpenSource #Bildung #Innovation #Waterkant #JobKiel @webmontagkiel
