I'm using ftputil 5.0.4 with Python 3.7 on Windows. I am getting an
unhandled ftputil.error.ParserError with host.walk. Probably the FTP
server doing something weird (or a corrupt file or something). But the
walk interface shouldn't fail on this error (imho).
Suggest changing line 1031 in host.py to:
except (ftputil.error.FTPOSError, ftputil.error.ParserError) as err:
This fixes the error for me.
Hi Simon,
On 2022-09-01 11:51, Simon Cox wrote:
> I'm using ftputil 5.0.4 with Python 3.7 on Windows. I am getting an
> unhandled ftputil.error.ParserError with host.walk. Probably the FTP
> server doing something weird (or a corrupt file or something). But the
> walk interface shouldn't fail on this error (imho).
>
> Suggest changing line 1031 in host.py to:
>
> except (ftputil.error.FTPOSError, ftputil.error.ParserError) as err:
>
> This fixes the error for me.
Thank you for the heads up and the patch. :-)
I'd be curious what the actual directory listing line from
the server is that causes the error. At the moment I think
it would make more sense to fix/extend the directory listing
parser in
https://git.sr.ht/~sschwarzer/ftputil/tree/main/item/ftputil/stat.py
instead of just ignoring the error. (Also, your patch would
skip all lines that follow the problematic line and maybe
you want to include at least these in your `walk` result.)
Can you send the actual traceback to the list? If the
traceback isn't enough to understand the parser error, it
might help to print the line at the beginning of the
`parse_line` method,
https://git.sr.ht/~sschwarzer/ftputil/tree/main/item/ftputil/stat.py#L444
or
https://git.sr.ht/~sschwarzer/ftputil/tree/main/item/ftputil/stat.py#L528 ,
depending on which parser is selected, and send this line in
the mail, too.
Best regards,
Stefan