I’ve been working on an error message for a form. When the user forgets to fill out a part of the form a docked window should show up with a dynamically changing message telling the user what part still need to be filled.
However my code is spitting out an error that I don’t understand. Here it is:
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "<function:runAction>", line 5, in runAction
File "<custom-method Add>", line 95, in Add
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: UUID string too large
caused by org.python.core.PyException
Traceback (most recent call last):
File "<function:runAction>", line 5, in runAction
File "<custom-method Add>", line 95, in Add
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: UUID string too large
caused by IllegalArgumentException: UUID string too large
This is my code:
import time
params = {"Text":ErrorStr, "bgColor":"#FF0000", "Color":"#000000"}
system.perspective.openDock("Error", params)
time.sleep(5)
system.perspective.closeDock("Error")
The view has a DockID that matches the one in the code.
Does anyone have an idea what might be the problem?
It looks like you’re passing the arguments in a positional fashion, which means that “Error” is being interpreted as the id
argument, and your params
variable is being interpreted as the sessionId
argument.
Try this and see if it works.
system.perspective.openDock(id="Error", params=params)
That seems to have solved it. No error message anymore.
Thanks!
That being said, the dock still doesn’t open, I’m guessing that might be because I’m trying to open it from a pop-up?
That shouldn’t matter. Have you created a Docked View for the Page which is currently visible, AND specified that this dock’s id is “Error”?
I’m pretty sure I do, unless I’ve overlooked something. This is on shared settings.
That should be absolutely fine.
Some things to check:
- This won't work in the Designer - it only works in Sessions.
- Verify the View path is accurate.
- Check the Gateway logs to verify there isn't an issue executing the script.
- Make sure you've saved the project.
- I just noticed that there is an
ErrorStr
variable in your params
object, but I don't see that defined anywhere
Well, after checking all those things seemed to already be in order, but I made sure anyway. It seems to work now and show the custom error message. It seems to also close the popup after closing so that’s a bit of a problem, but it’s better than it was before.
As for the ErrorStr
, the parameter is called Text
and ErrorStr
is the variable I’m passing into it. It’s a HTML string that gets filled with a different message depending on what is missing from the form.
I was just letting you know that I don’t see that variable defined in your script before you use it, so I was expecting it to possibly fail.
I just tried your code (minus the params) and my Popup did not close. Consider checking that you don’t have some other code somewhere designed to close your Popup.
Fair enough
I only posted the relevant part of my code.
You’re right, another piece of code closes it. That solves that then.
Thank you, it should all work properly now.
For future reference, if you’re providing stacktraces which include line numbers please include the full code. If you’re worried about private data or security, you have the option of providing code through direct message.