Invoking Python Method inside of For Each Loop

I am looping through an array of tuples of two strings. I pass the first item of an instance of a tuple inside of a for each loop to an ‘Invoke Python Method’ activity. For some reason, the automation gets stuck at the ‘Invoke Python Method’ activity.

When I use the exact same code, but rather than looping through an array of tuples of two strings, I loop through an array of strings, everything works perfectly.

I am attaching my code. Any feedback would be much appreciated!
Invoke Python Method.zip (40.7 KB)

Hello @Rullah!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

Hi All,

If anyone has time to look into the matter above, it would be greatly appreciated. I noticed the following members have responded to similar inquiries in the past:

@StefanSchnell @Sergiu.Wittenberger @loginerror

I think this would be a very fruitful exercise for all!

Thank you in advance.

@Rullah

Hello Rullah,
the normalizer package is not available.
Best regards
Stefan

image

1 Like

Hi Stefan,

My apologies for not uploading the Normalizer. Please see attached:

Normalizer - Copy.zip (10.7 KB)

Regards,
Nasar

@Rullah

Hello Rullah,
to understand your approach correct, let me ask about the differences.

On the one hand you have this …

Tuple<string, string>[] str4SequenceDiff = {
  Tuple.Create("Tor", "Tier"),
  Tuple.Create("Ball", "Knall"),
  Tuple.Create("Hase", "Nase")
};

… and on the other hand you have this.

string[] str4SequenceDiff = {
  "Tor", "Tier",
  "Ball", "Knall",
  "Hase", "Nase"
};

Is that correct?

Thanks and best regards
Stefan

Yes, this is exactly correct. I store Item1 of the Tuple into a variable called “secondText.” The word that I am comparing it to is a regular variable called “secondText.” I then pass the variables into the “InputParameters” property of the Invoke Python Method activity as an iEnumerable:

InputParamters: {firstText, secondText}

When I run the automation, it gets stuck at the InvokePython method. I end up stopping the run. That is why I do not have an error message that is of any value. I think there is something about storing an Item of a tuple into a variable and then passing it into the Invoke Python Method that is causing the issue.

Please see attached screenshot of Invoke Python Method’s properties.

InputParameters

@Rullah

Hello Rullah,
I defined this sequence variables:

And this in the Invoke Code activity:

And I get this error:

image

It seems that there are a problem with this kind of data type.

Best regards
Stefan

Thank you Stefan. Much appreciated. I came to a similar conclusion but wanted to verify. I think this might be something we should notify UiPath about. @system

Is this a feature which will be added to later versions of UiPath?

1 Like