svgui/pyjs/lib/sys.py
author |
Andrey Skvortsov <andrej.skvortzov@gmail.com> |
|
Tue, 05 Mar 2019 11:19:36 +0300 |
changeset 2519 |
27955f010b23 |
parent 1879 |
4d81c3bcac82
|
permissions |
-rw-r--r-- |
Fix crash if LD input contact isn't connected
Traceback (most recent call last):
File "/home/developer/WorkData/PLC/beremiz/beremiz/BeremizIDE.py", line 339, in OnMethod
obj.CTR.CallMethod('_'+meth)
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 1996, in CallMethod
getattr(self, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 1134, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 746, in _Generate_SoftPLC
if self._Generate_PLC_ST():
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 763, in _Generate_PLC_ST
self._getIECgeneratedcodepath())
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCControler.py", line 456, in GenerateProgram
self.ProgramChunks = GenerateCurrentProgram(self, self.Project, errors, warnings)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1762, in GenerateCurrentProgram
generator.GenerateProgram()
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 478, in GenerateProgram
self.GeneratePouProgram(pou_name)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 260, in GeneratePouProgram
program = pou_program.GenerateProgram(pou)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1718, in GenerateProgram
self.ComputeProgram(pou)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1028, in ComputeProgram
self.GenerateBlock(instance, block_infos, body, None)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1144, in GenerateBlock
expression = self.ComputeExpression(body, connections, executionOrderId > 0)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1373, in ComputeExpression
paths = self.GeneratePaths(connections, body, order, to_inout)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1344, in GeneratePaths
elif isinstance(result[0], list):
IndexError: list index out of range
Close #70
# the platform name (PyV8, smjs, Mozilla, IE6, Opera, Safari etc.)
platform = '' # to be updated by app, on compile
# a dictionary of module override names (platform-specific)
overrides = {} # to be updated by app, on compile
# the remote path for loading modules
loadpath = None
stacktrace = None
appname = None
def setloadpath(lp):
global loadpath
loadpath = lp
def setappname(an):
global appname
appname = an
def getloadpath():
return loadpath
def addoverride(module_name, path):
overrides[module_name] = path
def addstack(linedebug):
JS("""
if (pyjslib.bool((sys.stacktrace === null))) {
sys.stacktrace = new pyjslib.List([]);
}
sys.stacktrace.append(linedebug);
""")
def popstack():
JS("""
sys.stacktrace.pop()
""")
def printstack():
JS("""
var res = '';
var __l = sys.stacktrace.__iter__();
try {
while (true) {
var l = __l.next();
res += ( l + '\\n' ) ;
}
} catch (e) {
if (e != pyjslib.StopIteration) {
throw e;
}
}
return res;
""")