question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConsoleWidget(): `RuntimeError: You can't initialize an object twice!` with traitlets master

See original GitHub issue
from qtconsole.qt import QtGui
from qtconsole.console_widget import ConsoleWidget
QtGui.QApplication.instance() or QtGui.QApplication([])
cw = ConsoleWidget()

Results in

Traceback (most recent call last):
  File "../../canopy-jupyter/scratch.py", line 4, in <module>
    cw = ConsoleWidget()
  File "/home/pankaj/work/enthought/jupyter/qtconsole/qtconsole/console_widget.py", line 214, in __init__
    LoggingConfigurable.__init__(self, **kw)
  File "/home/pankaj/work/enthought/jupyter/traitlets/traitlets/config/configurable.py", line 74, in __init__
    super(Configurable, self).__init__(**kwargs)
  File "/home/pankaj/work/enthought/jupyter/traitlets/traitlets/traitlets.py", line 946, in __init__
    super(HasTraits, self).__init__()
RuntimeError: You can't initialize an object twice!

with traitlets master. This is because of mixing old-style and __init__ call and super __init__ call. Simple git bisect indicated the causal commit to be: https://github.com/ipython/traitlets/pull/174

A solution would be to do things similar to SuperQObject https://github.com/jupyter/qtconsole/blob/master/qtconsole/util.py#L48 , i.e. a SuperQWidget, and probably any other Super qobject subclass which needs to be used in multiple inheritance with HasTraits.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pshchelocommented, Mar 19, 2016

Downgrading traitlets to traitlets==4.1.0 solves the issue.

0reactions
minrkcommented, Mar 20, 2016

I opened #114, which seems to fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues closed in the 1.0 development cycle
Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7. If you are ......
Read more >
IPython Documentation - Read the Docs
IPython has many features for tab-completion, object ... will not allow you to run asynchronous code unless an event loop is specified.
Read more >
github-stats-1.0.txt - IPython
View map() on numpy arrays * :ghpull:`4022`: DOC: fix links to matplotlib, notebook docs * :ghpull:`4018`: Fix warning when running IPython.kernel tests ...
Read more >
IPython Documentation | Manualzz
If your notebook can't live without the popup functionality, subclass the Box widget (both in Python and JS) and use JQuery UI's draggable()...
Read more >
Jupyter-Vim - Coder Social Home
When Vim is using your system python (the default on linux), you can just install ... However, I can't go past below command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found