# getUser() function scope?

**URL:** <https://forum.inductiveautomation.com/t/getuser-function-scope/62959>\
**Category:** General Discussion\
**Tags:** perspective, scripting, ignition81\
**Created:** [August 12, 2022, 4:16pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959 "2022-08-12T16:16:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [August 12, 2022, 4:16pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/1 "2022-08-12T16:16:09Z")

</div>

![getUser_Console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7d730cb61065fff350fdbf51f4ba7b45b5c6ad72.png)  
 ![getUser_Gateway](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/9/59012d40d050251cbdeba2fa43a37bc42c2c3936.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 12, 2022, 4:17pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/2 "2022-08-12T16:17:53Z")

</div>

You may need an additional `except` clause:

```auto
except java.lang.Exception, e:

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 12, 2022, 4:19pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/3 "2022-08-12T16:19:36Z")

</div>

It’s almost certainly failing because a gateway tag change script has no concept of a ‘default user source’, so attempting to use the empty string parameter is failing.

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [August 12, 2022, 4:29pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/4 "2022-08-12T16:29:13Z")

</div>

What value should I pass as the `userSource`?

Perhaps I should ask, where do I look to know what the `userSource` should be?

Looking at the documentation for `getUser()` . . .

[https://docs.inductiveautomation.com/display/DOC81/system.user.getUser](https://docs.inductiveautomation.com/display/DOC81/system.user.getUser)

in regards to `userSource`, it only says `String userSource - The name of the user source to search for the user in . . .`

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [August 12, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/5 "2022-08-12T16:42:22Z")

</div>

OK I found it, in the Gateway. In my case it was ‘default’, passed as the `userSource`, this worked. Thanks for the info. .

 ![getUser_Default](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c2b1bab0648fe1356cd512d7d8c9b9f899d2438.png)

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [August 12, 2022, 4:52pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/6 "2022-08-12T16:52:34Z")

</div>

> [@Kevin.Herron](#):
>
> `except java.lang.Exception, e:`

I'm going to try your suggestion too. Thanks for mentioning that. I've been stumped several times in the past where scripts just terminate without triggering the error handlers. It's as if nothing happened and nothing is brought to anyone's attention until users notice odd behavior.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 12, 2022, 4:57pm UTC](https://forum.inductiveautomation.com/t/getuser-function-scope/62959/7 "2022-08-12T16:57:21Z")

</div>

> [@Catch IOException?](https://forum.inductiveautomation.com/t/catch-ioexception/18612/3):
>
> Consider using two except blocks, as jython’s standard Exception won’t catch pure java exceptions. Like so: import java.lang.Exception try: # something something something except Exception, e: # jython exception except java.lang.Exception, e: # java exception
