# Best development practice

**URL:** <https://forums.plex.tv/t/best-development-practice/3450>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [January 20, 2010, 12:23pm UTC](https://forums.plex.tv/t/best-development-practice/3450 "2010-01-20T12:23:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunekibs](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sunekibs](https://forums.plex.tv/u/sunekibs)\
**Post date:** [January 20, 2010, 12:23pm UTC](https://forums.plex.tv/t/best-development-practice/3450/1 "2010-01-20T12:23:23Z")

</div>

Hi all,  
  
  
  
I am going to start on my first plugin. For sputnik.dk (a danish premium webtv channel) and was wondering how you guys do the development? do you have some kind of debug setup, or du you make your changes, restart the media server, and just see if it works?  
  
  
  
Sune

---

<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:** [January 20, 2010, 12:46pm UTC](https://forums.plex.tv/t/best-development-practice/3450/2 "2010-01-20T12:46:35Z")

</div>

ill outline my dev practice later, but first of all, you dont need to restart the media server to see the changes, the plugin updates live as soon as you hit save in your text editor.

---

<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:** [January 20, 2010, 1:10pm UTC](https://forums.plex.tv/t/best-development-practice/3450/3 "2010-01-20T13:10:27Z")

</div>

my first advice is get yourself a good programer’s text editor, while i _ **strongly** _ prefer Textmate, anything from Emacs to BBEdit will do, use what you’re comfortable with. a full IDE like xcode or eclipse would technically work but isnt ideal, its way too heavy for just python, and a good text editor ( **Textmate!!!** ) will be your best friend for life. Just please please please for god’s sake dont use apple’s textedit or god forbid, word. Really you want something lightweight and flexible, with features geared toward coding, you absolutely must have syntax highlighting and basic code validation. good syntax highlighting in particular (look for something with customizable color themes) will catch 98% of common errors and mistypings that you’d be searching for for hours in textedit.

---

<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:** [January 20, 2010, 1:17pm UTC](https://forums.plex.tv/t/best-development-practice/3450/4 "2010-01-20T13:17:33Z")

</div>

skipping ahead here a bit, as for debugging a plugin, once syntax and whitespace errors that would prevent it from loading at all are out of the way, any fatal errors cause a traceback to be written to the plugin’s log file at ~/Library/Logs/PMS Plugin Logs/com.plexapp.plugins.yourpluginname.log so you can see what happened. beyond that, if the code’s not throwing errors, but just not working the way you want it to, you can use the framework’s Log() function to write to the plugin’s log file in order to inspect the contents of a variable or to get an idea of what’s going wrong where.

---

<div class="post-metadata">

**Author:** ![sunekibs](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sunekibs](https://forums.plex.tv/u/sunekibs)\
**Post date:** [January 20, 2010, 1:23pm UTC](https://forums.plex.tv/t/best-development-practice/3450/5 "2010-01-20T13:23:22Z")

</div>

Thanks a lot, that clarified things.  
  
  
  
Already using textmate for all my development work, actually I am one of the programmers behind the sputnik.dk site, and this was done in textmate 🙂  
  
  
  
just wanted to know how the plugins behaved when throwing exceptions and such.  
  
  
  
Again, thank you 🙂

---

<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:** [January 20, 2010, 5:27pm UTC](https://forums.plex.tv/t/best-development-practice/3450/6 "2010-01-20T17:27:08Z")

</div>

One thing to add to Billy’s suggestions is to run PMS from the command line and then you can see Log messages, exceptions etc in the terminal.

```auto

<br />
killall "Plex Media Server"<br />
<br />
~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Server<br />

```

  
  
other than that, the dev site and existing plugins for example code are your best friends.  
  
Jonny

---

<div class="post-metadata">

**Author:** ![elan](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/elan/32/5_2.png) [@elan](https://forums.plex.tv/u/elan)\
**Post date:** [January 20, 2010, 9:21pm UTC](https://forums.plex.tv/t/best-development-practice/3450/7 "2010-01-20T21:21:35Z")

</div>

The next version of the Media [Server log](https://support.plex.tv/articles/200250417-plex-media-server-log-files/)s to a standard log file, so that last scary Terminal step won’t be needed 🙂

---

<div class="post-metadata">

**Author:** ![sunekibs](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sunekibs](https://forums.plex.tv/u/sunekibs)\
**Post date:** [January 21, 2010, 7:56am UTC](https://forums.plex.tv/t/best-development-practice/3450/8 "2010-01-21T07:56:12Z")

</div>

> [@](#):
>
> The next version of the Media Server logs to a standard log file, so that last scary Terminal step won't be needed :)

  
  
sounds good, because when doing a tail -f on the plugin logfile, you have to reopen everytime the plugin crashes, as it starts a new file :) And when you are coming from PHP and doing your first Python, it crashes a lot :D

---

<div class="post-metadata">

**Author:** ![elan](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/elan/32/5_2.png) [@elan](https://forums.plex.tv/u/elan)\
**Post date:** [January 21, 2010, 8:05am UTC](https://forums.plex.tv/t/best-development-practice/3450/9 "2010-01-21T08:05:59Z")

</div>

You shouldn’t need to tail the plug-in logfile, if you run the media server from the Terminal you can see the plug-in “crashes” (stack traces) and you don’t need to restart/reopen.

---

<div class="post-metadata">

**Author:** ![sunekibs](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sunekibs](https://forums.plex.tv/u/sunekibs)\
**Post date:** [January 21, 2010, 9:04am UTC](https://forums.plex.tv/t/best-development-practice/3450/10 "2010-01-21T09:04:39Z")

</div>

> [@](#):
>
> You shouldn't need to tail the plug-in logfile, if you run the media server from the Terminal you can see the plug-in "crashes" (stack traces) and you don't need to restart/reopen.

  
  
Will do that instead, otherwise, what a great job on the plugin framework. I really like it so far!

---

<div class="post-metadata">

**Author:** ![elan](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/elan/32/5_2.png) [@elan](https://forums.plex.tv/u/elan)\
**Post date:** [January 21, 2010, 9:05am UTC](https://forums.plex.tv/t/best-development-practice/3450/11 "2010-01-21T09:05:56Z")

</div>

> [@](#):
>
> Will do that instead, otherwise, what a great job on the plugin framework. I really like it so far!

  
  
Thanks very much for your kind words!

---

<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:35pm UTC](https://forums.plex.tv/t/best-development-practice/3450/12 "2019-12-20T20:35:40Z")

</div>

Closed on December 20, 2019, 8:35pm UTC

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