Code – Folder – Error
Hey, so i want tot open a jsonl file and read from it
i have also tried with open
with open('logs/log.jsonl', 'r') as file:
data = json.load(file)
print(data[0])
or also with getting the full path, but it still didnt work
#doesnt work
dir_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(dir_path, "logs\log.jsonl"), 'r') as jsondata:
data = json.load(jsondata)
the full error:
> Traceback (most recent call last): File
> "d:MyFoldersCodepower_decosteststest_log_decorator.py", line 34,
> in <module>
> test_files_created() File "d:MyFoldersCodepower_decosteststest_log_decorator.py", line 30,
> in test_files_created
> with open('logs/log.jsonl', 'r') as file:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'logs/log.jsonl'
thanks for helping :)🙏