# Plex python errors

**URL:** <https://forums.plex.tv/t/plex-python-errors/746656>\
**Category:** Dev/API Corner\
**Tags:** scanner-agent-dev\
**Created:** [September 28, 2021, 5:34pm UTC](https://forums.plex.tv/t/plex-python-errors/746656 "2021-09-28T17:34:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jelwell](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jelwell](https://forums.plex.tv/u/jelwell)\
**Post date:** [September 28, 2021, 5:34pm UTC](https://forums.plex.tv/t/plex-python-errors/746656/1 "2021-09-28T17:34:33Z")

</div>

I’m trying to use the inbuilt python function sum() in my plex agent. I’m on a Mac.  
[https://docs.python.org/2.7/library/functions.html#sum](https://docs.python.org/2.7/library/functions.html#sum)

But I get the following error:

> NameError: name ‘sum’ is not defined

I output the version of Python used by plex.

> 2.7.17

I’m a bit surprised that plex is stuck on 2.7 given it EOL’d in 2020 and security fixes aren’t even available for it anymore.

Not sure why the inbuilt function can’t be accessed.  
I pulled the code out of my agent and put it in a normal python file and it runs great. Here is the code:

> print(sum([1,2]));

My plugin is using Natural Language Processing and takes a long time. It currently NEVER finishes even if I code around the sum error. Is there some timeout configuration for agents?

---

<div class="post-metadata">

**Author:** ![jelwell](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jelwell](https://forums.plex.tv/u/jelwell)\
**Post date:** [September 28, 2021, 5:45pm UTC](https://forums.plex.tv/t/plex-python-errors/746656/3 "2021-09-28T17:45:35Z")

</div>

I think the same can be said of Plex. But here we are. I would still appreciate tips and pointers.
