[Python] Paramiko PKey.from_private_key_file gives me "__init__() got an unexpected keyword...

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I get very weird behaviour from paramiko:

    bla=paramiko.pkey.PKey(msg=None,data=None).from_private_key_file()


    TypeError Traceback (most recent call last)
    <ipython-input-32-13288f655ecf> in <module>
    ----> 1 paramiko.pkey.PKey(msg=None,data=None).from_private_key_file()

    TypeError: from_private_key_file() missing 1 required positional argument: 'filename'


    here it tells me I need a filename, but then whenever I try to specify anything:

    bla=paramiko.pkey.PKey(msg=None,data=None).from_private_key_file('key')


    Traceback (most recent call last)
    <ipython-input-33-5fa0cf9b6317> in <module>
    ----> 1 bla=paramiko.pkey.PKey(msg=None,data=None).from_private_key_file('key')

    ~/anaconda3/lib/python3.7/site-packages/paramiko/pkey.py in from_private_key_file(cls, filename, password)
    233 :raises: `.SSHException` -- if the key file is invalid
    234 """
    --> 235 key = cls(filename=filename, password=password)
    236 return key
    237

    TypeError: __init__() got an unexpected keyword argument 'filename'


    Can anyone explain to me what's happening? I'm completely confused.

    Continue reading...

Compartilhe esta Página