[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:
parent
18aaff8521
commit
29a5381ba1
4
demo.py
4
demo.py
|
@ -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')
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue