From af9cd1df81bf4b3df5040d357792a01f5f0dfd6e Mon Sep 17 00:00:00 2001 From: "newman.daniel1" Date: Mon, 18 Oct 2010 19:23:54 +0000 Subject: [PATCH] Issue 29: Invalid syntax errors on MacOS 10.5; seems to be an issue with the Python on the user's system not allowing conditional expressions which, reportedly, were a major new feature in Python 2.5 circa August 2006 and described in POP 308 git-svn-id: https://eggbotcode.googlecode.com/svn/trunk@151 72233254-1b6c-9e9c-5072-401df62706fb --- inkscape_driver/eggbot.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/inkscape_driver/eggbot.py b/inkscape_driver/eggbot.py index 3a42904..7f207ad 100755 --- a/inkscape_driver/eggbot.py +++ b/inkscape_driver/eggbot.py @@ -737,7 +737,15 @@ class EggBot( inkex.Effect ): else: pa = pl.split() - d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] ) + if not len( pa ): + pass + # Issue 29: pre 2.5.? versions of Python do not have + # "statement-1 if expression-1 else statement-2" + # which came out of PEP 308, Conditional Expressions + #d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] ) + d = "M " + pa[0] + for i in range( 1, len( pa ) ): + d += " L " + pa[i] newpath = inkex.etree.Element( inkex.addNS( 'path', 'svg' ) ) newpath.set( 'd', d ); s = node.get( 'style' ) @@ -780,7 +788,15 @@ class EggBot( inkex.Effect ): else: pa = pl.split() - d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] ) + if not len( pa ): + pass + # Issue 29: pre 2.5.? versions of Python do not have + # "statement-1 if expression-1 else statement-2" + # which came out of PEP 308, Conditional Expressions + #d = "".join( ["M " + pa[i] if i == 0 else " L " + pa[i] for i in range( 0, len( pa ) )] ) + d = "M " + pa[0] + for i in range( 1, len( pa ) ): + d += " L " + pa[i] d += " Z" newpath = inkex.etree.Element( inkex.addNS( 'path', 'svg' ) ) newpath.set( 'd', d );