Python 2.6:# SyntaxError: keyword argument repeated #

Maya 2012:

I run up a script and find this:

SyntaxError: keyword argument repeated

er…
It dies here:


with pma.rowLayout('mExSplit', numberOfColumns=2,adjustableColumn=1,
                               rowAttach=(1, 'both', 0),
                               columnWidth=(1,(self.wValue-(self.bWidth-5))]),
                               columnWidth=(2,self.bWidth)) as self.split:

this has worked forever…
turns out that this type of keyword duplication was ignored in python 2.5 but was illegal in 2.4 and is now illegal again in 2.6, Maya 2012 is 2.6.

The Maya documentation has not been updated to highlight this fact.

I discovered this here:
http://nick.zoic.org/art/python/syntax_error_keyword_argument_repeated/

Thought it was worth mentioning…

Well, isn’t it the same in MEL (and always has been)? If so I’m not surprised it’s the same when using Python. That’s why there are flags for handling column width for multiple columns in one keyword, like columnWidth2 as you have 2 columns.

EDIT: Didn’t see you use PyMEL and not maya.cmds, but I guess it’s the same there.

Wow, that 2.5 thing is good to know!

(self.wValue-(self.bWidth-5))]) <========’]’ this is wrong

Wolfsong I guess you missed this in the help?

python
columnWidth(cw) [int, int]
Width of a particular column. The first argument is a 1-based index specifying the column. The second argument is the width value.

Mel
-columnWidth(-cw) int int
Width of a particular column. The first argument is a 1-based index specifying the column. The second argument is the width value.

Which has also been there forever…

Likewater:
Yeah thanks, i missed that in this post i should correct that, it crept in while I was hacking it back and forward from tuple to a list as per the help… But it wasn’t the cause of the actual bug I ran into :slight_smile:

[QUOTE=rhexter;14732]Wolfsong I guess you missed this in the help?

python
columnWidth(cw) [int, int]
Width of a particular column. The first argument is a 1-based index specifying the column. The second argument is the width value.

Mel
-columnWidth(-cw) int int
Width of a particular column. The first argument is a 1-based index specifying the column. The second argument is the width value.

Which has also been there forever…
[/QUOTE]
No, I’ve seen that. But I ran into that issues a long time ago… But then again Maya 2011 also runs on 2.6.* so that’s probably why it’s been like that for years. :wink: Never been a big issue though for the specified case as those other flags exists.

I always thought it was Maya’s implementation and not Python’s core functionality that complained, so thanks for that info. :slight_smile:

EDIT: Maya 2010 is also Python 2.6.* btw, so that’s another year back and actually around the time that I converted from MEL to Python.

Ah we’re just there from 2009… And it’s been standard syntax for me up through mel, cmds and into pymel so seemed kinda bizarre! Old habits I guess :slight_smile: