Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Does not work when called in file (not directly in REPL) #163

Open
essenciary opened this issue Oct 13, 2016 · 3 comments
Open

Does not work when called in file (not directly in REPL) #163

essenciary opened this issue Oct 13, 2016 · 3 comments

Comments

@essenciary
Copy link

When doing julia -L the_file.jl if within the file I attempt Gallium.breakpoint(function_name) it crashes with UndefVarError(:active_repl)

@DatName
Copy link

DatName commented Oct 31, 2016

The same exception rises when called "breakpointed" function from within Juno. More specifically:
"in RunDebugREPL at ASTInterperter\src\ASTInterpreter.jl:1565".

This happens on Windows platform, Julia version is

Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)

Gallium version is 0.0.4
ASTInterpreter version is 0.0.4

@mm3509
Copy link

mm3509 commented Jun 7, 2018

I have the same problem and a helpful comment on StackOverflow pointed me here. I do research in Julia with literate analysis: text, code, and results live in the same document, and the results in sync with the code (similar to R-markdown, e.g. in RStudio). I can have the files in either Emacs Org-mode with Org-babel or in Jupyter with IJulia. I tried Gallium and it works well in a shell session, but not in Emacs or Jupyter. In both cases I get:

ERROR: UndefVarError: active_repl not defined
Stacktrace:
 [1] RunDebugger(::Array{ASTInterpreter2.JuliaStackFrame,1}) at ~/.julia/v0.6/DebuggerFramework/src/DebuggerFramework.jl:238

@dgenin
Copy link

dgenin commented Dec 7, 2018

I ran into the same issue on Julia 0.6.2 and Gallium 0.1.0. I found that I could resolve the issue by adding code from https://github.com/Keno/Arsenic.jl/blob/master/bin/attach.jl to the program

if !isdefined(Base, :active_repl)
    term = Base.Terminals.TTYTerminal(get(ENV, "TERM", @static is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
     active_repl = Base.REPL.LineEditREPL(term, true)
     eval(Base,:(active_repl = $active_repl))
     eval(Base,:(have_color = true))
     eval(Base,:(is_interactive = true))
end

It's a hack but it seems to work and given that no one has looked at this in over 2 years it is probably the best anyone is likely to get.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants