I could really use your help (I'm new to the whole thing, been looking around, can't find anything blahblah) I'm getting this error.

Python error compiling script - object 'Empty', controller 'Python':
    File "main", line 133
        for (bge.logic.purine) in bpy context.selected_objects:

SyntaxError: invalid syntax

In relation to this piece of code

for i in range(2):
    for ii in range(bge.logic.DNAPNum):
        if i == 1:
        if i == 0:

if timer.localPosition.y >= 1.0:
    for i in range(bge.logic.DNAPNum):
        dist = 100000
        for ii in range(bge.logic.PurineNum):
            new_dist = bge.logic.object_1[i].getDistanceTo(bge.logic.purine[ii])
            if new_dist < dist:
                dist = new_dist
                nearest = bge.logic.purine[ii]

        if dist < 2.0:
            for (bge.logic.purine) in bpy context.selected_objects:  # line 133
                (bge.lgic.purine) = (bge.logic.purine).constraints.new (type='TRACK_TO')
                (bge.logic.purine).target = context.scene.objects.get("DNAPolymerase")
        bge.logic.object_1[i]['score'] += 1.0

I think I'm going about this whole thing wrong. What I'm trying to do is, when distance is less than 2.0 between bge.logic.purine and bge.logic.DNAPNum, the 'purine'(bge.logic.purine) will track to the DNA polymerase(bge.logic.DNAPNum).

If you recognise this code, it is not created by me but by Jean-Francois Gallant and is part of a neural network add-on. I'm just modifying it (or attempting to).

Any help is appreciated. If you need any more information, I'll be happy to attach some more files.

Thanks in advance.


1 Answer 1


There's a missing dot between bpy.context, on line 133.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .