Python Scripts Won’t Perform Math – NiceLabel Problem

Audience: Advanced User
Article #: 12867


The user wants to make a custom script in Python to assign numeric values to variables within a function. They plan to use variables that are integers or floating points. However, after writing the script, mathematical equation or comparisons don’t work properly with NiceLabel variables. Simply put, the Python scripts won’t perform math.

Situation and Symptoms

  • Trying to assign numeric values to variables within a function, however no mathematical function occurs.
  • Python scripts will work when concatenating or when doing string manipulation, but will not work when variables declared within NiceLabel are used for math.


NiceLabel executes the scripts, but not as user intended, due to the fact that Python recognizes variables as text.

Example 1: A Python script that adds one to zero (0+1)

Example 2: A VBScript that also adds one to zero (0+1)

Only the VBScript performs the operation as expected:


The solution is to use VBScript when a mathematical equation or operation is required for a variable. VBScripts will perform as expected.

Additional Comments

Issue found with NiceLabel 10.

If you need further assistance, please contact us.


Was this article helpful?