# UnboundLocalError: local variable 'timeInSeconds' referenced before assignment

**URL:** <https://forums.developer.nvidia.com/t/unboundlocalerror-local-variable-timeinseconds-referenced-before-assignment/211819>\
**Category:** cuOpt\
**Created:** [April 20, 2022, 11:37am UTC](https://forums.developer.nvidia.com/t/unboundlocalerror-local-variable-timeinseconds-referenced-before-assignment/211819 "2022-04-20T11:37:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivam.mehta](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@shivam.mehta](https://forums.developer.nvidia.com/u/shivam.mehta)\
**Post date:** [April 20, 2022, 11:37am UTC](https://forums.developer.nvidia.com/t/unboundlocalerror-local-variable-timeinseconds-referenced-before-assignment/211819/1 "2022-04-20T11:37:38Z")

</div>

![image](https://global.discourse-cdn.com/nvidia/original/3X/0/4/04c9b1faeb3a85ab051504ecce23d66e7cc524c7.png)

Hello, when i tried to Mark nodes and find paths using veroviz, I got this error

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/4/d/4da640f95fe5d2709a230e3c8034e102079e4bdb.png)

---

<div class="post-metadata">

**Author:** ![gattingmk](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gattingmk](https://forums.developer.nvidia.com/u/gattingmk)\
**Post date:** [February 6, 2023, 4:54am UTC](https://forums.developer.nvidia.com/t/unboundlocalerror-local-variable-timeinseconds-referenced-before-assignment/211819/2 "2023-02-06T04:54:55Z")

</div>

The “UnboundLocalError: local variable referenced before assignment” error occurs in Python when you try to access a local variable before it has been assigned a value. This is typically caused by a typo, or by using the same name for a local variable and a [global variable](http://net-informations.com/python/iq/global.htm) in the same scope or when you forget to assign a value to a local variable before using it.

```auto
    x = x + 1
    print(x) // This code will result in the error

```

to solve this…

```auto
    x = 0 //assign a value to the local variable
    x = x + 1
    print(x)

```

To resolve the “UnboundLocalError: local variable referenced before assignment” error, you need to assign a value to the local variable before you use it. Another way to resolve this error is to use the global keyword to access the global variable with the same name.
