Added duplicate call to fileConfig() to ensure that it cleans up after itself correctly.
[python.git] / PCbuild8 / rmpyc.py
blob43c8576e798d9ee3901d93c8a0e8b22634898593
1 # Remove all the .pyc and .pyo files under ../Lib.
4 def deltree(root):
5 import os
6 from os.path import join
8 npyc = npyo = 0
9 for root, dirs, files in os.walk(root):
10 for name in files:
11 delete = False
12 if name.endswith('.pyc'):
13 delete = True
14 npyc += 1
15 elif name.endswith('.pyo'):
16 delete = True
17 npyo += 1
19 if delete:
20 os.remove(join(root, name))
22 return npyc, npyo
24 npyc, npyo = deltree("../Lib")
25 print npyc, ".pyc deleted,", npyo, ".pyo deleted"