NeteaseCloudMusicTasks icon indicating copy to clipboard operation
NeteaseCloudMusicTasks copied to clipboard

[Errno 2] No such file or directory: 'config.json'

Open JCCER opened this issue 3 years ago • 0 comments

本地运行,直接在index.py目录下运行是没问题的,但如果这样python3 /home/xxxx/netease/index.py 就不行了

Traceback (most recent call last):
  File "/home/xxxx/netease/index.py", line 159, in <module>
    start()
  File "/home/xxxx/netease/index.py", line 52, in start
    with open('config.json', 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

小改了一下index.py

path = os.path.dirname(os.path.realpath(__file__))
config_Path = f"{path}/config.json"

def start(event={}, context={}):
    with open(config_Path, 'r', encoding='utf-8') as f:

JCCER avatar Apr 07 '22 01:04 JCCER