ipython / ipython/ipykernel

Can't get current instance of IPKernelApp

Đang mở
#228 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
734
Fork
412
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
8

Mô tả

I am launching an application from IPython and as part of that I need to call ``get_connection_file``. This fails however because ``IPKernelApp.instance()`` fails when called in an IPython session:

```python
In [1]: from ipykernel.kernelapp import IPKernelApp

In [2]: IPKernelApp.initialized()
Out[2]: True

In [3]: IPKernelApp.instance()
---------------------------------------------------------------------------
MultipleInstanceError Traceback (most recent call last)
in ()
----> 1 IPKernelApp.instance()

/Users/tom/miniconda3/envs/dev/lib/python3.6/site-packages/traitlets/config/configurable.py in instance(cls, *args, **kwargs)
421 raise MultipleInstanceError(
422 'Multiple incompatible subclass instances of '
--> 423 '%s are being created.' % cls.__name__
424 )
425

MultipleInstanceError: Multiple incompatible subclass instances of IPKernelApp are being created.
```

Is this a bug? Normally if ``initialized()`` is ``True``, this means an instance already exists, so why is ``instance()`` trying to make a new one?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.