HOPs and Jswan

Hi @stevebaer,

I was testing a script in HOPS which uses the JSWAN pluginn. Somehow it does not work.

  1. The Jswan in and output in grasshopper:

  1. The in and output of this script using HOPs:

I found out why Jswan is not working. Hops adds \ to the input text. So Jswan is not able to interpret this text in the right way.

afbeelding

How can I tackle this problem?

In compute the text was formatted like this and Jswan did its job.

Results compute:

Results grasshopper:

This is how json gets encoded as a string inside of other json. I think I can fix this in Hops.

I added this to our issue tracker at

For more details on what is going on here’s a stackoverflow post on the subject

1 Like

@dadandroid are you unescaping your json strings for the trees that you are sending back to Hops from python? I don’t want to mess you up if I start unescaping the strings in Hops

This is basically the thing I would like to have working:

json.gh (4.7 KB)

When I run the same script via compute it works fine. That has to stay that way. But it would be nice if the script acts the same in hops as in compute via python.

For now, you could add a python component after the hops component with a single line script

a = x.decode('string_escape')

and then feed the output of the python component to jswan

1 Like

@stevebaer thanks for considering us. We are mostly working with nested lists converted to json arrays not objects, so I believe the fix will have no effect on our side. In any case we’ll be happy to adapt for the greater good at this point so please don’t hold back on any improvements you see fit about this on our account!

1 Like

Hops 0.7.1 should have this fixed now so you don’t have to manually unescape the json strings returned from calling a remote definition.

1 Like

Hi @stevebaer,

It works nice!
Only one question: One script test turns red when run via Hops. The nice thing is that it generates some information about the error and that it even if it colours red it outputs the desired information. Why does it colours red and not orange or stays gray. The script itself runs fine, although not all pipelines are being used and therefor colour orange.

compute tries to aggregate errors reported in the remote definition and return these to hops for the component to display. If you have a case that you think warnings should be displayed instead of errors, I would need to get a sample so I can see what is going on.