We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please add example on how to add actual files to an image
a naive attempt fails with ValueError: seek of closed file
ValueError: seek of closed file
input_paths = ["test.txt"] output_path = "test.iso" iso = pycdlib.PyCdlib() iso.new(udf="2.60") for input_path in input_paths: size = os.path.getsize(input_path) iso_path = "/" + input_path udf_path = "/" + input_path with open(input_path, "rb") as file_handle: iso.add_fp(file_handle, size, iso_path, udf_path=udf_path) iso.write(output_path) # ValueError: seek of closed file iso.close()
fixed version:
output_path = "test.iso" iso = pycdlib.PyCdlib() iso.new(udf="2.60") +file_handles = [] for input_path in input_paths: size = os.path.getsize(input_path) iso_path = "/" + input_path udf_path = "/" + input_path - with open(input_path, "rb") as file_handle: - iso.add_fp(file_handle, size, iso_path, udf_path=udf_path) + file_handle = open(input_path, "rb") + iso.add_fp(file_handle, size, iso_path, udf_path=udf_path) + file_handles.append(file_handle) iso.write(output_path) iso.close() +for file_handle in file_handles: + file_handle.close()
input_paths = ["test.txt"] output_path = "test.iso" iso = pycdlib.PyCdlib() iso.new(udf="2.60") file_handles = [] for input_path in input_paths: size = os.path.getsize(input_path) iso_path = "/" + input_path udf_path = "/" + input_path file_handle = open(input_path, "rb") iso.add_fp(file_handle, size, iso_path, udf_path=udf_path) file_handles.append(file_handle) iso.write(output_path) iso.close() for file_handle in file_handles: file_handle.close()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
please add example on how to add actual files to an image
a naive attempt fails with
ValueError: seek of closed file
fixed version:
The text was updated successfully, but these errors were encountered: