Skip to content

Check enabling fileinfo attributes on Windows - (FileInfo object has no attribute XXX error) #131

Closed

Description

@hakaishi

OS: Windows 10 64 bit
Python: 3.8.4 (64 bit)
ssh2-python: 0.23.0
Code snippet:

res = connection.session.scp_recv2(file)
print(res[1], dir(res[1]))
with open(join(destination_, file_), "wb+") as f:
    size = 0
    while True:
        siz, tbuff = res[0].read()
        if siz < 0:
            print("error code:", siz)
            res[0].close()
            break
        size += siz
        if size > res[1].st_size:
            sz = res[1].st_size - size
            f.write(tbuff[:sz])
        else:
            f.write(tbuff)
        if size >= res[1].st_size:
            res[0].close()
            break
utime(join(destination_, file_), (res[1].st_atime, res[1].st_mtime))

print result:
image

Activity

  1. hakaishi commented on Nov 6, 2020

    @hakaishi
    Author

    No such trouble under Ubuntu (python 3.8.5 though)

  2. pkittenis commented on Nov 8, 2020

    @pkittenis
    Member

    Only st_size and st_mode are supported by libssh2 on Windows due to Windows limitations.

  3. hakaishi commented on Nov 8, 2020

    @hakaishi
    Author

    okay... paramiko does not have this limitation.

  4. hakaishi commented on Nov 8, 2020

    @hakaishi
    Author

    Are you speaking generally?
    SSH2 does support it using SFTP.
    Using stat/fstat gives me atime/mtime etc even under Windows.

    No one seems to mention that SSH2 does not support mtime etc. when running on Windows, are you really sure about this?

  5. changed the title [-]Windows - FileInfo object has no attribute XXX error[/-] [+]Check enabling fileinfo attributes on Windows - (FileInfo object has no attribute XXX error)[/+] on Dec 1, 2020
  6. pkittenis commented on Dec 1, 2020

    @pkittenis
    Member

    If I recall correctly the compiler on windows did not understand the types libssh2 uses for those attributes. This may have been an old compiler for python 2.

    Needs retesting on windows.

  7. pkittenis commented on Jan 2, 2021

    @pkittenis
    Member

    Resolved by #142
    In 0.26.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions