1
$\begingroup$

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

FILE NAME: Export.json

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

MY CODE:

import json

with open('/C:/Users/Jordan/Downloads/Export.json') as f: 
    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) 
$\endgroup$
5
  • $\begingroup$ Remove the slash before the drive "C:/Users/Jordan/..." See stackoverflow.com/questions/2953834/windows-path-in-python $\endgroup$
    – batFINGER
    Nov 5, 2020 at 16:10
  • $\begingroup$ Thank you for responding so quickly, but unfortunately even with it taken off it displays the same error. $\endgroup$ Nov 5, 2020 at 16:16
  • $\begingroup$ As the question is, even thought it is for blender, is currently a python IO issue. See stackoverflow.com/questions/25584124/… (Next error will be undefined variable j, is it j = json.load(...) ? A link to the video would help too. $\endgroup$
    – batFINGER
    Nov 5, 2020 at 16:28
  • $\begingroup$ Took your advice for the link, I've put it up there now. Ill have to go over there and look then, thank you for the sign-posting! $\endgroup$ Nov 5, 2020 at 16:40
  • $\begingroup$ For anyone who is interested I seem to have solved it. I'm unsure if it was 1. opening the json file in notepad which changed its file type from some adobe application to .json for some reason? (almost certainly it) 2. Adding import bpy before the rest of the import code. 3. Some glaring error that none of us spotted. Although I'm now having trouble trying with some .csv data and am having a similar problem haha!!! All a learning experience I suppose! Thank you all for the speedy attempts at helping though!!!!! $\endgroup$ Nov 7, 2020 at 16:26

0

You must log in to answer this question.

Browse other questions tagged .