aioftp icon indicating copy to clipboard operation
aioftp copied to clipboard

[0.21.4] client.list returns Value Error because date format does not match on Windows

Open looopTools opened this issue 1 year ago • 1 comments

I get the following error:

ValueError: ('All parsers failed to parse', b'06-07-22  12:55PM               334976 opencv_frame_2.png\r\n', [KeyError('6-'), ValueError("time data '06-07-22 12:55PM' does not match format '%m/%d/%Y %I:%M %p'")])

I can replicate it with this simple test application.

import asyncio
import aioftp
import os 

async def test():
    client = aioftp.Client()
    await client.connect(host='127.0.0.1', port=21)
    await client.login(user=os.environ['ftpusr'], password=os.environ['ftppass'])
    l = await client.list('/')
    print(l)


if __name__ == '__main__':
    asyncio.run(test())

My suspicion is that it is because the parser expect a US date and not a european date?

looopTools avatar Dec 01 '23 09:12 looopTools

All LIST outputs are for humans, they have no standard and they will be broken somehow all the time. What you can do here:

  • Use your own parse_list_line_custom routine
  • Add code to aioftp windows parser
  • Update your ftp server to support MLSx commands family

pohmelie avatar Dec 01 '23 10:12 pohmelie