ipython / ipython/ipykernel

Can't get current instance of IPKernelApp

オープン
#228 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
734
フォーク
412
平均マージ
1日 5時間
マージ済み PR(30日)
8

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。