Error convert to int

Hi, I write to you because i have a problem with a numeric text field, i call the window where is the numeric text field, and appears a message with error, after it I close i try once more, and it’s ok i can work with that numeric text field, and it ocurs again if I save de proyect in the designer, or I logout and log in again with another user, or the user. i try again and it works until i save the project again or the other actions.

the message says:

Traceback (most recent call last):

File “event:internalFrameOpened”, line 2, in

TypeError: can’t convert 63.5 to int

Ignition v7.5.1 (b1122)
Java: Sun Microsystems Inc. 1.6.0_31

I can’t understand, because everything is with its respective type integer

I will appreciate you help please what this message means.

Hi caritoel27,

That message normally comes from trying to cast a float to an int.

Can you copy the script from internalFrameOpened and paste it in this thread?

The thing is that i’m not converting from float to int . I’m sending every value for that is a float

Velocidad is the value i’m sending to the numeric text field Temperatura, both float in the BD is also Float(Mysql) y shows me the error 1 time , after it works without message of error.

the error appears if a save a change or only save the project in the designer.

I send you the full message error, 2 pictures one is the parameters that i send when i clic the button to the window add_curva_calibre, the others is the window that contains the button error
also I send the window ADD_punto called if it helps.


the message more detailed
Traceback (most recent call last):
File “event:internalFrameOpened”, line 2, in
TypeError: can’t convert 0.0 to int

at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Unknown Source)
at java.lang.RuntimeException.<init>(Unknown Source)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.<init>(PyException.java:43)
at org.python.core.PyException.<init>(PyException.java:61)
at org.python.core.Py.TypeError(Py.java:221)
at org.python.core.Py.tojava(Py.java:501)
at org.python.core.PyBeanProperty._doset(PyBeanProperty.java:63)
at org.python.core.PyObject.__set__(PyObject.java:3678)
at org.python.core.PyObject.object___setattr__(PyObject.java:3742)
at org.python.core.PyObject.object___setattr__(PyObject.java:3732)
at org.python.core.PyObject$object___setattr___exposer.__call__(Unknown Source)
at org.python.core.PyObjectDerived.__setattr__(PyObjectDerived.java:990)
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper.__setattr__(PyComponentWrapper.java:139)
at org.python.pycode._pyx67.f$0(<event:internalFrameOpened>:2)
at org.python.pycode._pyx67.call_function(<event:internalFrameOpened>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1261)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:539)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:155)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:266)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy19.internalFrameOpened(Unknown Source)
at javax.swing.JInternalFrame.fireInternalFrameEvent(Unknown Source)
at javax.swing.JInternalFrame.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at javax.swing.JComponent.setVisible(Unknown Source)
at com.inductiveautomation.factorypmi.application.FPMIApp$RuntimeWindowOpener.openWindow(FPMIApp.java:1573)
at com.inductiveautomation.factorypmi.application.FPMIApp.openWindow(FPMIApp.java:883)
at com.inductiveautomation.factorypmi.application.script.builtin.SecurityUtilities._tempReOpen(SecurityUtilities.java:206)
at com.inductiveautomation.factorypmi.application.runtime.UpdateProjectPane.uninstall(UpdateProjectPane.java:101)
at com.inductiveautomation.factorypmi.application.runtime.UpdateProjectPane$1.stepsFinished(UpdateProjectPane.java:89)
at com.inductiveautomation.ignition.client.launch.AbstractStepRunner$1.run(AbstractStepRunner.java:40)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.5.1 (b1122)
Java: Sun Microsystems Inc. 1.6.0_31
AddPunto.proj (17.4 KB)




That internalFrameOpened script needs to be modified to send the proper datatype to that property, since the property is expecting an int. Changing the script so that it takes the float value and casts it as an int should work:

system.gui.getParentWindow(event).getComponentForPath('Root Container.AddEditContainer.Numeric Text Field').intValue = int(system.gui.getParentWindow(event).getComponentForPath('Root Container').Velocidad)

Thanks very much James!!! :smiley: :prayer: it works!!! Have a good day :slight_smile:

Caritoel27