if os.path.exists(FolderPath) == False:
print FolderPath, 'Path does not exist, ending script.'
quit()
if os.path.isfile(os.path.join(FolderPath,GILTS)) == False:
print os.path.join(FolderPath,GILTS), ' file does not exist, ending script.'
quit()
df_gilts = pd.read_csv(os.path.join(FolderPath,GILTS))
Stangely的是,当该路径/文件不存在,我得到下面的打印:
IOError: File G:\On-shoring Project\mCPPI\Reconciliation Tool\Reconciliation Tool Project\3. Python\BootStrap\BBG\2017-07-16\RAW_gilts.csv does not exist
告诉我,即使我已经添加了一个quit(),它仍然继续使用该脚本。谁能告诉我为什么?
由于
你检查'FolderPath'存在,但随后访问'和'在结束FILTS' FolderPath' - 不完整路径存在吗? –
'quit()'不是一个内置的Python函数。你有没有定义它? –
@DanielRoseman是的它是 –