Matrix Science header

config_license.py

Read in the mascot.license file.

#!/usr/bin/python
##############################################################################
# file: config_license.py                                                    #
# 'msparser' toolkit example code                                            #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: parser/examples/test_python/config_license.py $ #
#     $Author: villek@matrixscience.com $                                                      #
#       $Date: 2018-07-30 16:23:53 +0100 $                                         #
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $                                                         #
# $NoKeywords::                                                            $ #
##############################################################################

import msparser
import sys

if len(sys.argv) < 2 :
    print("Location of 'mascot.license' file has to be specified as a parameter")
    sys.exit(1)

file = msparser.ms_license(sys.argv[1])

if not file.isValid() :
    print("There are errors. Cannot continue. The last error description:")
    print(file.getLastErrorString())
    sys.exit(1)

if file.isLicenseValid() :
    print("Mascot license is still valid. Other information:")
    print(file.getLicenseString())
else :
    print("Mascot license has either expired or been corrupted")


"""

Running the program as 

python config_license.pl mascot.license

will give, without a Mascot license file:


There are errors. Cannot continue. The last error description:
Missing license file: mascot.license.

"""


Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29