Plugin has red text, and will not install

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
jachin99
Experienced User
Posts: 646
Joined: Sat Feb 13, 2016 8:39 pm

Plugin has red text, and will not install

Post by jachin99 » Thu Dec 13, 2018 7:37 pm

I'm toying around with the oppo bdp plugin a little more to see if I have reached a point where I can make it work. I haven't :lol: I can't even get EG to install it correctly because trying to add it crashes EG. I attached a screenshot that will hopefully reveal what the problem is. As far as I can tell EG isn't reading the plugin's metadata correctly.
Capture.JPG

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Plugin has red text, and will not install

Post by kgschlosser » Sat Dec 15, 2018 8:02 am

are you ready to smack your forehead.

first thing is first. turn on debugging mode. most errors if EG hangs will show up in the debug log file. the ones that don't always really suck to try and hunt down.

but this one is pretty easy.

Code: Select all

eg.RegisterPlugin(
    name = 'Oppo BDP Network Controller',
    author = 'Jachin99',
    version = '0.1a',
    description = (
        u'This plugin controls the Oppo BDP-103 & 105 Bluray players including ',
        u'Darbee editions over TCP/IP'
    ),
    kind = 'external',
    url = 'http://www.eventghost.net/forum/viewtopic.php?f=2&t=10203',
    help = '',
    canMultiLoad = False,
    createMacrosOnAdd = True,
    guid = '{1B646F04-435D-4613-A75D-439F5607C37B}',
    hardwareId = u'',
    icon = None
)

look close.

specifically the description. I am not going to tell you more then that.


NOTE: remove the spaces before and after the ='s when passing values using the keyword names of the parameters you do not have to have the space around the ='s. You can also remove the keywords that you are not using. and the only time you really need to prefix a string constant with a u is if there is a unicode character in the constant. if you do have a unicode string constant you also need to have # -*- coding: utf-8 -*- as the very first line of the file to set the encoding python is supposed to use to read the file. actually you should always have that line as the first line so just get in the habit of adding it.

I did not fix your error below. this is just a reformatting example.

Code: Select all

eg.RegisterPlugin(
    name='Oppo BDP Network Controller',
    author='Jachin99',
    version='0.1a',
    description=(
        'This plugin controls the Oppo BDP-103 & 105 Bluray players including ',
        'Darbee editions over TCP/IP'
    ),
    kind='external',
    url='http://www.eventghost.net/forum/viewtopic.php?f=2&t=10203',
    canMultiLoad=False,
    createMacrosOnAdd=True,
    guid='{1B646F04-435D-4613-A75D-439F5607C37B}',
)
I am also going to really suggest you use PyCharm and not Visual Studio Code, all of the Visual Studio products are designed to work best when writing C, CPP and C#. it's support for Python just plain sucks. PyCharm has all of the bells and whistles in it for PEP8 compliance and code completion. It does a much better job at detecting coding problems.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 646
Joined: Sat Feb 13, 2016 8:39 pm

Re: Plugin has red text, and will not install

Post by jachin99 » Mon Dec 17, 2018 6:52 pm

Thanks for taking some time to look at it. I figured out the most obvious problem with the description. With that said, there are still some issues with the oppo plugin, and they don't jump out at me just yet. I can put in a known good description for the plugin header but something in the body of my text is causing an error. I'll have to keep studying python in general but I'm starting to pick up on the syntax. Using spaces is just a habit I picked up from instructional videos. Thanks again for looking at it, hopefully I'll be back soon.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Plugin has red text, and will not install

Post by kgschlosser » Mon Dec 17, 2018 8:29 pm

the comma.

Code: Select all

description = (
        u'This plugin controls the Oppo BDP-103 & 105 Bluray players including ',
        u'Darbee editions over TCP/IP'
    ),
the description parameter only takes a string.

with the comma outside of the quotes it is now a tuple you are trying to pass.

when you remove the comma the python compiler looks at it as a single string constant

Code: Select all

description = (
        u'This plugin controls the Oppo BDP-103 & 105 Bluray players including '
        u'Darbee editions over TCP/IP'
    ),

so the compiler processes it as

Code: Select all

description = u'This plugin controls the Oppo BDP-103 & 105 Bluray players including Darbee editions over TCP/IP',
If you like the work I have been doing then feel free to Image

Post Reply