pymssql.Connection - работает на одной машине, но не на другой - PullRequest
0 голосов
/ 08 ноября 2019

Вот мой код:

self.cnopts = pysftp.CnOpts()
self.cnopts.hostkeys = None
with pysftp.Connection(host=myhostname,
                       username=myusername,
                       password=mypassword,
                       cnopts=self.cnopts) as sftp:
    directory_structure = sftp.listdir_attr()
    for attr in directory_structure:
        if(attr.filename.startswith("DEAL") and attr.filename.endswith(".csv")):
            print(attr.filename)

Я получаю сообщение об ошибке на pysftp.Connection:

Ошибка аутентификации

Итак, япопробовал это также:

with pysftp.Connection(host=myhostname,
                           username=myusername,
                           password=mypassword) as sftp:
        directory_structure = sftp.listdir_attr()
        for attr in directory_structure:
            if(attr.filename.startswith("DEAL") and attr.filename.endswith(".csv")):
                print(attr.filename)

С вышеупомянутым я получаю сообщение об ошибке:

Не найден ключ хоста для хоста myhostname

Вопросы:(1) Почему ищет SSHkey, когда он мне действительно не нужен (2) Почему оба кода работают на моей локальной машине, но не работают, когда я помещаю его на удаленный сервер

...