Skip to content

Commit

Permalink
Move assignment of std_handles out of try loop so that if this fails …
Browse files Browse the repository at this point in the history
…we don't try an erroneous restore.
  • Loading branch information
rocky committed Oct 31, 2014
1 parent 5179c6f commit 9d9dd8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion solvebio/utils/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

logger = logging.getLogger('solvebio')

std_handles = [sys.stdin, sys.stdout, sys.stderr]
try:
# Switch from the default input ASCII encoding to the default locale.
# The Python runtime will use this when it has to decode a
Expand All @@ -16,7 +17,6 @@
# which is bad if they've already been reassigned. An ipython
# notebook shell, for example, sets up its own stdout.
# See github issue #43 and #21.
std_handles = [sys.stdin, sys.stdout, sys.stderr]
reload(sys).setdefaultencoding(locale.getdefaultlocale()[1])
locale.setlocale(locale.LC_ALL, '')
except:
Expand Down

0 comments on commit 9d9dd8a

Please sign in to comment.