Python Script Macro Error

Tags: #<Tag:0x00007fd547498648> #<Tag:0x00007fd547498210> #<Tag:0x00007fd547498058>



I have no experience with coding or anything. However, I need to run a python script that is part of a project. The python script keeps returning this error:

I was able to find this ijm file that the python script seems to be using. Here is what I found:

arg = getArgument();
argA = split(arg, ";");

dir1 = argA[0]+"/";
dir2 = argA[1]+"/";
list = getFileList(dir1);
for (i=0; i<list.length; i++) {
	if (endsWith(list[i], '.png')) {
		showProgress(i, list.length);
		run("Auto Threshold", "method=Otsu white show");
		saveAs("png", dir2+list[i]); 
	else {
		print("This is not Image File : "+dir1+list[i]);        

Would someone be able to troubleshoot and tell me how to fix this issue?


The error message suggests that the passed-in argument string is either not correct, or not being split into pieces properly.

Try adding print statements to the macro. Right after the arg = line you can add a line that says print(arg); to show the argument that was passed in. According to the calling Python script, it is supposed to have a semicolon (;) character in there, which then gets split. You can then add print(argA[0]); immediately after the argA = line, to see what the first token of the split arguments looks like.