Check isatty existence on sys.stdout

This fixes #**issue-916**.