diff options
author | Robey Pointer <robey@lag.net> | 2005-04-18 00:11:34 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-04-18 00:11:34 +0000 |
commit | 29a5381ba17c5c93e7ed5c07a4ece223a8ed0b66 (patch) | |
tree | 124202f3b822b99bdb98f806767c56b2f148ee89 | |
parent | 18aaff8521d1d5eb6739c1d53686b1de326b8300 (diff) |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-162]
avoid os.environ['HOME'] in the demos
avoid using os.environ['HOME'], which will never work on windows, and
use os.path.expanduser() instead. it's semi-moot because windows doesn't
have a standard location for ssh files, but i think paramiko should set a
good example anyway.
-rwxr-xr-x | demo.py | 4 | ||||
-rwxr-xr-x | demo_simple.py | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -25,7 +25,9 @@ import paramiko ##### utility functions def load_host_keys(): - filename = os.environ['HOME'] + '/.ssh/known_hosts' + # this file won't exist on windows, but windows doesn't have a standard + # location for this file anyway. + filename = os.path.expanduser('~/.ssh/known_hosts') keys = {} try: f = open(filename, 'r') diff --git a/demo_simple.py b/demo_simple.py index 18e585f6..d664b994 100755 --- a/demo_simple.py +++ b/demo_simple.py @@ -25,7 +25,9 @@ import paramiko ##### utility functions def load_host_keys(): - filename = os.environ['HOME'] + '/.ssh/known_hosts' + # this file won't exist on windows, but windows doesn't have a standard + # location for this file anyway. + filename = os.path.expanduser('~/.ssh/known_hosts') keys = {} try: f = open(filename, 'r') |