# How can I coding runtime message in Rhino 8 's Grasshopper SDK?

**URL:** <https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039>\
**Category:** Grasshopper Developer\
**Tags:** windows, python\
**Created:** [April 14, 2024, 1:51pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039 "2024-04-14T13:51:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NongKode](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nongkode/32/560108_2.png) [@NongKode](https://discourse.mcneel.com/u/NongKode)\
**Post date:** [April 14, 2024, 1:51pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/1 "2024-04-14T13:51:35Z")

</div>

I have try to convert program from Grasshopper in Rhino 7 with IronPython to Grasshopper in Rhino 8 with both IronPython and Python3 but not successful.

This error are intend after compiled it to a component

It would be great if anyone can suggest me on how to fixed it.

Here are what I have try

There are 5 different source:

- **Code A** , SDK and Class(component) with ghenv.Component in class

```auto
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper
import System
import Rhino
import rhinoscriptsyntax as rs

class MyComponent(component):
    
    def RunScript(self, x, y):
        a = 1
        blWarn = ghenv.Component.RuntimeMessageLevel.Warning
        ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
        ghenv.Component.Message = "Component Message"
        return a

```

- **Code B** , SDK and Class(component) but use self instead of ghenv.Compoent in class

```auto
from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper
import System
import Rhino
import rhinoscriptsyntax as rs

class MyComponent(component):
    
    def RunScript(self, x, y):
        a = 1
        blWarn = self.RuntimeMessageLevel.Warning
        self.AddRuntimeMessage(blWarn, "Balloon Message")
        self.Message = "Component Message"
        return a

```

- **Code C** , SDK and Class(GH\_ScriptInstance) with ghenv.Compoent in class

```auto
import System
import Rhino
import Grasshopper

import rhinoscriptsyntax as rs

class MyComponent(Grasshopper.Kernel.GH_ScriptInstance):
    def RunScript(self, x, y):
        blWarn = ghenv.Component.RuntimeMessageLevel.Warning
        ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
        ghenv.Component.Message = "Component Message"
        a = 1
        
        return a

```

- **Code D** , SDK and Class(GH\_ScriptInstance) but use self instead of ghenv.Compoent in class

```auto
import System
import Rhino
import Grasshopper

import rhinoscriptsyntax as rs

class MyComponent(Grasshopper.Kernel.GH_ScriptInstance):
    def RunScript(self, x, y):
        blWarn = self.RuntimeMessageLevel.Warning
        self.AddRuntimeMessage(blWarn, "Balloon Message")
        self.Message = "Component Message"
        a = 1
        
        return a

```

- **Code E** , Procedure Mode with ghenv.Compoent

```auto
blWarn = ghenv.Component.RuntimeMessageLevel.Warning
ghenv.Component.AddRuntimeMessage(blWarn, "Balloon Message")
ghenv.Component.Message = "Component Message"
a = 1

```

* * *

**On Rhino 7**

- Complied Component with **Code A** will give an error  
 ![RH7_ghenv](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/5/e/25e3a6bcc0bd6ff668aa6668df9741d54d913d66.png)

- Complied Component with **Code B** are **working properly**.

* * *

**On Rhino 8**  
Build Target is Rhino 8

- Complied Component with **Code A** or **Code C** , will give an error  
 ![RH8_A](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/2/5/f25784fff664663b70f805f700712929d31ff8b7.png)

- **Code B** or **Code D** , Can’t Compile as an error  

- Complied Component with **Code E** are **working properly**. !!! this in procedure mode

* * *

Here are test overview and attached code

 ![RH_Overview](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/f/9/bf9c7bbf9e1b7f7016acecd716a898a110e77bf6.png)

[rh8\_message.zip](https://discourse.mcneel.com/uploads/short-url/t51fSwvZQNCO5ueCtUEdihEcuyi.zip) (80.5 KB)

Thank you very much

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [April 18, 2024, 8:13pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/4 "2024-04-18T20:13:06Z")

</div>

Hello @NongKode

I made a GH definition here that shows how these scripts can work or not work. I left notes close to each one for your information. The C# component has a bug that I will get that fixed, but this should clear up the confusion:

 ![Rhino_KLUUQMK39K](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/e/e/bee342f6ea2a537eca23502947736613113246d1.png)

[test\_sdkMode.ghx](https://discourse.mcneel.com/uploads/short-url/9AYUSgqwRZas6ZHUPieZbEsrEk3.ghx) (468.7 KB)

Let me know if you still have questions and I’d be happy to clarify more

---

<div class="post-metadata">

**Author:** ![NongKode](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nongkode/32/560108_2.png) [@NongKode](https://discourse.mcneel.com/u/NongKode)\
**Post date:** [April 19, 2024, 3:48pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/5 "2024-04-19T15:48:33Z")

</div>

Hi @eirannejad

Thank you very much for your precious time and answer 🤩

The problem are occur on **Complied SDK Type**

I have select 3 component from your example

- CODE A : Cleaner (SDK)
- CODE C (SDK)
- CODE E : Cleaner

 ![toBuild](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/c/1/2c14960ea9959e81485a09a312a520725c0d7397.png)

and complied as upper image, Do I miss some thing while complie it ?

then the result of them are error on SDK component but not on Script

 ![Complied](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/5/c/2/5c2eaed333c2d48f174d888b40744fb44ddade0d.png)

all related files are attatched  
[test\_sdkMode.zip](https://discourse.mcneel.com/uploads/short-url/ftDULWDbKpEspwGNFbIh5McfBsI.zip) (284.7 KB)

```auto

```

If you not mind would you please also suggest on this topic 🙏

> [@How to avoid input parameter failed to collect data warning?](https://discourse.mcneel.com/t/how-to-avoid-input-parameter-failed-to-collect-data-warning/180033):
>
> I would like to simply default input value, user not wire anything, on Compiled component In Rhino 7 it’s working fine without any warning information [Input\_RH7.ghx](https://discourse.mcneel.com/uploads/short-url/x2yCu9bG4Ds2nXvfXgGcpY2LRZb.ghx) (29.9 KB) But in Rhino 8 there are always warning “input parameter failed to collect data” [Input\_RH8.ghx](https://discourse.mcneel.com/uploads/short-url/vuzTjAUKSNtpdWvu7b1lKKPFkw.ghx) (56.8 KB) Would you please help how can I avoid this warning ? Thank you very much

Best Regards

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [April 19, 2024, 3:52pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/6 "2024-04-19T15:52:56Z")

</div>

Oh I see so this is with published components. Okay let me look into it. I’ll update here.

[RH-81638](https://mcneel.myjetbrains.com/youtrack/issue/RH-81638) Published python components are missing ghenv

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [April 19, 2024, 4:40pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/7 "2024-04-19T16:40:24Z")

</div>

Ok. I made a fix for this and will be available in next 8.7 RC build

Thanks for reporting!

---

<div class="post-metadata">

**Author:** ![brian](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/brian/32/504171_2.png) [@brian](https://discourse.mcneel.com/u/brian)\
**Post date:** [April 23, 2024, 10:50pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/8 "2024-04-23T22:50:08Z")

</div>

[RH-81638](https://mcneel.myjetbrains.com/youtrack/issue/RH-81638) is fixed in [Rhino 8 Service Release 7 Release Candidate](https://discourse.mcneel.com/t/rhino-8-service-release-candidate-available/168233/9999/)

---

<div class="post-metadata">

**Author:** ![dan](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dan/32/481637_2.png) [@dan](https://discourse.mcneel.com/u/dan)\
**Post date:** [May 14, 2024, 9:13pm UTC](https://discourse.mcneel.com/t/how-can-i-coding-runtime-message-in-rhino-8-s-grasshopper-sdk/180039/9 "2024-05-14T21:13:27Z")

</div>

[RH-81638](https://mcneel.myjetbrains.com/youtrack/issue/RH-81638) is fixed in [Rhino 8 Service Release 7](https://www.rhino3d.com/download/rhino/8/latest).
