kusari Submodule

Module Summary

Python functions for interacting with the NAG Kusari licence-management system.

If invoked directly as a module (i.e., using python -m naginterfaces.kusari or equivalent) this module calls lcheck() and then if a licence was unavailable either calls key_gui() if on Windows or displays the Kusari hostid otherwise.

The use of the naginterfaces package is controlled by the Kusari licence management system, version 2.2-88.

In order to enable the software, NAG will issue you with a licence key as follows. The licence key is contained in a text file consisting of details of the software that will be enabled.

For evaluation purposes a trial licence may be used.

Before obtaining a full licence you need to know the Kusari hostid of the system on which you intend to use this product. How to do this is described below.

Linux and Mac

To request a licence key, run the hostid() function.

Return the information that it displays by email to NAG.


To request a licence key, run the key_gui function. This will help you to build a standard message requesting either a trial key or a full key which can be pasted into an email to the NAG Technical Support Service. This message will include the Kusari hostid.

Run key_gui and click on the Request New Licence button to bring up the New Licence Request form. Fill in your details. Note that the value required in the Product Code box will be displayed in the diagnostic message given at the prompt. Click on Generate Licence Request, then paste the generated information into your email client and send it to the NAG address given at the top of the generated information.

If for any reason it is impractical to use this GUI licence request generator, please contact NAG for information on alternative command-line access to the licensing utilities.

See Technical Support for information on contacting the NAG Technical Support Service.

The NAG support team will send you the Kusari licence key by email.

A short term (demonstration or trial) licence key contains one or more lines like the following:


Specifically, it has a line containing the word TRIAL.

Longer term licence keys must be locked to a specific computer, i.e. they will enable the software on one computer only.

These licence keys typically include the word NODE or FULL instead of the word TRIAL above and may contain extra fields.

Once you have obtained one of the above licence keys it can be installed as follows.

Linux and Mac

The easiest way to install the key is to store the text in a file,






The licence software in this product automatically looks for these particular files and reads the first one found, so no further action is necessary.

Alternatively, store the licence in a file with a name and location of your choice, say,


The location of the licence file, if it is not one of the default places listed above, must be made known to the NAG application by setting the environment variable NAG_KUSARI_FILE to the full pathname of the file before the application is invoked.

For example, in the C shell, type:

setenv NAG_KUSARI_FILE [INSTALL_DIR]/licence.lic

or in the Bourne shell, type:



Once you have obtained one of the above licence keys, the key_gui function may be used to install the key in the Windows Registry. Paste the key into the edit box on the main dialog and then click on the Install Licence Key button to install it.


Further details about Kusari and how it may be configured to suit your local circumstances (e.g. how to install the licence key on a server) are online at



Display the Kusari hostid and NAG Library product code.

The underlying khostid utility is run via the subprocess module.


>>> from naginterfaces.kusari import hostid
>>> hostid()
NAG Library product code = ...

Run the Kusari key GUI if licence managed and on Windows, otherwise do nothing.

The underlying kusari_key_gui.exe is run via the subprocess module.


Display availability of a NAG licence.

The underlying klcheck utility is run via the subprocess module.

quiet : bool, optional

If True a brief summary is printed, otherwise extended details of how the licence was located are also given.


>>> from naginterfaces.kusari import lcheck
>>> lcheck(quiet=True)
Licence available; ...