Python Software Licensing

Hello World

To add license checking to a Python application you import the Licensing.py file into your application. You can then call the checkLicense function by calling Init to load the license information and check that the user has a valid license. You need to specify a folder location for the license file and the license key issued to the user.

import AppConfig
import Licensing

AppConfig.Init('.')
key = AppConfig.Get('License', 'Key')
Licensing.Init('.', key)
if not Licensing.IsLicensed():
    print 'Application not licensed: ' + Licensing.GetLicensingMsg()
    exit(1)

print('Hello World!');

Building the Example

The library download includes a Python example application showing the use of the software licensing library with the developer password for the free test drive environment. Download the Nuvovis package for Windows from the settings page and extract it to a work folder. Browse to the python/HelloWorld folder and open and run the HelloWorld.py file.

Creating a License

The example cannot run until we have created a license for the application. In the web portal click on the New button to create a new Software License. Change the client field to one of the customer names and the product name to "Hello World". Save the new license to store the new license in Genux-B. The new Software License will now have a License Key field value. In the folder where the executable was written open the HelloWorld.ini file with a text editor and copy and paste the license key into the ini file and save the file.

Now our application is licensed and we can use it. After running the test application use the web portal to see that the license has been used by clicking on the license id link in the license list view for the new Software License.