First of all, thank you very much @hainm for the development of nglview!
If we use nglview with turning Warning into Exception as
python -W "error" test0.py
where test0.py is
from ase.build import bulk
from nglview.show import show_ase
atoms = bulk("Au")
show_ase(atoms, default=False)
this gives the following error;
Traceback (most recent call last):
File "/Users/ikeda/miniconda3/envs/myenv/lib/python3.10/site-packages/traitlets/traitlets.py", line 1240, in __init__
super().__init__(*super_args, **super_kwargs)
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ikeda/Documents/projects/nglview/test0.py", line 5, in <module>
show_ase(atoms, default=False)
File "/Users/ikeda/miniconda3/envs/myenv/lib/python3.10/site-packages/nglview/show.py", line 85, in show_ase
return NGLWidget(structure, **kwargs)
File "/Users/ikeda/miniconda3/envs/myenv/lib/python3.10/site-packages/nglview/widget.py", line 193, in __init__
super().__init__(**kwargs)
File "/Users/ikeda/miniconda3/envs/myenv/lib/python3.10/site-packages/ipywidgets/widgets/widget.py", line 503, in __init__
super().__init__(**kwargs)
File "/Users/ikeda/miniconda3/envs/myenv/lib/python3.10/site-packages/traitlets/traitlets.py", line 1246, in __init__
warn(
DeprecationWarning: Passing unrecognized arguments to super(NGLWidget).__init__(default=False).
object.__init__() takes exactly one argument (the instance to initialize)
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
This is probably not specific for ase but in general for (at least some) show_xxx commands in nglview; the following shows also a similar error
I found this issue when I try to solve an issue reported in ase (https://gitlab.com/ase/ase/-/issues/1313). That issue itself is not due to nglview, but when I try to add a test for nglview to solve the issue, the problem I described above emerged. This is because in ase a DeprecationWarning is turned into Exception for safe testing. From the ase side, it would be ideal if this DeprecationWarning issue is solved on the nglview side. It may also make sense, because, as written in the error message above, this issue will raise an error from traitlets in future.
First of all, thank you very much @hainm for the development of
nglview
!If we use
nglview
with turningWarning
intoException
aswhere
test0.py
isthis gives the following error;
This is probably not specific for
ase
but in general for (at least some)show_xxx
commands innglview
; the following shows also a similar errorI found this issue when I try to solve an issue reported in
ase
(https://gitlab.com/ase/ase/-/issues/1313). That issue itself is not due tonglview
, but when I try to add a test fornglview
to solve the issue, the problem I described above emerged. This is because inase
aDeprecationWarning
is turned intoException
for safe testing. From thease
side, it would be ideal if thisDeprecationWarning
issue is solved on thenglview
side. It may also make sense, because, as written in the error message above, this issue will raise an error fromtraitlets
in future.