-
Notifications
You must be signed in to change notification settings - Fork 127
Description
I have a pyscript with 1 line:
app('help')
If the script is run like: `pyscript script.py > out.txt', then cmd2 closes.
If a second line is added as shown below and the script run as before, then an exception prints before cmd2 exits.
app('help')
app('help')
Exception that prints:
Traceback (most recent call last):
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 1716, in onecmd_plus_hooks
stop = self.onecmd(statement)
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 2003, in onecmd
stop = func(statement)
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 259, in cmd_wrapper
return func(instance, args)
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 2591, in do_help
self._help_menu(args.verbose)
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 2640, in _help_menu
self.poutput("{}\n".format(str(self.doc_leader)))
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 601, in poutput
self.decolorized_write(self.stdout, msg_str)
File "/home/user/PycharmProjects/cmd2/cmd2/cmd2.py", line 579, in decolorized_write
(self.colors.lower() == constants.COLORS_TERMINAL.lower() and not fileobj.isatty()):
ValueError: I/O operation on closed file
EXCEPTION of type 'ValueError' occurred with message: 'I/O operation on closed file'