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: /vol/cvsroot/parser/examples/test_python/config_license.py,v $ #
#     $Author: neilr $                                                      #
#       $Date: 2016/03/17 16:47:32 $                                         #
#   $Revision: 1.2 $                                                         #
# $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 © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50