for following block receiving the error intermittently for some documents.
RuntimeError: Proxy error(ArgumentOutOfRangeException): Specified argument was out of the range of valid values. (Parameter ‘index’)
revised_doc = aw.Document(str(clean_doc_path))
revised_doc.accept_all_revisions()
# Compare and produce redlined version
# Reload to preserve original for redlining
redlined_doc = aw.Document(str(input_doc_path))
redlined_doc.accept_all_revisions()
# # redlined_doc.layout_options.revision_options.deleted_text_color = aw.layout.RevisionColor.CLASSIC_RED
# # redlined_doc.layout_options.revision_options.inserted_text_color = aw.layout.RevisionColor.BLUE
opts = aw.comparing.CompareOptions()
opts.granularity = aw.comparing.Granularity.WORD_LEVEL
opts.compare_moves = True
opts.ignore_formatting = False
opts.ignore_case_changes = False
opts.ignore_comments = False
opts.ignore_tables = False
opts.ignore_fields = False
opts.ignore_footnotes = False
opts.ignore_textboxes = False
# include header/footer TEXT changes.
opts.ignore_headers_and_footers = True
# Advanced: suppress spurious logo/shape/SDT ID churn in headers/footers
adv = opts.advanced_options
adv.ignore_dml_unique_id = True
adv.ignore_store_item_id = True
# aspose_start_time = time.time()
# Compare documents — this adds revisions to original_doc
redlined_doc.compare(
revised_doc, "Proofreading", datetime.datetime.now(), opts)
@Himanshu.Tripathi
The user is encountering an ArgumentOutOfRangeException during a document comparison operation in Aspose.Words for Python, has already tried several troubleshooting steps, and provided code and error details. This is a technical issue requiring debugging assistance.
@Himanshu.Tripathi Could you please attach your problematic input documents here for testing? We will check the issue and provide you more information.
I am afraid if I can share the documents as they sensitive in nature.
however I can share the workaround which worked but this is temporary solution and does not identify the root cause.
Also, the same files run without an error when executed outside the application (this is strange as so far 150+ files run this is the only file which is generating the error)
workaround
for i in range(revised_doc.page_count, revised_doc.page_count+1):
print("Page Number: ", i)
revised_doc_ex = revised_doc.extract_pages(0, i) # (start_index, count)
# Compare and produce redlined version
redlined_doc_ex = redlined_doc.extract_pages(0, redlined_doc.page_count) # (start_index, count)
# Compare documents — this adds revisions to original_doc
redlined_doc_ex.compare(
revised_doc_ex, "CC Assist Proofreading Service", datetime.datetime.now(), opts)
print("Completed comparison for pages 0 to ", i)
@Himanshu.Tripathi Thank you for additional information. Unfortunately, it is impossible to analyze the problem without ability to reproduce it on our side. If possible, could you please try anonymizing or simplifying the documents to make them just enough to reproduce the problem on our side?