View difference between Paste ID: bgqdps7b and KgjNtyDV
SHOW: | | - or go back to the newest paste.
1-
import os
1+
PS E:\> python getDirSize.py
2-
import sys
2+
running on dir "."
3-
3+
Traceback (most recent call last):
4-
def get_size(start_path = '.'):
4+
  File "getDirSize.py", line 31, in <module>
5-
    total_size = 0
5+
    listContents();
6-
    for dirpath, dirnames, filenames in os.walk(start_path):
6+
  File "getDirSize.py", line 23, in listContents
7-
        for f in filenames:
7+
    f.write(c)
8-
            fp = os.path.join(dirpath, f)
8+
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", line 19, in encode
9-
            total_size += os.path.getsize(fp)
9+
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
10-
10+
UnicodeEncodeError: 'charmap' codec can't encode characters in position 11-21: character maps to <undefined>