[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.
This commit is contained in:
Robey Pointer 2005-04-18 00:11:34 +00:00
parent 18aaff8521
commit 29a5381ba1
2 changed files with 6 additions and 2 deletions

View File

@ -25,7 +25,9 @@ import paramiko
##### utility functions ##### utility functions
def load_host_keys(): 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 = {} keys = {}
try: try:
f = open(filename, 'r') f = open(filename, 'r')

View File

@ -25,7 +25,9 @@ import paramiko
##### utility functions ##### utility functions
def load_host_keys(): 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 = {} keys = {}
try: try:
f = open(filename, 'r') f = open(filename, 'r')