View difference between Paste ID: BVpH4QR9 and msgpDb0P
SHOW: | | - or go back to the newest paste.
1-
import os
1+
PS E:\> python getDirSize06.py
2-
import sys
2+
running on dir "."
3-
3+
Traceback (most recent call last):
4-
def get_size(start_path = '.'):
4+
  File "getDirSize06.py", line 31, in <module>
5-
    total_size = 0
5+
    listContents();
6-
    for dirpath, dirnames, filenames in os.walk(start_path):
6+
  File "getDirSize06.py", line 23, in listContents
7-
        for f in filenames:
7+
    f.write(str(c.encode('utf8')))
8-
            fp = os.path.join(dirpath, f)
8+
TypeError: a bytes-like object is required, not 'str'
9-
            total_size += os.path.getsize(fp)
9+
PS E:\>