我真傻,真的-- Lab 6报错排查(CS61B)
在写完Lab 6的代码,准备进行后面的调试的时候,运行
python3 runner.py --debug our/test02-two-part-story.in
然后就遇到了下面的报错
Traceback (most recent call last):
File "/Users/x/Learning/sp21-sss/lab6/testing/runner.py", line 444, in <module>
lib_dir = join(abspath(environ['REPO_DIR']),
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'REPO_DIR'
好吧,是REPO_DIR没有设置,那我设置吧:
export REPO_DIR="/Users/x/Learning/sp21-sss"
设置完后,仍然报错,我又试了好几次,还是不行。
???
真是奇了怪了,明明一切都满足的啊,怎么会不行呢?
我百思不得其解,于是去和ChatGPT讨论了很久,久到今天的额度都用完了,还是不知道哪里出了问题。

直到又一次失败后,提示:
python3 runner.py --debug our/test02-two-part-story.in
Your lib folder is not where we expected it. Please ensure that your directory
structure matches the following:
sp21-s***
├── library-sp21
│ └── ...
├── lab6
│ ├── capers
│ ├── testing <==== This should be your CWD
│ │ ├── runner.py
│ │ └── ...
│ └── ...
└── ...
Note your CWD must be `sp21-s***/lab6/testing`
Also check that your REPO_DIR environment variable is the path to your
`sp21-s***` directory. You can check this by running the command:
$ echo REPO_DIR
/Users/omarkhan902/cs61b/61b_sp21_stuff/sp21-s3
That's what mine looks like. Go back to lab1 if you are still having issues
看到它让我去检查Lab1 时,我突然灵光一现,不会是 Lab 2 没设置好吧?
我最近换了mac,只是克隆了我的作业仓库,还没有在IDEA里进行过Lab 2的配置。
我记得Lab 2似乎是要导入作业的库的,会不会是因为这个呢?
于是我回到了Lab 2,把库导入,然后再回来,运行,终于成功了。。。。。
我真傻,真的,我单知道设置CWD和REPO_DIR,竟然没想到 Lab 2 会影响到这里
🥹
可是这程序竟然也不提醒我😡

浙公网安备 33010602011771号