nikitakit / hydrogen-python

Python-specific plugin for hydrogen. Make Python coding in the Atom editor even more interactive!
https://atom.io/packages/hydrogen-python
MIT License
54 stars 20 forks source link

Uncaught TypeError: Cannot read property 'replace' of null #14

Open yossibokorbleile opened 6 years ago

yossibokorbleile commented 6 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.30.0 x64 Electron: 2.0.5 OS: Mac OS X 10.13.6 Thrown From: hydrogen-python package 0.0.7

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of null

At /Users/Yossi/.atom/packages/hydrogen-python/lib/main.js:186

TypeError: Cannot read property 'replace' of null
    at PythonKernelMod.execute (/packages/hydrogen-python/lib/main.js:186:17)
    at MiddlewareAdapter.execute (/packages/Hydrogen/lib/kernel.js:149:24)
    at Kernel.execute (/packages/Hydrogen/lib/kernel.js:287:33)
    at Object._createResultBubble (/packages/Hydrogen/lib/main.js:391:12)
    at /packages/Hydrogen/lib/main.js:487:14)
    at /packages/Hydrogen/lib/main.js:488:8
    at arrayEach (/packages/Hydrogen/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/packages/Hydrogen/node_modules/lodash/lodash.js:9342:14)
    at Object._runAll (/packages/Hydrogen/lib/main.js:482:7)
    at Object.runAll (/packages/Hydrogen/lib/main.js:462:12)
    at HTMLElement.hydrogenRunAll (/packages/Hydrogen/lib/main.js:106:40)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:384:49)
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:152:35)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:413:26)
    at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:118:20)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:110:40)

Commands

  5x -1:14 core:move-down (input.hidden-input)
  3x -1:08.4.0 hydrogen:run-and-move-down (input.hidden-input)
  6x -1:05.6.0 core:move-up (input.hidden-input)
  8x -1:03.6.0 hydrogen:run-and-move-down (input.hidden-input)
     -0:43.4.0 core:select-all (input.hidden-input)
     -0:42.6.0 command-palette:toggle (input.hidden-input)
     -0:41.2.0 core:confirm (input.hidden-input)
     -0:41.1.0 hydrogen:run (input.hidden-input)
     -0:36.5.0 command-palette:toggle (input.hidden-input)
     -0:34.2.0 core:move-down (input.hidden-input)
     -0:33.8.0 core:confirm (input.hidden-input)
     -0:33.8.0 hydrogen:run-all (input.hidden-input)
     -0:15.7.0 command-palette:toggle (input.hidden-input)
  4x -0:13.4.0 core:backspace (input.hidden-input)
     -0:02.4.0 core:confirm (input.hidden-input)
     -0:02.4.0 hydrogen:run-all (input.hidden-input)

Non-Core Packages

atom-clock 0.1.16 
atom-webbrowser 2.1.4 
autocomplete-python 1.10.10 
busy-signal 1.4.3 
Hydrogen 2.5.1 
hydrogen-python 0.0.7 
intentions 1.1.5 
language-latex 1.1.1 
latex-tree 0.3.0 
note-book 0.1.0 
pandoc-convert 1.1.1 
platformio-ide-terminal 2.8.4 
python-tools 0.6.9 
script 3.18.1 
scroll-through-time 0.3.0 
skim-displayline 0.0.1 
teletype 0.13.3 
nikitakit commented 6 years ago

Do you have the "Extend Executable Code" setting enabled?

kylebarron commented 6 years ago

@nikitakit it might be helpful to have a section of the issue template that asks for the enabled settings.

yossibokorbleile commented 6 years ago

@nikitakit I didn’t the first time, but I enabled the optioned and the issue persists.

nikitakit commented 6 years ago

@yossibokor Since you seem to be running into this repeatedly, is there a set of steps I could use to reproduce?

The ideal case would be a snippet/file I could open in a new Atom tab, and instructions on what commands to run that trigger the bug.

phromo commented 5 years ago

this is due to having empty cells - most commonly obtained through placing a final # %% at the end of the file. I have submitted a PR.

Ibanaut commented 5 years ago

it also is thrown when only imports are in one cell.