hydrogen-python icon indicating copy to clipboard operation
hydrogen-python copied to clipboard

Uncaught TypeError: Cannot read property '3' of undefined

Open idanrichman opened this issue 6 years ago • 4 comments

more generally the problem is "Cannot read property 'x' of undefined" where x is any number...

[Enter steps to reproduce:] simple program. at first it returns 2 when i call abcd(), but the second time i run that line it throws the TypeError

def abcd(): return 2 abcd()

thats it...

Atom: 1.32.1 x64 Electron: 2.0.9 OS: Mac OS X 10.14.1 Thrown From: hydrogen-python package 0.0.7

Stack Trace

Uncaught TypeError: Cannot read property '3' of undefined

At /Users/idanmadlan/.atom/packages/hydrogen-python/lib/main.js:108

TypeError: Cannot read property '3' of undefined
    at isBreakpoint (/packages/hydrogen-python/lib/main.js:108:42)
    at expandCode (/packages/hydrogen-python/lib/main.js:126:41)
    at PythonKernelMod.execute (/packages/hydrogen-python/lib/main.js:179:14)
    at MiddlewareAdapter.execute (/packages/Hydrogen/lib/kernel.js:149:24)
    at Kernel.execute (/packages/Hydrogen/lib/kernel.js:288:33)
    at Object._createResultBubble (/packages/Hydrogen/lib/main.js:391:12)
    at Object.createResultBubble (/packages/Hydrogen/lib/main.js:351:12)
    at Object.run (/packages/Hydrogen/lib/main.js:447:12)
    at HTMLElement.hydrogenRun (/packages/Hydrogen/lib/main.js:105:36)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:347327)
    at KeymapManager.t.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1227580)
    at KeymapManager.t.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1223714)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:282763)

Commands

     -3:01.1.0 autocomplete-plus:activate (atom-text-editor.editor.enable-atom-ide-find-references.is-focused.autocomplete-active)
     -3:00.4.0 hydrogen:run (input.hidden-input)
     -2:33.1.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -0:17 core:select-all (input.hidden-input)
  4x -0:14.5.0 core:backspace (input.hidden-input)
     -0:13.4.0 autocomplete-plus:activate (atom-text-editor.editor.enable-atom-ide-find-references.is-focused.autocomplete-active)
     -0:12.6.0 editor:newline (input.hidden-input)
  6x -0:10.7.0 core:backspace (input.hidden-input)
  2x -0:07.3.0 editor:newline (input.hidden-input)
     -0:06.7.0 core:backspace (input.hidden-input)
     -0:05.4.0 autocomplete-plus:activate (atom-text-editor.editor.enable-atom-ide-find-references.is-focused.autocomplete-active)
     -0:05.0 core:select-all (input.hidden-input)
  2x -0:04.8.0 hydrogen:run (input.hidden-input)
  2x -0:03.4.0 core:move-left (input.hidden-input)
  3x -0:02.9.0 core:move-down (input.hidden-input)
     -0:02.4.0 hydrogen:run (input.hidden-input)

Non-Core Packages

atom-ide-debugger-python 0.7.3 
atom-ide-ui 0.13.0 
atom-python-run 0.9.7 
autocomplete-python 1.11.0 
data-explorer 0.3.1 
Hydrogen 2.6.0 
hydrogen-python 0.0.7 
hyperclick 0.0.0 
ide-python 1.0.0 
multi-cursor 2.1.5 
nbviewer 1.0.2 
script 3.18.1 

idanrichman avatar Nov 04 '18 09:11 idanrichman

Having the same issue with the same traceback at first attempt to start up Hydrogen (first line of shift + enter code).

alextruesdale avatar Nov 13 '18 08:11 alextruesdale

i found out now that when i uncheck the "Extend Executable Code [experimental] the problems disappears

idanrichman avatar Nov 13 '18 12:11 idanrichman

Excellent, thank you. I suppose that means now that that "extend executable code" option is not required for multi-line functions to work?

alextruesdale avatar Nov 13 '18 12:11 alextruesdale

I haven't looked into why this bug is happening (and it doesn't happen for me) but with the extend option turned off, the normal Hydrogen setting is applied, which means that any code block will run completely as long as the following lines are indented.

kylebarron avatar Nov 13 '18 14:11 kylebarron