GroupDocs.Comparison for Python via .NET runs in evaluation mode out of the box. To unlock the full feature set, apply a license at the start of your application.
You can try GroupDocs.Comparison without buying a license. The evaluation build is the same as the licensed build — applying a license simply removes the trial restrictions.
Evaluation mode limitations
Only the first two pages of each document are processed.
Trial badges are stamped on the top of every output page.
30-day temporary license
For unrestricted evaluation, request a free 30-day temporary license.
How to set a license
Note
The license should be set once per process, before any other GroupDocs.Comparison class is used. Calling set_license() multiple times in the same process is harmless but wasteful — subsequent calls are no-ops.
Set license from a file
The example guards the call with an os.path.exists check so the script fails loudly when the license file is missing instead of raising an opaque runtime error from the .NET layer.
importosfromgroupdocs.comparisonimportLicensedefset_license_from_file():# Absolute path to the license filelicense_path=os.path.abspath("./GroupDocs.Comparison.Python.lic")ifnotos.path.exists(license_path):print(f"License file not found: {license_path}")print("Place a valid .lic file at that path or set GROUPDOCS_LIC_PATH.")return# Instantiate License and apply the filelicense=License()license.set_license(license_path)print(f"License applied from: {license_path}")if__name__=="__main__":set_license_from_file()
Set license from a stream
Same existence guard — if the .lic file isn’t there, the script exits cleanly with a human-readable message instead of failing inside the stream-open call.
importosfromgroupdocs.comparisonimportLicensedefset_license_from_stream():# Absolute path to the license filelicense_path=os.path.abspath("./GroupDocs.Comparison.Python.lic")ifnotos.path.exists(license_path):print(f"License file not found: {license_path}")print("Place a valid .lic file at that path or set GROUPDOCS_LIC_PATH.")return# Open the license file as a binary stream and apply itwithopen(license_path,"rb")aslicense_stream:license=License()license.set_license(license_stream)print(f"License applied from stream: {license_path}")if__name__=="__main__":set_license_from_stream()
Set license from the GROUPDOCS_LIC_PATH environment variable
For applications that should pick up a license without code changes, set GROUPDOCS_LIC_PATH and load it explicitly at startup:
importosfromgroupdocs.comparisonimportLicensedefapply_license_from_env():lic_path=os.environ.get("GROUPDOCS_LIC_PATH")ifnotlic_path:print("GROUPDOCS_LIC_PATH is not set — running in evaluation mode.")returnifnotos.path.isfile(lic_path):print(f"GROUPDOCS_LIC_PATH points at a missing file: {lic_path}")returnLicense().set_license(lic_path)print(f"License applied from: {lic_path}")if__name__=="__main__":apply_license_from_env()
Metered license
A metered license is an alternative usage-based licensing model: you are billed on the volume of data processed rather than per developer. See the metered licensing FAQ for details.
Replace the placeholder public_key and private_key values with the credentials issued to you — the example guards against the placeholder values and exits with a message if they haven’t been edited:
fromgroupdocs.comparisonimportMeteredPLACEHOLDER="*****"defset_metered_license():# Set your public and private metered keyspublic_key=PLACEHOLDERprivate_key=PLACEHOLDERifpublic_key==PLACEHOLDERorprivate_key==PLACEHOLDER:print("Metered keys must be set before running this example.")print("Edit public_key and private_key with the credentials from")print("https://purchase.groupdocs.com/ to enable metered licensing.")return# Instantiate Metered and apply the keysmetered=Metered()metered.set_metered_key(public_key,private_key)# Inspect usage so farmb_processed=metered.get_consumption_quantity()credits_used=metered.get_consumption_credit()print(f"MB processed: {mb_processed}")print(f"Credits used: {credits_used}")if__name__=="__main__":set_metered_license()
Pricing
Pricing information for GroupDocs.Comparison subscriptions is available at the pricing page.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.