Open paddymul opened 8 months ago
After more investigation I was able to make this work.
parent_process = psutil.Process().parent()
server_start_time = dtdt.fromtimestamp(parent_process.create_time())
buckaroo_mtime = dtdt.fromtimestamp(os.path.getmtime(__file__))
if buckaroo_mtime > server_start_time:
print("""It looks like you installed Buckaroo after you started this notebook server. If you see a message like "Failed to load model class 'DCEFWidgetModel' from module 'buckaroo'", restart the jupyter server and try again. If you have furter errors, please file a bug report at https://github.com/paddymul/buckaroo""")
print("buckaroo_mtime", buckaroo_mtime, "server_start_time", server_start_time)
For new users of my custom widget, the experience of seeing a JS based error saying
"widget: model not found"
is frustrating and confusing.I want to display a message like
From my understanding the python package installs properly, but the js is registered as a lab extenstion. By checking the server start time, and the package MTime, we can decide if a user is in this state and message appropriately when the package is imported or the widget used.
I don't know how to find the controlling jupyterlab server, and have filed a bug asking for help with that.
This code will be useful for all custom widgets.
https://github.com/jupyterlab/jupyterlab/issues/15918