Skip to content
Advertisement

How to know when a browser peer is disconnected in aiortc?

Error: It’s the first property in the documentation of aiortc but i cannot retrieved it. Note: I also tried with connectionstatechange event but either that worked. Edit: That’s the methods the pc object has: Answer aiortc uses pyee for making aiortc event-driven and as you can see in the official GitHub example (webcam/webcam.py), you must put an event listener on

How do I run another file in python?

So I know how to write in a file or read a file but how do I RUN another file? for example in a file I have this: a = 1 print(a) How do I run this using another file? Answer using subprocess standard lib or using os standard lib or extract python code from the file and run it

Filter for > 10 entries in foreign key object

You can see here I have three queries to return the first event that matches the criteria > 10 attendees. I wonder if there is a better way to combine this logic in one or two querysets instead. Answer Since django-3.2, you can make use of .alias(…) [Django-doc] for annotations that you do not need in the SELECT … part.

How to resize x axis

I want to resize the x-axis range, but I don’t know how to do that. The range I want to resize is [under 20, under 40, under 60, under 80]. X represent age and Y represent survived rate Answer Put your data into age groups before plotting: If you want more polished labels:

Advertisement