0

I have some sort of multi-agent system running locally implemented in Python using ZeroMQ. The master is started as the main thread (python Admin.py) and this one starts the worker agents as multiprocessing.Process sub-processes.

Both the Admin.py and the workers write output using simple print commands. Now I try to fetch all output that I see on my console: $ python Admin.py > file.txt. But this statement only fetches the output written by the Admin.py. I tried various redirects such as piping sterr into stdout and than fetches stdout (1>&2 > file.txt) but without any result. This question has been asked in various forms on Satckoverflow (here and here) and the answers seem to involve quite some additional python coding. Is there a Bash solution to this issue? I see all output on my console, so why can't Bash redirect it to a file?

Community
  • 1
  • 1
user989762
  • 1,686
  • 3
  • 16
  • 20
  • Isn't it `2>&1 > file.txt` ? – Serge Ballesta Nov 11 '14 at 16:13
  • @SergeBallesta or better yet `> file.out 2>&1`. Order matters in redirections. Your example 1) redirects stderr to the same place stdout is currently going, then 2) redirects stdout (but not stderr) to go someplace else... – twalberg Nov 11 '14 at 18:31

0 Answers0