Error in ignition 7.9

Hello I have a traceback error that I can not solve when running a project in ignition the error is below and the code for this. This is in ignition 7.9.21

Traceback (most recent call last):

File "event:actionPerformed", line 1, in

Preformatted text``Preformatted text``Preformatted textTypeError: 'com.inductiveautomation.ignition.common.script.ScriptModule' object is not callable

Ignition v7.9.21 (b2022072613)
Java: Oracle Corporation 1.8.0_371

The code for the script is below

from javax.swing import JFrame, JTextField, JTextArea, JScrollPane, JButton, JPanel
from java.awt import BorderLayout
from java.awt.event import ActionListener, KeyAdapter, KeyEvent
from java.awt import GridLayout

def process_user_input():
user_input = input_field.getText()
output_area.append("User: " + user_input + "\n")
input_field.setText("")

response = ""
if user_input.lower() == "hello":
    response = "Hello! How can I assist you?"
elif user_input.lower() == "goodbye":
    response = "Goodbye! Have a great day!"
elif user_input.lower() == "stuck in back-to-bottom?":
    display_new_question_set()
    return
elif user_input.lower() == "pump not ramping up?":
    response = "To troubleshoot 'Pump not ramping up?', you can try the following:\n\n" \
               "1. Check if Edge Autopilot is enabled and pumps are turned on from the Native system.\n" \
               "2. Check if IBOP is open.\n" \
               "3. If it still does not work, please call the hotline at (+1832-459-4507)."
else:
    response = "I'm sorry, I didn't understand that. Can you please rephrase?"

output_area.append("Bot: " + response + "\n")

def display_new_question_set():
question_panel.removeAll()

new_questions = [
    "Pump not ramping up?",
    "Rotary not ramping up?",
    "Not lowering the blocks?",
    "Auto-Zeroes not working?"
]

for question in new_questions:
    question_button = JButton(question)
    question_button.addActionListener(question_button_clicked)
    question_panel.add(question_button)

frame.revalidate()
frame.repaint()

def question_button_clicked(event):
question = event.getActionCommand()
input_field.setText(question)
process_user_input()

frame = JFrame("Chatbot")
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
frame.setSize(400, 300)
frame.setLayout(BorderLayout())

input_field = JTextField()
frame.add(input_field, BorderLayout.NORTH)

output_area = JTextArea()
output_area.setEditable(False)
scroll_pane = JScrollPane(output_area)
frame.add(scroll_pane, BorderLayout.CENTER)

question_panel = JPanel()
question_panel.setLayout(GridLayout(2, 2))

Add the "Stuck in Back-to-bottom?" question as a subset question

stuck_question_button = JButton("Stuck in Back-to-bottom?")
stuck_question_button.addActionListener(lambda event: display_new_question_set())
question_panel.add(stuck_question_button)

Add additional subset questions

subset_questions = [
"Pump not ramping up?",
"Rotary not ramping up?",
"Not lowering the blocks?",
"Auto-Zeroes not working?"
]

for question in subset_questions:
question_button = JButton(question)
question_button.addActionListener(question_button_clicked)
question_panel.add(question_button)

frame.add(question_panel, BorderLayout.SOUTH)

frame.setVisible(True)

Please edit your post, highlight all of the code, and click the "preformatted text" button, which looks like this: </>

And save. That will make your code readable on this forum.

I highlighted all the code but seems to not be formatting it correctly.

I reposted my code in another post, here Error in ignition 7.9.21 it is better formatted like you asked.

1 Like

Instead of making redundant posts for the same issue, you should just edit your original post