10/25/15

Clean pyc file from python project


How do I remove all .pyc files from a project?

find . -name '*.pyc' -delete

You can use Flask-Script:
# manage.py
from flask.ext.script import Manager
from myapp import app

manager = Manager(app)

@manager.command
def clearpyc():
    os.system('find . -name \'*.pyc\' -delete')

if __name__ == "__main__":
    manager.run()


1 comment: