Inkscape Community

Help Using Inkscape => Beyond the Basics => Topic started by: bnnorman on September 03, 2017, 12:13:58 PM

Title: Extension throws error ' no such option'
Post by: bnnorman on September 03, 2017, 12:13:58 PM
I'm trying to write my first extension. I tried the Hello World example and it worked just fine. So, following it as an example, I created my own BUT it ALWAYS throws an error message saying 'error no such option --gw' (grid width variable). I have trawled the net but haven't found anyone else with this error so I guess I'm doing something wrong but I cannot fathom it out. I've been bashing my head against the wall and internet for two days now.

I have attached a screen shot showing that the UI dialog pops up with the default values. On pressing Apply I get the error dialog.

What the script is doing is irrelevant but, for the curious - I'm using inkscape to design LED panel layouts. My panels are currently 64x64 pixels, after roughly hand placing ellipses for the LEDs I want to ensure they are moved to the nearest exact pixel position before extracting the XY co-ords as a tuple list for use in a python animation script. That script works but it isn't an Inkscape extension.

When the extension runs and tries to access 'self.options.gw' it never gets past that point. I have installed the latest stable release (0.92.2 today and I get the same result).

If anyone could help me solve the problem I'll be eternally grateful.

Many thanks.
Title: Re: Extension throws error ' no such option'
Post by: brynn on September 04, 2017, 03:10:32 AM
Unfortunately, I can't help with writing an extension.  But just in case you haven't seen this, maybe it will help:  https://inkscape.org/en/develop/extensions/

At least one of our members knows something about writing extensions.  So hopefully she'll visit before too long.
Title: Re: Extension throws error ' no such option'
Post by: bnnorman on September 04, 2017, 04:50:04 AM
Thanks Brynn. Yes I have see the tutorials and I did get the Hello world to work but I have been unable to understand why mine doesn't see the parameters (options) passed in from the GUI dialog.
Title: Re: Extension throws error ' no such option'
Post by: Moini on September 04, 2017, 01:47:32 PM
Fix the name of the __init__ function.
Title: Re: Extension throws error ' no such option'
Post by: bnnorman on September 04, 2017, 02:04:29 PM
I cannot believe I missed that! Thank you so so much.

I guess it's the old 'can't see the wood for the trees' syndrome - i.e. focussing on the later code.

The parameter passing is now working - now I can get rid of my other bugs.

Thanks again.
Title: Re: Extension throws error ' no such option'
Post by: Moini on September 05, 2017, 01:04:07 PM
Took me some time to notice it, too... ;-)