Showing results for 
Search instead for 
Did you mean: 
70 Views json file dump problem



I was trying to get the "smart_classroom_sample" working.

According to the instructions here, the user needs to provide a set of face images as references for the person identification. Then the script listed under \inference_engine\samples\smart_classroom_sample needs to be run to create a file called faces_gallery.json.

I observed that the *.json file was not created even though the script seemed top work as expected. When I debugged the script a bit more, I noticed that the json dump was not working due to a path error for some reason (I don't actually know why it does not work)

I modified the end of the script as follows which creates the json file in the same folder as the script (which I think was the intention)

scriptFilePath = os.path.realpath(__file__)   # this returns the full file path
scriptPath = os.path.dirname(os.path.abspath(scriptFilePath))  # this removes the file name from the path

with open(scriptPath + '\\faces_gallery.json', 'w') as outfile:
    json.dump(objects, outfile)

I hope the above will be useful for anyone who came across the same problem.


0 Kudos
2 Replies

Hi Charaw,

There shouldn't be any issues with generating the files other than permissions on creation of the file. I've tested this in the root directory where sudo was needed and in the home directory where sudo wasn't needed and both test generated the .json file. What directory are you calling the from?

Kind Regards,

Monique Jones



Hi Monique,

Thanks for your message. I am a Windows user therefore sudo does not apply in my particular case.

I tried to run the script via Windows command prompt (with and without admin privileges) while under \inference_engine\samples\smart_classroom_sample and this did not work. It appears that the json dump needs the absolute path to work.