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'
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?
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.
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
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?