# HG changeset patch # User Laurent Bessard # Date 1368652309 -7200 # Node ID d0e40e99f422200b2bb4770d813adad23599989d # Parent 71db4592beb26694f976fc7b4d3387fbb6bbb6d1 Fixed bug when generating py_ext code when no variable defined diff -r 71db4592beb2 -r d0e40e99f422 py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Wed May 15 22:37:07 2013 +0200 +++ b/py_ext/PythonFileCTNMixin.py Wed May 15 23:11:49 2013 +0200 @@ -157,7 +157,7 @@ } """ - vardec, varret, varpub = map("\n".join, zip(*[ + var_str = map("\n".join, zip(*[ map(lambda f : f % varinfo, (vardecfmt, varretfmt, varpubfmt)) for varinfo in map(lambda variable : { @@ -167,6 +167,10 @@ "IECtype": "IEC_%s"%variable.gettype(), "initial" : str(variable.getinitial())}, self.CodeFile.variables.variable)])) + if len(var_str) > 0: + vardec, varret, varpub = var_str + else: + vardec = varret = varpub = "" PyCFileContent = """\ /*