Skip to content

Commit

Permalink
Wrap isatty checks in try/except block.
Browse files Browse the repository at this point in the history
The sys.stdin.isatty() and sys.stdout.isatty() functions do not
exist when the geeknote is imported into a vim python module
giving rise to various 'AttributeError: isatty' errors. Wrap the
calls in a try/except block and handle the exception by setting
IS_IN_TERMINAL and IS_OUT_TERMINAL to False.
  • Loading branch information
nvgabriel committed Sep 15, 2014
1 parent 192a0c5 commit 4866273
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions geeknote/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

VERSION = 0.1

IS_IN_TERMINAL = sys.stdin.isatty()
IS_OUT_TERMINAL = sys.stdout.isatty()
try:
IS_IN_TERMINAL = sys.stdin.isatty()
IS_OUT_TERMINAL = sys.stdout.isatty()
except:
IS_IN_TERMINAL = False
IS_OUT_TERMINAL = False

# Application path
APP_DIR = os.path.join(os.getenv("HOME") or os.getenv("USERPROFILE"), ".geeknote")
Expand Down

0 comments on commit 4866273

Please sign in to comment.