dir_path = os.path.dirname(os.path.realpath(__file__))
from os.path import isfile, join
onlyfiles = [f for f in listdir(dir_path) if isfile(join(dir_path, f))]
print(onlyfiles);
with open("config.json", 'r') as jsondata:
config = json.loads(jsondata.read())
をdoesntの言う、何とか、ここでファイルがなく、開く存在することは、このコードを実行する
print(onlyfiles);
中にリストされたファイルにもかかわらず、非既存のエラーをトリガすることは、コンソールからフル出力ログです。
Traceback (most recent call last):
['builder.py', 'builder.spec', 'builderloader2.rb', 'config.json',
'Run.bat', 'Run.bat.lnk', 'test.json']
File "C:/Users/cody.jones/Desktop/Builder Generator Release/builder.py",
line 26, in <module>
with open("config.json", 'r') as jsondata:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'
Process finished with exit code 1
[File Not Found Error in Python]の可能な複製(https://stackoverflow.com/questions/17658856/file-not-found-error-in-python) – tripleee