Update file.py

Moving the changes rejected from 1699 into 1714