HopsInteger Param broken on output using ghhops-server

Hi,
it’s me again - reporting some very weird behaviour using ghhops-server. Recently, some of my previously working components weren’t working anymore:

After hours and hours of investigation (the error message is not exactly useful) I found that it is currently not possible to use the ´HopsInteger` param as output:

If I ensure floats by calling float() on all the numbers, in conjunction with using HopsNumber instead of HopsInteger, it miraculously starts working again…

I would greatly appreciate it, if somebody (@AndyPayne, @eirannejad, @stevebaer) could look into this, changing all integer outputs to numbers seems a workaround for now, still I am unable to locate the underlying error.

If I can help in any way, please let me know.

[EDIT] Giving up on this, I guess the ghhops-server is just broken and will be left to rot and die like everything else in favour of Rhino 8 development. Would be great if devs were just honest in saying so instead of ghosting bugs.

My theory is that in the advent of Rhino 8, where better Python 3 support was promised, something like Hops doesn’t make sense any more, since it was probably primarily meant as a bridge between the dated IronPython 2.7 and CPython 3. A band-aid for a problem that existed for way too long: missing CPython support.
The support in the Hops subforum is just so bad. Most threads seem to simply get ignored. I frankly don’t get it. Maybe the person in charge left?

This theory is not true. I was trying to take some time off during the holidays and missed Max’s initial post.

I’m relieved!

@efestwin I just tested with

  • ghhops-server code from github
  • Rhino 7
  • Hops 0.15.4 from package manager

I’m using the following to test

@hops.component(
    "/addint",
    name="Add",
    nickname="Add",
    description="Add numbers with CPython",
    inputs=[
        hs.HopsInteger("A", "A", "First number"),
        hs.HopsInteger("B", "B", "Second number"),
    ],
    outputs=[hs.HopsInteger("Sum", "S", "A + B")]
)
def add(a, b):
    return a + b

This appears to be working. Is there something different about the configuration that you are using?

Hi Steve,
my apologies. It’s actually my resolution to let go of my hot temper, so hopefully you’ll all be spared from it in the future :see_no_evil:

Back to troubleshooting, I have run some more tests to try and replicate the problem / solution. Thank you for your example, it actually gave me the right idea (I think…):

Your component runs fine, I have tested with:

  • Rhino 7 (7.25.22326.19001, 2022-11-22)
  • ghhops-server package from PyPi as well as GitHub code
  • Both Flask and simple HTTP Server

However, I was able to replicate the Error by using Rhino.Inside.CPython (it is used in my other components). If I activate it, the error occurs. If I just import rhino3dm instead, the component works fine.

Also, I was able to resolve the problem like this:

@hops.component(
    "/test.IntegerOutput",
    name="tIntegerOutput",
    nickname="tIntegerOutput",
    description="Add numbers with CPython and Test Integer output.",
    inputs=[
        hs.HopsInteger("A", "A", "First number"),
        hs.HopsInteger("B", "B", "Second number"),
    ],
    outputs=[hs.HopsInteger("Sum", "S", "A + B")]
)
def test_IntegerOutput(a, b):
    return System.Int32(a + b)

If I convert explicitly to System.Int32, it works even when using Rhino.Inside.CPython.

Sadly, I don’t even have a clue where to start from here but I’m writing this in the hopes that someone might find this information useful.

Thank you for your help! :pray:

@efestwin I made some adjustments to how the parameters are handled on the output. This makes the manual conversion to System.Int32 unnecessary. I just published the changes in 1.5.4 released here

This code should work with no errors using python or Rhino.Inside.Cpython modes:

@hops.component(
    "/test.IntegerOutput",
    name="tIntegerOutput",
    nickname="tIntegerOutput",
    description="Add numbers with CPython and Test Integer output.",
    inputs=[
        hs.HopsInteger("A", "A", "First number"),
        hs.HopsInteger("B", "B", "Second number"),
    ],
    outputs=[hs.HopsInteger("Sum", "S", "A + B")]
)
def test_IntegerOutput(a, b):
    return a + b
3 Likes

Works perfectly! Thank you so much for fixing this :pray:

2 Likes