'PosixPath' object has no attribute 'size'

I’m stuck with this error, i’m trying to rewrite the code and run in vscode, can someone please help me