[Python] How do you import json files to Blender?

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am Following Chris P's 'Visualize Real-world JSON Data in Blender (3D Chart Animation Nodes Tutorial)' on YouTube but I seem to have got stuck at the first hurdle of importing the data. I have followed his instructions completely and am unsure why the script keeps failing. I have attached his script, My script, my file location, my error message and a snap shot of his video. I am On windows OS, he is on Linux I'menter image description here not sure if that makes a difference. Here is the link to the video: https://www.youtube.com/watch?v=0aRjInmibSw&t=1055s THE TIMESTAMP FOR HIS CODE IS 6 min.

    FILE NAME: Export.json

    MY FILE LOCATION: C:\Users\Jordan\Downloads

    MY CODE

    import json

    with open(r'C:/Users/Jordan/Downloads/Export.json','r') as f:
    j=json.load(f)
    print (j)


    MY ERROR MESSAGE:

    Traceback (most recent call last):
    File "D:\Mixed Graphs\Blender json\3D Charts.blend\My Script", line 3, in <module>
    OSError: [Errno 22] Invalid argument: '/C:/Users/Jordan/Downloads/Export'
    Error: Python script failed, check the message in the system console


    HIS CODE:

    import json

    with open('/Home/chris/downloads/tutorial1.json') as f:
    json.load(f)
    print (j)

    Continue reading...

Compartilhe esta Página