Closed davideps closed 2 years ago
The actor runs in a separate process context and in that context, stdin
is closed and stdout
/stderr
are redirected. This prevents the actor from intercepting and/or competing with input in the main process.
If you need to read from stdin
, the best method is to have the main application (which started the actors) be the one to read from stdin
and then send the read information to an actor via ActorSystem().tell({ACTOR_ADDR}, {INPUT_MSG})
. You would probably wrap the input message in some kind of class so that you could identify it in the actor's receiveMessage
and differentiate the user input message from other messages handled by the actor.
Ah, got it. I'll try that later this week. Thank you.
Can this issue be closed, @davideps ? Do you have any updates on trying the above alternative or any others?
I'd like to create an actor for user input to send ad-hoc messages to other actors in the system. I don't want to use a true Python REPL for security reasons. I'm pasting in my code and the error trace.
Here is the error trace (repeated a few times)