def generate_log(dirname, log_object):
print(os.path.dirname(__file__),'dfsdfds')
print(os.listdir())
for smell in log_object:
log = open("../../output/logs/{}_logs".format(smell), "w")
for elem in log_object[smell]:
log.write('filename: {}, smelly_lines: {}, metric: {}\n'.format(elem['filename'], str(elem['lineno']), str(elem['metric'])))
我的函数尝试将一些登录信息写入目录output/logs/
我正在调用此函数的目录是C:\Users\user\Desktop\proj\src\Detector
。由于我希望在output
(这是我的项目根目录)中生成/proj
目录,因此我想这样做../../
可以,但是它给了我
log = open("../../output/logs/{}_logs".format(smell), "w")
FileNotFoundError: [Errno 2] No such file or directory: '../../output/logs/long_method_logs'
有什么我可以解决的吗?