os.chdir相对路径

2024-06-14 19:54:58 发布

您现在位置:Python中文网/ 问答频道 /正文

import os,pdb
import sys
print os.path.dirname(os.path.realpath(__file__))
pdb.set_trace()
os.chdir('../bci_framework')

输出:

D:\baseline\BCI-Comparison-Framework\bci_framework
WindowsError: (2, 'The system cannot find the file specified', '../bci_framework')

为什么?文件夹已存在!


Tags: pathimportossystraceframeworkpdbfile