# Help with plugin code

**URL:** <https://forums.plex.tv/t/help-with-plugin-code/4139>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [June 8, 2010, 1:06am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139 "2010-06-08T01:06:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bapatla](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@Bapatla](https://forums.plex.tv/u/Bapatla)\
**Post date:** [June 8, 2010, 1:06am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/1 "2010-06-08T01:06:42Z")

</div>

Unable to find JSON.DictFromURL
Hi,  
  
Another newbie question : For some reason my plugin is unable to locate JSON.DictFromURL object, even though I have imported JSON... ("from PMS import Log, HTTP, JSON, Plugin, XML") - what am I missing?  
  
Here is the console log:  
  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] 17:48:56.468116: com.plexapp.plugins.btv : (Framework) An exception happened:  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] Traceback (most recent call last):  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] File "/Volumes/Home/madduluri/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/1/Python/PMS/Plugin.py", line 640, in \_\_call  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] return function(\*args, \*\*kwargs)  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] File "/Volumes/Home/mad/Library/Application Support/Plex Media Server/Plug-ins/bTV.bundle/Contents/Code/\_\_init\_\_.py", line 177, in menumovies  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] dict = JSON.DictFromURL(data2, "Latin-1")  
6/7/10 5:48:56 PM [0x0-0xd2cd2c].com.yourcompany.Plex\_Media\_Server[60720] AttributeError: 'module' object has no attribute 'DictFromURL'  
  
Thanks in advance!  
  
 -- Bapatla

---

<div class="post-metadata">

**Author:** ![sansnipple](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@sansnipple](https://forums.plex.tv/u/sansnipple)\
**Post date:** [June 8, 2010, 1:13am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/2 "2010-06-08T01:13:16Z")

</div>

it’s JSON.ObjectFromURL, not Dict. see the docs: [http://dev.plexapp.com/docs/mod\_JSON.html](http://dev.plexapp.com/docs/mod_JSON.html)

---

<div class="post-metadata">

**Author:** ![Bapatla](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@Bapatla](https://forums.plex.tv/u/Bapatla)\
**Post date:** [June 8, 2010, 1:20am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/3 "2010-06-08T01:20:07Z")

</div>

> [@](#):
>
> it's JSON.ObjectFromURL, not Dict. see the docs: http://dev.plexapp.com/docs/mod\_JSON.html

  
  
I see the object being present in Framework.bundle/Contents/Resources/Versions/0/Python/PMS/JSON.py ... Why isn't my code finding this, even though I included JSON?

---

<div class="post-metadata">

**Author:** ![Dbl\_A](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Dbl\_A](https://forums.plex.tv/u/Dbl_A)\
**Post date:** [June 8, 2010, 1:34am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/4 "2010-06-08T01:34:09Z")

</div>

> [@](#):
>
> I see the object being present in Framework.bundle/Contents/Resources/Versions/0/Python/PMS/JSON.py ... Why isn't my code finding this, even though I included JSON?

  
  
Billy Joe is probably more familiar with the Framework, but I think that in v1 you only need:  
  

```auto

from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *

```

  
  
Not to declare each import explicitly.  
  
Good luck,  
Dbl\_A

---

<div class="post-metadata">

**Author:** ![sansnipple](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@sansnipple](https://forums.plex.tv/u/sansnipple)\
**Post date:** [June 8, 2010, 1:44am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/5 "2010-06-08T01:44:05Z")

</div>

yeah you dont need to import the json module specifically in v1, “from PMS import \*” gets it, and please dont use v0 if you can avoid it, it really sucks, use framework version 1.

---

<div class="post-metadata">

**Author:** ![Bapatla](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@Bapatla](https://forums.plex.tv/u/Bapatla)\
**Post date:** [June 8, 2010, 1:45am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/6 "2010-06-08T01:45:01Z")

</div>

> [@](#):
>
> Billy Joe is probably more familiar with the Framework, but I think that in v1 you only need:  
>   
> 
> ```auto
> 
> from PMS import *<br />
> from PMS.Objects import *<br />
> from PMS.Shortcuts import *
> 
> ```
> 
>   
>   
> Not to declare each import explicitly.  
>   
> Good luck,  
> Dbl\_A

  
  
My code has these statements.. I tried importing others, hoping that these would fix the problem...  
import os, hashlib, sys  
import httplib, urllib  
import string, time  
import demjson as json  
from PMS import \*  
from PMS.Objects import \*  
from PMS.Shortcuts import \*  
# from PMS import Log, HTTP, JSON, Plugin, Thread, Utils, XML, DB  
from PMS import Log, HTTP, JSON, Plugin, XML  
  
import htmlentitydefs  
import time  
import re  
from datetime import datetime, timedelta  
from urlparse import urlparse

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [June 8, 2010, 1:46am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/7 "2010-06-08T01:46:34Z")

</div>

Just to hammer home the issue, you were looking in version 0 of the PMS framework. See the ‘0’ in the py path:  
  
  
  
Framework.bundle/Contents/Resources/Versions/0/Python/PMS/JSON.py  
  
  
  
If you want to browse the code (at it is a useful place for info) look in Framework.bundle/Contents/Resources/Versions/1  
  
  
  
Jonny

---

<div class="post-metadata">

**Author:** ![Bapatla](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@Bapatla](https://forums.plex.tv/u/Bapatla)\
**Post date:** [June 8, 2010, 2:19am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/8 "2010-06-08T02:19:43Z")

</div>

> [@](#):
>
> Just to hammer home the issue, you were looking in version 0 of the PMS framework. See the '0' in the py path:  
>   
> Framework.bundle/Contents/Resources/Versions/0/Python/PMS/JSON.py  
>   
> If you want to browse the code (at it is a useful place for info) look in Framework.bundle/Contents/Resources/Versions/1  
>   
> Jonny

  
  
I did look in Framework.bundle/Contents/Resources/Versions/1/... DictFromURL and DictFromString are no longer there... does it mean that they have been deprecated? If so, how else can I construct a dictionary from a JSON object?

---

<div class="post-metadata">

**Author:** ![sansnipple](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@sansnipple](https://forums.plex.tv/u/sansnipple)\
**Post date:** [June 8, 2010, 2:58am UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/9 "2010-06-08T02:58:20Z")

</div>

in version 1, its JSON.ObjectFromURL and JSON.ObjectFromString

---

<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, 8:39pm UTC](https://forums.plex.tv/t/help-with-plugin-code/4139/10 "2019-12-20T20:39:34Z")

</div>

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