Update file.py

fixed the Issue #7312