clalancette / pycdlib

Python library to read and write ISOs
GNU Lesser General Public License v2.1
147 stars 38 forks source link

Reading json from iso file #119

Open elungu3 opened 11 months ago

elungu3 commented 11 months ago

Hello @clalancette , @zekaizer , @ticky , I've been trying to read/load data from a json within an iso file. Using listchildren method I can see that the file is there, but I cannot do any operation on it. I've been trying to use some of your examples:

with iso.open_file_from_iso(iso_path='/myfile.json') as infp: json_data = json.loads(infp)

Assuming the JSON data is in UTF-8 encoding

json_content = json_data.decode('utf-8')
print(json_content)

iso.close()

but I get: pycdlib.pycdlibexception.PyCdlibInvalidInput: Could not find path even tho if I extract files from the iso I have myfile.json in the root.

As extra info, I have an iso file that has 3 files within, one of them being a json file from which I need to extract data without extract all the files if possible.

Please advise :(