pycdlib
pycdlib copied to clipboard
Invalid padding on ISO Error
Hi clalancette,
Thanks for creating this project. It works great on Linux ISOs!
I am trying to use it to add files and directories on Windows ISOs using the examples. I tested on Windows Server 2019 evaluation ISO.
Here is the code for creating an ISO using an existing ISO (argv[1]
is the original ISO name and argv[2]
is the output ISO name):
import sys
import pycdlib
iso = pycdlib.PyCdlib()
iso.open(sys.argv[1])
iso.add_directory(iso_path='/DIR1')
iso.write(sys.argv[2])
iso.close()
Here is the code read.py
to read the created ISO:
import sys
import pycdlib
iso = pycdlib.PyCdlib()
iso.open(sys.argv[1])
for child in iso.list_children(iso_path='/'):
print(child.file_identifier())
iso.close()
When I run the read code on the newly generated ISO I get the error:
Traceback (most recent call last):
File "read.py", line 5, in <module>
iso.open(sys.argv[1])
File "/home/h4xhor/venv/lib/python3.8/site-packages/pycdlib/pycdlib.py", line 4143, in open
self._open_fp(fp)
File "/home/h4xhor/venv/lib/python3.8/site-packages/pycdlib/pycdlib.py", line 2337, in _open_fp
ic_level, lastbyte = self._walk_directories(self.pvd, extent_to_ptr,
File "/home/h4xhor/venv/lib/python3.8/site-packages/pycdlib/pycdlib.py", line 1043, in _walk_directories
raise pycdlibexception.PyCdlibInvalidISO('Invalid padding on ISO')
pycdlib.pycdlibexception.PyCdlibInvalidISO: Invalid padding on ISO
I also noticed that the DIR1
is not there when I mount the new ISO.
May you please tell me what I'm doing wrong?
Hm, that's weird. That should just work. I'll give it a try if I can get my hands on a Windows ISO.
We can get evaluation versions of Windows. I think the current place to get them is from Windows Server 2019.