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

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

Description

@JCCER

本地运行,直接在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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions