Python: corrected a crash when python file failed to load