# Plugin Log Question

**URL:** <https://forums.plex.tv/t/plugin-log-question/7655>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [February 3, 2011, 7:20am UTC](https://forums.plex.tv/t/plugin-log-question/7655 "2011-02-03T07:20:25Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [February 3, 2011, 7:20am UTC](https://forums.plex.tv/t/plugin-log-question/7655/1 "2011-02-03T07:20:25Z")

</div>

HTML.ElementFromURL
I am receiving this error in my log:  

```auto

    <br />
content = HTML.ElementFromURL(pageUrl)<br />
NameError: global name 'HTML' is not defined<br />

```

  
  
I've been working through some examples and references other plugins and it is the same syntax used in each one. Does anyone have any idea what the issue might be?  
  
Only difference I can find is that I a using an IP address for the URL rather than a domain name. I assumed this would not cause any problems.

---

<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:** [February 3, 2011, 2:07pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/2 "2011-02-03T14:07:49Z")

</div>

> [@](#):
>
> I am receiving this error in my log:  
> 
> ```auto
> 
> <br />
> content = HTML.ElementFromURL(pageUrl)<br />
> NameError: global name 'HTML' is not defined<br />
> 
> ```
> 
>   
>   
> I've been working through some examples and references other plugins and it is the same syntax used in each one. Does anyone have any idea what the issue might be?  
>   
> Only difference I can find is that I a using an IP address for the URL rather than a domain name. I assumed this would not cause any problems.

  
  
I assume you are using Plex Framework v1, in which case you would need to use the equivalent:  

```auto

content = XML.ElementFromURL(pageUrl, isHTML=True)

```

---

<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:** [February 3, 2011, 2:44pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/3 "2011-02-03T14:44:53Z")

</div>

How is the framework version specified?

---

<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:** [February 3, 2011, 3:19pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/4 "2011-02-03T15:19:37Z")

</div>

That did seem to fix it but should I be using V.2?  
  
  
  
Also, all of the information I want to use for my objects is stored in a table. No usable div tags or much of anything.   
  
  
  
XPath Checker found this: id(‘Main’)/x:table/x:tbody/x:tr but Plex doesn’t like it. I’ve been able to get my list of object displaying using: //table/descendant::a but I can’t get the additional information I want to be able to display.  
  
  
  
To do that, I need a way to find out how many rows are in the table so I can loop through them to pull out the necessary information.  
  
I can use this: id(‘Main’)/x:table/x:tbody/x:tr[19]/x:td[4] and increment the row/column count --\> but again, Plex doesn’t like this syntax.  
  
  
  
Help!? Not a complete noob but new to Python and XPath. I’m sure there is a more efficient way to grab the info I need.  
  
  
  
  
  
Website, for reference: [http://88.80.11.29](http://88.80.11.29)

---

<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:** [February 3, 2011, 3:42pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/5 "2011-02-03T15:42:25Z")

</div>

V1 plugins are still very common and still being developed. When I started developing plugins I decided to dive right into V2. I assumed (right or wrong) that the goal is to eventually migrate all the plugins to V2. From a development standpoint, there really are only a few differences which are laid out pretty well in Sander’s thread about upgrading from V1 to V2.  
  
  
  
When you’re using xpath checker it will throw in a ‘x:’ in fron t of the items in the path. So, for your table you could probably use something like:

```auto

data = content.xpath('//table/tbody/tr')

```

  
to return a list of all the elements in the table. Then if you put that in a for loop, you can cycle through each element to pull out the relevent info you want.

---

<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:** [February 3, 2011, 4:38pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/6 "2011-02-03T16:38:30Z")

</div>

> [@](#):
>
> V1 plugins are still very common and still being developed. When I started developing plugins I decided to dive right into V2. I assumed (right or wrong) that the goal is to eventually migrate all the plugins to V2. From a development standpoint, there really are only a few differences which are laid out pretty well in Sander's thread about upgrading from V1 to V2.  
>   
> When you're using xpath checker it will throw in a 'x:' in fron t of the items in the path. So, for your table you could probably use something like:  
> 
> ```auto
> 
> data = content.xpath('//table/tbody/tr')
> 
> ```
> 
>   
> to return a list of all the elements in the table. Then if you put that in a for loop, you can cycle through each element to pull out the relevent info you want.

  
  
  
How do I fix the 'global name HTML is not defined' error if I go that route? Since that is a v2 call...

---

<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:** [February 3, 2011, 4:48pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/7 "2011-02-03T16:48:36Z")

</div>

> [@](#):
>
> How do I fix the 'global name HTML is not defined' error if I go that route? Since that is a v2 call...

  
  
That xpath should work for v1 as well. Just use the XML.ElementFromUrl example Dbl\_A provided.  
  
Something like this...  

```auto

content = XML.ElementFromUrl(pageUrl, isHTML=True<br />
fot data in content.xpath('//table/tbody/tr'):<br />
### here's where you process each item ###<br />
### make sure to indent properly###

```

---

<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:** [February 3, 2011, 4:54pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/8 "2011-02-03T16:54:58Z")

</div>

> [@](#):
>
> How do I fix the 'global name HTML is not defined' error if I go that route? Since that is a v2 call...

  
  
If you want to dive into v2, you need to update the Info.plist file.  
I would just look at an existing v2 plugin and compare the Info.plist's between the two.

---

<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:** [February 3, 2011, 6:56pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/9 "2011-02-03T18:56:12Z")

</div>

Sander’s post here ([http://forums.plexapp.com/index.php/topic/18324-updating-plugins-to-v2-framework/page\_\_view\_\_getnewpost](http://forums.plexapp.com/index.php/topic/18324-updating-plugins-to-v2-framework/page __view__ getnewpost)) also does a good job of explaining the necessary changes to get going in v2.

---

<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:** [February 3, 2011, 9:14pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/10 "2011-02-03T21:14:10Z")

</div>

I’ve got my menu populated. Now working on the site configuration. Most of the videos I’m trying to use are embedded from other locations so I’m not sure how to find the ‘plugin’. Any direction?

---

<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:** [February 3, 2011, 9:31pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/11 "2011-02-03T21:31:47Z")

</div>

Hmm. Found an alternative site that might be easier to work with… That definitely through a wrench in my plans… 🙂

---

<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:** [February 3, 2011, 10:40pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/12 "2011-02-03T22:40:49Z")

</div>

Ok, so having some issues. After making some edits the plugin doesn’t appear in Plex any more. I undid the changes and still nothing… :huh:  
  
  
  
  
  
All I get in the Log is:  
  
Bundle Verification complete  
  
Debugging is enabled  
  
Default encoding is utf-8  
  
Loaded en Strings  
  
Couldn’t find en-us strings  
  
Configured framework modules

---

<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:** [February 3, 2011, 11:12pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/13 "2011-02-03T23:12:17Z")

</div>

Try restarting PMS. I’ve found that on occasion it takes a little extra effort to get it to ‘see’ the changes you made to the code.

---

<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:** [February 3, 2011, 11:17pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/14 "2011-02-03T23:17:43Z")

</div>

Yeah, I’ve tried that a few times… still no luck. \<\_\<

---

<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:** [February 3, 2011, 11:22pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/15 "2011-02-03T23:22:50Z")

</div>

It’s odd. Terminal is telling me invalid syntax, referring to my dir.Append  
  
  
  
specifically pointing to the ‘r’…  
  
  
  
This line hasn’t changed.

---

<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:** [February 3, 2011, 11:42pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/16 "2011-02-03T23:42:48Z")

</div>

it looks to be the 3rd line of my MainMenu() - no matter what is there…  
  
  
  
found it!

---

<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:** [February 4, 2011, 3:06am UTC](https://forums.plex.tv/t/plugin-log-question/7655/17 "2011-02-04T03:06:07Z")

</div>

Anyone willing to help with some XPath?  
  
  
  
I am looking at [www.fromsport.com](http://www.fromsport.com) and using: //table//tr once I have the row items, how can I loop through each column to assign my variables?  
  
  
  
Also, the titles that show up on the website are being generated through a script (I think)… is there a way to translate that for my use in Plex?

---

<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:** [February 4, 2011, 2:06pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/18 "2011-02-04T14:06:28Z")

</div>

I’m no xpath expert but, if you post a sample of the code your trying to match, I can can try to give you a hand.  
  
It might be helpful if you also post an excerpt of the code that you have so far.

---

<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:** [February 4, 2011, 4:02pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/19 "2011-02-04T16:02:47Z")

</div>

> [@](#):
>
> I'm no xpath expert but, if you post a sample of the code your trying to match, I can can try to give you a hand.  
> It might be helpful if you also post an excerpt of the code that you have so far.

  
  
  
Thanks, Mike. I moved my questions to a more specific topic, here: http://forums.plexapp.com/index.php/topic/23120-plugin-help/page\_\_gopid\_\_144163#entry144163  
  
and have had some others chime in and got my questions answered.

---

<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:58pm UTC](https://forums.plex.tv/t/plugin-log-question/7655/20 "2019-12-20T20:58:59Z")

</div>

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