convexengineering / SPaircraft

Models for commercial aircraft design
http://spaircraft.readthedocs.org
25 stars 17 forks source link

SyntaxError: invalid syntax #141

Closed zahsmile closed 2 years ago

zahsmile commented 2 years ago

I run SPaircraft.py and an error occurred, see the bold texts at the end of relaxed_constants.py file. Please help? if i == (len(sol.program.gps) - 1): print("WARNING: The final GP iteration had relaxation values more than 1")

_File ~/SPaircraft-master/turbofan/relaxed_constants.py:49 print("The final GP iteration had relaxation values > 1") ^ SyntaxError: invalid syntax

below is the codes in the relaxed_constants.py file:

print("Checking for relaxed constants...")

for i in range(len(sol.program.gps)):
    varkeys = [k for k in sol.program.gps[i].varlocs if "Relax" in k.models and sol.program.gps[i].result(k) >= 1.00001]
    if varkeys:
        print("GP iteration %s has relaxed constants") % i
        print(sol.program.gps[i].result.table(varkeys)
        if i == (len(sol.program.gps) - 1): 
            print("The final GP iteration had relaxation values > 1")
zahsmile commented 2 years ago

solution:

in the line:

print(sol.program.gps[i].result.table(varkeys)

missing the last parenthesis

print(sol.program.gps[i].result.table(varkeys))