Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

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

Open
JCCER opened this issue Apr 7, 2022 · 0 comments
Open

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

JCCER opened this issue Apr 7, 2022 · 0 comments

Comments

@JCCER
Copy link

JCCER commented Apr 7, 2022

本地运行,直接在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:
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant