diff --git a/demo.py b/demo.py index 0754fd7..691b6f9 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 18e585f..d664b99 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')