#๐ multiprocessing Event type hint
17 messages ยท Page 1 of 1 (latest)
@fluid sun
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
from multiprocessing import Event, Process
its imported like this
can you show more of your code for context
def start_frida_server(event: Event) -> None:
"""..."""
function is just barebones rn, what do you want to see specifically?
Process(
target=start_frida_server,
args=(event,),
).start()
its called like this
event = Event()
with event being defined like this
you can try something like
from multiprocessing.synchronize import Event as EventClass
``` that's where the class is
the normal import points to Event = context._default_context.Event
that's why it's a "variable"
that worked, and also fixed pylance not being able to figure out the methods. thank you!
just keep in mind that when you import Event the first way, it gets initialised via
def Event(self):
'''Returns an event object'''
from .synchronize import Event
return Event(ctx=self.get_context())
``` I'm not sure why, so I would avoid doing `from multiprocessing.synchronize import Event` as a replacement for the initial import
yea it doesnt work properly if i replace the whole thing
so i just imported both ,one to use, one to hint
sounds good
Just for the exercise I went:
>>> from multiprocessing import Event
>>> type(Event)
<class 'method'>
It's not a type.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.