# Potential bug with the API?

**URL:** <https://forums.plex.tv/t/potential-bug-with-the-api/44089>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [October 5, 2013, 9:14pm UTC](https://forums.plex.tv/t/potential-bug-with-the-api/44089 "2013-10-05T21:14:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [October 5, 2013, 9:14pm UTC](https://forums.plex.tv/t/potential-bug-with-the-api/44089/1 "2013-10-05T21:14:43Z")

</div>

Trying to call an object container with a callback, and as one of the parameters, having a list.....

&nbsp;

But somehow the list doesn't make it over to the new function/container properly, cuz I can't loop the list.

&nbsp;

Can however from the calling function

&nbsp;

Anyone?

&nbsp;

Sample:

&nbsp;

```
oc = ObjectContainer(no_cache=True)	
	try:
		sections = XML.ElementFromURL(PMS_URL).xpath('//Directory')	
		for section in sections:			
			title = section.get('title')
			key = section.get('key')
			paths = section.xpath('Location/@path')
			Log.Debug("Title of section is %s with a key of %s and a path of : %s" %(title, key, paths))	
			for path in paths:
				Log.Debug("Path is %s" %(path))
			oc.add(DirectoryObject(key=Callback(confirmScan, title=title, paths=paths, key=key), title='Look in section "' + title + '"'))	
	except:
		pass
	oc.add(PrefsObject(title='Preferences', thumb=R('icon-prefs.png')))
	Log.Debug(" **********Ending MainMenu**********")
	return oc
```

&nbsp;

/Tommy

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [October 9, 2013, 11:38pm UTC](https://forums.plex.tv/t/potential-bug-with-the-api/44089/2 "2013-10-09T23:38:25Z")

</div>

Could be that the cerializer/de-cerializer is not re-creating the list in the second function. Try declaring the variable type in the @route decorator:

```
@route('/video/myplugin/functionb', variable_x=list)
def FunctionB(variable_x):
   ''' do stuff'''
   return
```

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [October 9, 2013, 11:43pm UTC](https://forums.plex.tv/t/potential-bug-with-the-api/44089/3 "2013-10-09T23:43:23Z")

</div>

> Could be that the cerializer/de-cerializer is not re-creating the list in the second function. Try declaring the variable type in the @route decorator:
> 
> ```
> @route('/video/myplugin/functionb', variable_x=list)
> def FunctionB(variable_x):
> ''' do stuff'''
> return
> ```

I'll check it out in a couple of days..sadly busy for the next couple of ones....But FUI created a work-around with a nasty global array

Anyway....worth a shut, to huge thanks from my side regardless of the outcome

Best regards

Tommy

---

<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 21, 2019, 12:13am UTC](https://forums.plex.tv/t/potential-bug-with-the-api/44089/4 "2019-12-21T00:13:03Z")

</div>

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