Check enabling fileinfo attributes on Windows - (FileInfo object has no attribute XXX error)
hakaishi opened this issue · 6 comments
hakaishi commented
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))
hakaishi commented
No such trouble under Ubuntu (python 3.8.5 though)
pkittenis commented
Only st_size
and st_mode
are supported by libssh2 on Windows due to Windows limitations.
hakaishi commented
okay... paramiko does not have this limitation.
hakaishi commented
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?
pkittenis commented
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.