Hello,
I am trying to regularly update the scene based off this tutorial:
However even when it just prints while it runs fine for a few minutes it always ends up giving me the error
OSError:Errno22 Invalid argument
I tried making argument for on_update optional, ie giving it a default value, and the same thing happened. The only way to get things to work again is to restart omniverse code.
Any advice on why it might be crashing with an invalid argument error after a few minutes of working fine?
Thank you
Hi @paz.zait-givon . I believe this happens on hot-reload if you are not unsubscribing correctly. Make sure you are clearing your subscriptions before or during the extension on_shutdown()
Thank you @mati-nvidia . I wasn’t unsubscribing at all. I tried to remedy that with unsubscribing in on_shutdown.
Unfortunately the problem seems to persist. I dont change the code at all while it is running for these tests.
Am I just unsubscribing in the wrong way? At the wrong time?
Below is the simplified code.
update_stream = omni.kit.app.get_app().get_update_event_stream()
class MyExtension(omni.ext.IExt):
def on_startup(self, ext_id):
print("MyExtension startup")
self.stage = omni.usd.get_context().get_stage()
self._count = 0
self.start_time = datetime.now()
def on_update( e: carb.events.IEvent = None):#,ext_id, e: carb.events.IEvent):
print(f" now is "+str(datetime.now())+" or "+ str(datetime.now()-start_time)+" from start time" )
sub = update_stream.create_subscription_to_pop(on_update, name="My Subscription Name")
def on_shutdown(self):
print(" MyExtension shutdown")
self.sub.unsubscribe()
Hi @paz.zait-givon . Thanks for reporting this. This internal issue is tracking it: OM-48118.
As a workaround, I think you can use carb.log_info
import carb
carb.log_info("Hello World!")
It works effectively the same, but I wasn’t able to reproduce the error with it.
1 Like
system
Closed
December 5, 2022, 6:05pm
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.