Email script no longer works - Cannot coerce value array

I have an email report that stopped working a few months ago. Ive just got around to trying to get it working again and Ive found for some reason Im getting an error related to the email attachment “Cannot coerce value '[array”

this code worked without issues a few months back and im not sure what has changed.

here is a snippet of the code

path = "//Public//Equipment//Email Charts//GR1.jpg" GR1_chart = system.file.readFileAsBytes(path) GR1_name = "Grinding Robot history.jpg" system.net.sendEmail("owa.abc.com", "Equipment_Monitor@abc.com", "Daily Runtime Report for Belt Grind", body, 1, recipients,[GR1_name],[GR1_chart])

here is the compact version error:

[code]Traceback (most recent call last):

File “”, line 183, in

File “”, line 181, in main

java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value ‘[array(‘b’, [-119, 80, 78, 71, 13, 10, …-126])]’ into type: class [Ljava.lang.String;

Ignition v7.7.4-beta2 (b2015030909)
Java: Sun Microsystems Inc. 1.6.0_31
[/code]

Can anyone help me out on this? I was going to call in and open a ticket later - but hoping it was something that could be resolved here.

Have you tried using print statements to help debug this? It looks like you have a parameter that is the wrong type.

print type(body)
print type(recipients)
print type(GR1_name)
print type(GR1_chart)

Compare the printed type to the data types for the parameter of system.net.sendEmail and see if there is a mis-match.

cja7928, it’s the hazard of using betas. :blush:

I’m going to guess that beta-2 was when “priority” was added to system.net.sendEmail, and it got added in the middle, between “to” and “attachmentNames”. It was caught before the RC, but made it into the beta.

I would suggest upgrading to the final release version of 7.7.4. If you can’t do that, change your script to use the keyword-style invocation.

Thank you very much. Ill see if our IT guys are willing to upgrade to 7.7.4