why can not use dir() function in a plugin

def search(self, results, media, lang):

Log(‘zhanwei’)

Log(media.name)

dir(media)



the log is



2011-04-26 11:03:02,467 (1600) : INFO (core) - zhanwei

2011-04-26 11:03:02,467 (1600) : INFO (core) - ???2010

2011-04-26 11:03:02,482 (1600) : CRITICAL (core) - Exception in the search function of agent named ‘Douban’, called with keyword arguments {‘openSubtitlesHash’: ‘395dd460f4d96f37’, ‘name’: ‘\xe8\x8a\xb1\xe7\x94\xb0\xe5\x96\x9c\xe4\xba\x8b2010’, ‘filename’: ‘E:%5Cmedia%5C%E8%8A%B1%E7%94%B0%E5%96%9C%E4%BA%8B2010%2Ermvb’, ‘plexHash’: ‘1ca4dc7d2c4e7c4960578f45a6e90b8311317c65’, ‘duration’: ‘5294000’, ‘id’: ‘3’} (most recent call last):

File “C:\Documents and Settings\admin\Local Settings\Application Data\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py”, line 657, in search

agent.search(results, media, lang)

File "C:\Documents and Settings\admin\Local Settings\Application Data\Plex Media Server\Plug-ins\Douban.bundle\Contents\Code_init
.py", line 24, in search

dir(media)

NameError: global name ‘dir’ is not defined

[size=“6”]

I want to know the attribute of a object how to ?[/size]

anyone can help me ?

Yep. dir() is restricted in v2 plug-ins for security reasons. If you want to know the names of properties an item has you can look at the source code in the Framework bundle. If you need to do runtime introspection you’re SOL unless you really want to write a v1 plug-in.

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