# strange error Plex global objects

**URL:** <https://forums.plex.tv/t/strange-error-plex-global-objects/37099>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [June 24, 2013, 4:26pm UTC](https://forums.plex.tv/t/strange-error-plex-global-objects/37099 "2013-06-24T16:26:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loek17](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@loek17](https://forums.plex.tv/u/loek17)\
**Post date:** [June 24, 2013, 4:26pm UTC](https://forums.plex.tv/t/strange-error-plex-global-objects/37099/1 "2013-06-24T16:26:41Z")

</div>

hoi,

&nbsp;

i am getting a&nbsp;strange error after i use a function from an imported file that uses the plex global objects.&nbsp;

this doesn't always happen when i use plex global but is does happen after an couple imports.

&nbsp;

in this case it is the Unit object. see the error below but if i replace the Unit with an standard python module the next plex object causes the same error

&nbsp;

```
File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py", line 837, in handle_request
    result = f(**d)
  File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\PlexSpotnet.bundle\Contents\Code\Spotnet\BaseSpotnet.py", line 161, in post_download
    respons = SABnzbd.Helper.add_spotnet_post(post)
  File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\PlexSpotnet.bundle\Contents\Code\SABnzbd\Helper.py", line 12, in add_spotnet_post
    resp = Api.add_file(post.get_nzb_content() , post.title , **kwargs)
  File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\PlexSpotnet.bundle\Contents\Code\SABnzbd\Api.py", line 111, in add_file
    content_type , body = encode_multipart_formdata([("agent" , "Plex_spotnet")] , [("nzbfile" , "%s.nzb" % name , content)])
  File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\PlexSpotnet.bundle\Contents\Code\SABnzbd\Api.py", line 122, in encode_multipart_formdata
    BOUNDARY = '----------%s' % ''.join (Util.RandomItemFromList(string.ascii_letters) for ii in range (30 + 1))
  File "C:\Users\Koos\AppData\Local\Plex Media Server\Plug-ins\PlexSpotnet.bundle\Contents\Code\SABnzbd\Api.py", line 122, in 
    BOUNDARY = '----------%s' % ''.join (Util.RandomItemFromList(string.ascii_letters) for ii in range (30 + 1))
NameError: global name 'Util' is not defined
```

the source code is here :&nbsp;%5Burl="https://github.com/loek17/PlexSpotnet.bundle"]https://github.com/loek17/PlexSpotnet.bundle

&nbsp;

because this plugin uses data from newsservers it will only work after you set the correct data in the prefences.

&nbsp;

i will try to create a simple plugin withs mimics this error

&nbsp;

greets Loek

&nbsp;

sorry for the bad english

&nbsp;

&nbsp;

&nbsp;

------EDIT-----------

&nbsp;

got the problem it was because i added an python importpath tot the sys module

Don't know how to fix it

relative import not working for my don't know why

&nbsp;

the attached file is a simple plugin that shows the problem

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 11:36pm UTC](https://forums.plex.tv/t/strange-error-plex-global-objects/37099/2 "2019-12-20T23:36:00Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
