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