From 29a5381ba17c5c93e7ed5c07a4ece223a8ed0b66 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 18 Apr 2005 00:11:34 +0000 Subject: [PATCH] [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. --- demo.py | 4 +++- demo_simple.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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')