Python Forum
syntax error - repeating error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
syntax error - repeating error
#1
Within this code every time I go to run this code through Abaqus i receive the same syntax error within this section

displacement_data[val.nodeLabel]["X0"].append(xyzi[0])
displacement_data[val.nodeLabel]["Y0"].append(xyzi[1])
displacement_data[val.nodeLabel]["Z0"].append(xyzi[2])
The remainder of the code is this.

import time
import os
import csv

Job_str = 'UpdatedLandmarks2'
start_time = time.time()
os.chdir('C:/Users/awaugh/Documents/Abaqus nonsense')
odbName = Job_str + '.odb'
odb = session.openOdb(odbName)
myAssembly = odb.rootAssembly
ROINodeSet1 = myAssembly.nodeSets['Clean Landmarks']
xi = []
yi = []
zi = []
labels = []
label = []
F1 = []
F2 = []
displacement_dataX = []
displacement_dataY = []
displacement_dataZ = []
count = 0

specific_node_labels = {
    "ACL F": 235,
}

# Initialize displacement data for specific node
displacement_data = {label: {"X0": [], "Y0": [], "Z0": []} for label in specific_node_labels.values()}

# Get the last frame from the step
timeFrame = odb.steps['ApplyFemRotation'].frames[-1]
displacement = timeFrame.fieldOutputs['U']
ROINodeDisp1 = displacement.getSubset(region=ROINodeSet1)

labels = []  # Make sure labels is initialized as an empty list

# Collect displacement data only for specific nodes
for val in ROINodeDisp1.values:
    if val.nodeLabel in specific_node_labels.values():  # Check if the node is in our specific nodes
        labels.append(val.nodeLabel)  # Append node labels

        for nod in ROINodeSet1.nodes:
            if nod.label == val.nodeLabel:
                xyzi = nod.coordinates
                displacement_data[val.nodeLabel]["X0"].append(xyzi[0])
                displacement_data[val.nodeLabel]["Y0"].append(xyzi[1])
                displacement_data[val.nodeLabel]["Z0"].append(xyzi[2])
Reply
#2
Please show the complete error, without modification.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Statsmodels Multiple Regression Syntax Error Burger 2 4,171 Jul-13-2021, 03:04 AM
Last Post: Burger
  How to find what is causing the unboundlocalerror 'crumb' and invalid syntax error? JonathanBanks 1 3,073 Jul-28-2020, 11:46 AM
Last Post: Yoriz
  I need help fixing a syntax error! chenqin348 5 5,288 Dec-27-2019, 12:07 PM
Last Post: Larz60+
  Regarding index out of bounds error and implementing Loop error in backpropagation al geevaprasa 6 9,825 Apr-20-2018, 09:35 AM
Last Post: Larz60+
  type error and access violation error pyopengl hsunteik 0 3,895 Nov-04-2017, 04:51 AM
Last Post: hsunteik

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020