I
I
Ivan2018-04-18 20:29:35
Python
Ivan, 2018-04-18 20:29:35

Why can't he see the .json files in the c .ipynb folder?

We have: -
the main working jupyter notebook which lies in a certain folder.
-next to the same folder is .json from where you need to pick up the data.
when contacting:

def jsonRead (jsonPth):
    try:
        with open(jsonPth, 'r', encoding='utf-8') as fh:
            information = json.load(fh)
            return information
    except (IOError, Exception) as e:
        print(e)
information = jsonRead("полный правильный путь до файла(или относительный)")

Outputs:
[Errno 2] No such file or directory:
I move .json to another folder (higher than the one with .ipynb - everything is OK, json is readable.
what to google? how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iSergios, 2018-04-19
@iSergios

what to google?

How is the path to the directory from which the script is run determined?
The same question, but if there is __init__.py in the directory?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question