summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2005-04-18 00:11:34 +0000
committerRobey Pointer <robey@lag.net>2005-04-18 00:11:34 +0000
commit29a5381ba17c5c93e7ed5c07a4ece223a8ed0b66 (patch)
tree124202f3b822b99bdb98f806767c56b2f148ee89
parent18aaff8521d1d5eb6739c1d53686b1de326b8300 (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-xdemo.py4
-rwxr-xr-xdemo_simple.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/demo.py b/demo.py
index 0754fd72..691b6f9b 100755
--- a/demo.py
+++ b/demo.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')
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')