-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirecting stderr of SC2 process #101
Comments
Do I understand this as a request to be able to redirect the stderr from the game to a file, and to do so via a global flag? How would that help when you're running multiple instances? Wouldn't it send the stderr from all instances to that same file? |
Yes, it is really annoying. |
I'll look into fixing this in the near future, but a simple workaround I've been using so far is to redirect all stderr somewhere, i.e. |
Unfortunately, this behavior is still the same in today's version. I suggest updating the method def _launch(self, run_config, args, **kwargs):
"""Launch the process and return the process object."""
# del kwargs
try:
with sw("popen"):
return subprocess.Popen(args, cwd=run_config.cwd, env=run_config.env, **kwargs)
except OSError:
logging.exception("Failed to launch")
raise SC2LaunchError("Failed to launch: %s" % args) In this way, one could send something like from pysc2 import run_configs
my_run_config = run_configs.get(version=<some_game_version>)
# just drop stderr in this example
sc2_proc = my_run_config.start(want_rgb=False, stderr=subprocess.DEVNULL) |
Hah, I happened to be pulling in PRs for the first time in ages, and saw this comment. Thanks for the suggestion. |
Currently there's no way to redirect SC2 proc stderr (i.e.
Game has started.
messages) except for doing it globally, which is quite annoying if you're running multiple SC2 env instances.The way it should be done from within Python is by allowing
stderr=...
parameter in thesubprocess.Popen
call during StarcraftProcess::_launch call.One way to set is could be a global flag since project relies on
gflags
already.The text was updated successfully, but these errors were encountered: