jupyter / atom-notebook

[Deprecated] Jupyter Notebook, but inside Atom.
MIT License
306 stars 48 forks source link

Uncaught TypeError: outputs[index].data.concat is not a function #37

Open smarionni opened 8 years ago

smarionni commented 8 years ago

Was trying to test it out and ran into the following issue (posted below). I'm running OS X 10.9.5. Python 2 and 3 installed via homebrew. All packages installed via pip.

  1. First cell, ran import pandas as pd. No problem.
  2. Next cell, just to test it, ran pd.DataFrame(). Got the error below
  3. If I instead assign it to a variable and then ask it to return the variable (i.e. run a = pd.DataFrame() and in the next cell run a) it works fine.

Output below automatically generated from the error reporting


Atom Version: 1.5.3 System: Mac OS X 10.9.5 Thrown From: jupyter-notebook package, v0.0.9

Stack Trace

Uncaught TypeError: outputs[index].data.concat is not a function

At /Users/$USER/.atom/packages/jupyter-notebook/lib/notebook-editor.js:125

TypeError: outputs[index].data.concat is not a function
    at Object.NotebookEditor.onAction [as ID_1] (/Users/$USER/.atom/packages/jupyter-notebook/lib/notebook-editor.js:125:59)
    at Dispatcher._invokeCallback (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/flux/lib/Dispatcher.js:198:24)
    at Dispatcher.dispatch (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/flux/lib/Dispatcher.js:174:14)
    at future.onIOPub (/Users/$USER/.atom/packages/jupyter-notebook/lib/notebook-editor.js:192:20)
    at KernelFutureHandler._handleIOPub (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/jupyter-js-services/lib/kernel.js:1273:13)
    at KernelFutureHandler.handleMsg (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/jupyter-js-services/lib/kernel.js:1252:22)
    at Kernel._onWSMessage (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/jupyter-js-services/lib/kernel.js:786:24)
    at WebSocket._ws.onmessage (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/jupyter-js-services/lib/kernel.js:752:53)
    at WebSocket.onMessage (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/WebSocket.js:418:14)
    at emitTwo (events.js:87:13)
    at WebSocket.emit (events.js:172:7)
    at Receiver.ontext (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/WebSocket.js:816:10)
    at /Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:477:18
    at Receiver.applyExtensions (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:364:5)
    at /Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:466:14
    at Receiver.flush (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:340:3)
    at Receiver.opcodes.1.finish (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:482:12)
    at Receiver.expectHandler (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:457:31)
    at Receiver.add (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/Receiver.js:95:24)
    at Socket.realHandler (/Users/$USER/.atom/packages/jupyter-notebook/node_modules/ws/lib/WebSocket.js:800:20)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20)

Commands

     -2:31.8.0 core:backspace (atom-text-editor.editor.is-focused)
     -2:31.3.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
     -2:31.3.0 core:cancel (atom-text-editor.editor.is-focused)
     -2:04.5.0 core:copy (div.cell-display-area.native-key-bindings)
     -0:36.1.0 jupyter-notebook-atom:run (atom-text-editor.editor.is-focused)
  7x -0:32.1.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:28.1.0 jupyter-notebook-atom:run (atom-text-editor.editor.is-focused)
     -0:25.6.0 core:backspace (atom-text-editor.editor.is-focused)
  2x -0:25.2.0 jupyter-notebook-atom:run (atom-text-editor.editor.is-focused)
     -0:12 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
     -0:12 snippets:expand (atom-text-editor.editor.is-focused)
  5x -0:11.2.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:09.3.0 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
     -0:09.3.0 snippets:expand (atom-text-editor.editor.is-focused)
     -0:09.3.0 editor:indent (atom-text-editor.editor.is-focused)
  5x -0:08.5.0 core:backspace (atom-text-editor.editor.is-focused)

Config

{
  "core": {},
  "jupyter-notebook": {
    "jupyterPath": "/usr/local/bin/jupyter"
  }
}

Installed Packages

# User
jupyter-notebook, v0.0.9

# Dev
No dev packages
gnestor commented 8 years ago

It sounds like whatever is being returned from the kernel is causing outputs[index].data to return a string vs. array, hence the error. We are about to refactor a lot of the code for atom-notebook so I'm going to hold off on investigating this particular issue. The offending line is https://github.com/jupyter/atom-notebook/blob/master/lib/notebook-editor.js#L125 so if you're feeling adventurous, you can cross reference the atom-notebook logs (in Atom's Dev Tools console) with this line. Even better, you can tell Dev Tools to break on caught exceptions and inspect outputs[index].data to get a better idea of what's going on.