REPL freezes without error

Pasting a short script into the REPL, it slowly accepts line after line but when it gets to the last line it just freezes there indefinitely.

No errors. No cpu activity. no idication anything is wrong or failing iany detected way just stops and does nothing?

The entire session/program in case it helps diagonse the issue:

julia> using Plots, Interact

julia>

julia> function linear_partition(x, N, r)
           return [x * (i / (N-1))^r for i in 0:N-1]
       end
linear_partition (generic function with 1 method)

julia>

julia> function geometric_partition(x, N, r)
           ratio = r^(1/(N-1))
           first_segment = x * (1 - ratio) / (1 - ratio^N)
           return [first_segment * ratio^i for i in 0:N-1]
       end
geometric_partition (generic function with 1 method)

julia>

julia> function logarithmic_partition(x, N, r)
           return [x * log(i + r) / log(N + r) for i in 1:N]
       end
logarithmic_partition (generic function with 1 method)

julia>

julia> function exponential_partition(x, N, r)
           return [x * (exp(i * r / (N-1)) - 1) / (exp(r) - 1) for i in 0:N-1]
       end
exponential_partition (generic function with 1 method)

julia>

julia> function plot_partitions(N, r)
           x = 10  # Arbitrary total length
           partitions = [
               ("Linear Scaling", linear_partition(x, N, r)),
               ("Geometric Progression", geometric_partition(x, N, r)),
               ("Logarithmic Scaling", logarithmic_partition(x, N, r)),
               ("Exponential Scaling", exponential_partition(x, N, r))
           ]

           p = []
           for (title, part) in partitions
               push!(p, plot(title=title, legend=false, size=(600, 200)))
               for d in part
                   plot!(p[end], [d, d], [0, 50], linewidth=2, color=:black)
               end
           end

           plot(p...)
           end
plot_partitions (generic function with 1 method)

julia>

julia> @manipulate for N in 5:50, r in 0.1:0.1:5
           plot_partitions(N, r)

There are lots of issues with the REPL:

https://github.com/JuliaLang/julia/labels/REPL

For now, my suggestion would be not to paste code into the REPL (at least not more than a few lines) and to use include("my-script.jl") instead.

Thanks for the response. Its more than I got to:

Conclusion. Ditch Julia.

  1. it aint ready for prime time.
  2. you can whilst dixie before getting answers to apparently simple questions.

be well. Buk.

Did you press Return after the last line?

If that is your last input, it is incomplete and for is missing an end. Could be that the REPL is just waiting for the input to complete.

4 Likes

@bertschi’s observation is probably the correct one. Your last input is incomplete, so the REPL is still waiting for the rest of the expression.

I’m sorry another user in this thread gave you the wrong impression that the REPL is buggy and unusable. There are many open issues on Github for every open source language, but those languages are still quite usable.

Regarding the other thread that you linked here and haven’t gotten a response to yet, please keep in mind:

  • This forum is filled with volunteers. No one is payed to respond to your questions.
  • That question is actually unusual and not easy to answer.
1 Like

I paste scripts into the REPL all the time without issue. Furthermore, I don’t think pasting into the REPL was ever an issue.

4 Likes

In that thread maybe people were waiting for your response to the person who already replied about trying v1.11 to see if the issue persists on that version…? Seems disrespectful to the person who replied there to dismiss them like that in this comment.

Anyway, as mentioned the REPL here wasn’t frozen since it was waiting for your input. I haven’t really had any other issues with the REPL, I don’t think just looking at the issue count on the REPL as the first commenter suggests is productive since any big project has lots of open issues.

1 Like

I wish I’d thought of that.

Oh wait. I did. And ctrl-C. And Esc. And a bunch of random keys, but nothing was ever displayed.

And I tried adding a bunch of newlines to the file before C&P. And I added a couple of do nothing lines to the bottom of the file, but they were never displayed; strongly indicating that the REPL was not in an input state.

Maybe I not quite as stupid as I look! (Hang on, you can’t see my face?)

Does this

not indicate that, at the time of my posting here, there had been no responses there?

By all means, check the time line.

No need to be rude, I was just trying to help, you didn’t say what you had tried. And as someone else pointed out you were missing an end at the end which may also explain it.

2 Likes

Thanks for this. It got me further. Unfortunately only as far as:

julia> @manipulate for N in 5:50, r in 0.1:0.1:5 plot_partitions(N, r); end
(div
  Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Scope(Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :label), Any["N"], Dict{Symbol, Any}(:className => "interact ", :style => Dict{Any, Any}(:padding => "5px 10px 0px 10px")))], Dict{Symbol, Any}(:className => "interact-flex-row-left")), Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :input), Any[], Dict{Symbol, Any}(:max => 50, :min => 5, :attributes => Dict{Any, Any}(:type => "range", Symbol("data-bind") => "numericValue: index, valueUpdate: 'input', event: {change: function (){this.changes(this.changes()+1)}}", "orient" => "horizontal"), :step => 1, :className => "slider slider is-fullwidth", :style => Dict{Any, Any}()))], Dict{Symbol, Any}(:className => "interact-flex-row-center")), Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :p), Any[], Dict{Symbol, Any}(:attributes => Dict("data-bind" => "text: formatted_val")))], Dict{Symbol, Any}(:className => "interact-flex-row-right"))], Dict{Symbol, Any}(:className => "interact-flex-row interact-widget")), Dict{String, Tuple{AbstractObservable, Union{Nothing, Bool}}}("changes" => (Observable(0), nothing), "index" => (Observable(27), nothing)), Set{String}(), nothing, Asset[Asset("js", "knockout", "C:\\Users\\ms20b\\.julia\\packages\\Knockout\\HReiN\\src\\..\\assets\\knockout.js"), Asset("js", "knockout_punches", "C:\\Users\\ms20b\\.julia\\packages\\Knockout\\HReiN\\src\\..\\assets\\knockout_punches.js"), Asset("js", nothing, "C:\\Users\\ms20b\\.julia\\packages\\InteractBase\\LJXv3\\src\\..\\assets\\all.js"), Asset("css", nothing, "C:\\Users\\ms20b\\.julia\\packages\\InteractBase\\LJXv3\\src\\..\\assets\\style.css"), Asset("css", nothing, "C:\\Users\\ms20b\\.julia\\packages\\Interact\\PENUy\\src\\..\\assets\\bulma.min.css")], Dict{Any, Any}("changes" => Any[WebIO.JSString("(function (val){return (val!=this.model[\"changes\"]()) ? (this.valueFromJulia[\"changes\"]=true, this.model[\"changes\"](val)) : undefined})")], "index" => Any[WebIO.JSString("(function (val){return (val!=this.model[\"index\"]()) ? (this.valueFromJulia[\"index\"]=true, this.model[\"index\"](val)) : undefined})")]), WebIO.ConnectionPool(Channel{Any}(32), Set{AbstractConnection}(), Base.GenericCondition{ReentrantLock}(Base.IntrusiveLinkedList{Task}(Task (runnable, started) @0x000001d7def09180, Task (runnable, started) @0x000001d7def09180), ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (0, 0, 415243958341)))), WebIO.JSString[WebIO.JSString("function () {\n    var handler = (function (ko, koPunches) {\n    ko.punches.enableAll();\n    ko.bindingHandlers.numericValue = {\n        init: function(element, valueAccessor, allBindings, data, context) {\n            var stringified = ko.observable(ko.unwrap(valueAccessor()));\n            stringified.subscribe(function(value) {\n                var val = parseFloat(value);\n                if (!isNaN(val)) {\n                    valueAccessor()(val);\n                }\n            });\n            valueAccessor().subscribe(function(value) {\n                var str = JSON.stringify(value);\n                if ((str == \"0\") && ([\"-0\", \"-0.\"].indexOf(stringified()) >= 0))\n                     return;\n                 if ([\"null\", \"\"].indexOf(str) >= 0)\n                     return;\n                stringified(str);\n            });\n            ko.applyBindingsToNode(\n                element,\n                {\n                    value: stringified,\n                    valueUpdate: allBindings.get('valueUpdate'),\n                },\n                context,\n            );\n        }\n    };\n    var json_data = {\"formatted_vals\":[\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\",\"33\",\"34\",\"35\",\"36\",\"37\",\"38\",\"39\",\"40\",\"41\",\"42\",\"43\",\"44\",\"45\",\"46\",\"47\",\"48\",\"49\",\"50\"],\"changes\":WebIO.getval({\"name\":\"changes\",\"scope\":\"1519612606536167147\",\"id\":\"2\",\"type\":\"observable\"}),\"index\":WebIO.getval({\"name\":\"index\",\"scope\":\"1519612606536167147\",\"id\":\"1\",\"type\":\"observable\"})};\n    var self = this;\n    function AppViewModel() {\n        for (var key in json_data) {\n            var el = json_data[key];\n            this[key] = Array.isArray(el) ? ko.observableArray(el) : ko.observable(el);\n        }\n        \n        [this[\"formatted_val\"]=ko.computed(    function(){\n        return this.formatted_vals()[parseInt(this.index())-(5)];\n    }\n,this)]\n        [this[\"changes\"].subscribe((function (val){!(this.valueFromJulia[\"changes\"]) ? (WebIO.setval({\"name\":\"changes\",\"scope\":\"1519612606536167147\",\"id\":\"2\",\"type\":\"observable\"},val)) : undefined; return this.valueFromJulia[\"changes\"]=false}),self),this[\"index\"].subscribe((function (val){!(this.valueFromJulia[\"index\"]) ? (WebIO.setval({\"name\":\"index\",\"scope\":\"1519612606536167147\",\"id\":\"1\",\"type\":\"observable\"},val)) : undefined; return this.valueFromJulia[\"index\"]=false}),self)]\n        \n    }\n    self.model = new AppViewModel();\n    self.valueFromJulia = {};\n    for (var key in json_data) {\n        self.valueFromJulia[key] = false;\n    }\n    ko.applyBindings(self.model, self.dom);\n}\n);\n    (WebIO.importBlock({\"data\":[{\"name\":\"knockout\",\"type\":\"js\",\"url\":\"/assetserver/1e46f3305f52559be3c7a4ddd81d149fa54f135c-knockout.js\"},{\"name\":\"knockout_punches\",\"type\":\"js\",\"url\":\"/assetserver/c185fdb51ddee43ce30fffae31f60a66bf22c96d-knockout_punches.js\"}],\"type\":\"async_block\"})).then((imports) => handler.apply(this, imports));\n}\n")])], Dict{Symbol, Any}(:className => "field interact-widget"))
  Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Scope(Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :label), Any["r"], Dict{Symbol, Any}(:className => "interact ", :style => Dict{Any, Any}(:padding => "5px 10px 0px 10px")))], Dict{Symbol, Any}(:className => "interact-flex-row-left")), Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :input), Any[], Dict{Symbol, Any}(:max => 50, :min => 1, :attributes => Dict{Any, Any}(:type => "range", Symbol("data-bind") => "numericValue: index, valueUpdate: 'input', event: {change: function (){this.changes(this.changes()+1)}}", "orient" => "horizontal"), :step => 1, :className => "slider slider is-fullwidth", :style => Dict{Any, Any}()))], Dict{Symbol, Any}(:className => "interact-flex-row-center")), Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Node{WebIO.DOM}(WebIO.DOM(:html, :p), Any[], Dict{Symbol, Any}(:attributes => Dict("data-bind" => "text: formatted_val")))], Dict{Symbol, Any}(:className => "interact-flex-row-right"))], Dict{Symbol, Any}(:className => "interact-flex-row interact-widget")), Dict{String, Tuple{AbstractObservable, Union{Nothing, Bool}}}("changes" => (Observable(0), nothing), "index" => (Observable{Any}(25), nothing)), Set{String}(), nothing, Asset[Asset("js", "knockout", "C:\\Users\\ms20b\\.julia\\packages\\Knockout\\HReiN\\src\\..\\assets\\knockout.js"), Asset("js", "knockout_punches", "C:\\Users\\ms20b\\.julia\\packages\\Knockout\\HReiN\\src\\..\\assets\\knockout_punches.js"), Asset("js", nothing, "C:\\Users\\ms20b\\.julia\\packages\\InteractBase\\LJXv3\\src\\..\\assets\\all.js"), Asset("css", nothing, "C:\\Users\\ms20b\\.julia\\packages\\InteractBase\\LJXv3\\src\\..\\assets\\style.css"), Asset("css", nothing, "C:\\Users\\ms20b\\.julia\\packages\\Interact\\PENUy\\src\\..\\assets\\bulma.min.css")], Dict{Any, Any}("changes" => Any[WebIO.JSString("(function (val){return (val!=this.model[\"changes\"]()) ? (this.valueFromJulia[\"changes\"]=true, this.model[\"changes\"](val)) : undefined})")], "index" => Any[WebIO.JSString("(function (val){return (val!=this.model[\"index\"]()) ? (this.valueFromJulia[\"index\"]=true, this.model[\"index\"](val)) : undefined})")]), WebIO.ConnectionPool(Channel{Any}(32), Set{AbstractConnection}(), Base.GenericCondition{ReentrantLock}(Base.IntrusiveLinkedList{Task}(Task (runnable, started) @0x000001d7df742e90, Task (runnable, started) @0x000001d7df742e90), ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (0, 0, 143376607448)))), WebIO.JSString[WebIO.JSString("function () {\n    var handler = (function (ko, koPunches) {\n    ko.punches.enableAll();\n    ko.bindingHandlers.numericValue = {\n        init: function(element, valueAccessor, allBindings, data, context) {\n            var stringified = ko.observable(ko.unwrap(valueAccessor()));\n            stringified.subscribe(function(value) {\n                var val = parseFloat(value);\n                if (!isNaN(val)) {\n                    valueAccessor()(val);\n                }\n            });\n            valueAccessor().subscribe(function(value) {\n                var str = JSON.stringify(value);\n                if ((str == \"0\") && ([\"-0\", \"-0.\"].indexOf(stringified()) >= 0))\n                     return;\n                 if ([\"null\", \"\"].indexOf(str) >= 0)\n                     return;\n                stringified(str);\n            });\n            ko.applyBindingsToNode(\n                element,\n                {\n                    value: stringified,\n                    valueUpdate: allBindings.get('valueUpdate'),\n                },\n                context,\n            );\n        }\n    };\n    var json_data = {\"formatted_vals\":[\"0.1\",\"0.2\",\"0.3\",\"0.4\",\"0.5\",\"0.6\",\"0.7\",\"0.8\",\"0.9\",\"1.0\",\"1.1\",\"1.2\",\"1.3\",\"1.4\",\"1.5\",\"1.6\",\"1.7\",\"1.8\",\"1.9\",\"2.0\",\"2.1\",\"2.2\",\"2.3\",\"2.4\",\"2.5\",\"2.6\",\"2.7\",\"2.8\",\"2.9\",\"3.0\",\"3.1\",\"3.2\",\"3.3\",\"3.4\",\"3.5\",\"3.6\",\"3.7\",\"3.8\",\"3.9\",\"4.0\",\"4.1\",\"4.2\",\"4.3\",\"4.4\",\"4.5\",\"4.6\",\"4.7\",\"4.8\",\"4.9\",\"5.0\"],\"changes\":WebIO.getval({\"name\":\"changes\",\"scope\":\"11417563150769150633\",\"id\":\"5\",\"type\":\"observable\"}),\"index\":WebIO.getval({\"name\":\"index\",\"scope\":\"11417563150769150633\",\"id\":\"4\",\"type\":\"observable\"})};\n    var self = this;\n    function AppViewModel() {\n        for (var key in json_data) {\n            var el = json_data[key];\n            this[key] = Array.isArray(el) ? ko.observableArray(el) : ko.observable(el);\n        }\n        \n        [this[\"formatted_val\"]=ko.computed(    function(){\n        return this.formatted_vals()[parseInt(this.index())-(1)];\n    }\n,this)]\n        [this[\"changes\"].subscribe((function (val){!(this.valueFromJulia[\"changes\"]) ? (WebIO.setval({\"name\":\"changes\",\"scope\":\"11417563150769150633\",\"id\":\"5\",\"type\":\"observable\"},val)) : undefined; return this.valueFromJulia[\"changes\"]=false}),self),this[\"index\"].subscribe((function (val){!(this.valueFromJulia[\"index\"]) ? (WebIO.setval({\"name\":\"index\",\"scope\":\"11417563150769150633\",\"id\":\"4\",\"type\":\"observable\"},val)) : undefined; return this.valueFromJulia[\"index\"]=false}),self)]\n        \n    }\n    self.model = new AppViewModel();\n    self.valueFromJulia = {};\n    for (var key in json_data) {\n        self.valueFromJulia[key] = false;\n    }\n    ko.applyBindings(self.model, self.dom);\n}\n);\n    (WebIO.importBlock({\"data\":[{\"name\":\"knockout\",\"type\":\"js\",\"url\":\"/assetserver/1e46f3305f52559be3c7a4ddd81d149fa54f135c-knockout.js\"},{\"name\":\"knockout_punches\",\"type\":\"js\",\"url\":\"/assetserver/c185fdb51ddee43ce30fffae31f60a66bf22c96d-knockout_punches.js\"}],\"type\":\"async_block\"})).then((imports) => handler.apply(this, imports));\n}\n")])], Dict{Symbol, Any}(:className => "field interact-widget"))
  Observable(Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[Plot{Plots.GRBackend() n=108}], Dict{Symbol, Any}(:className => "interact-flex-row interact-widget"))))

Which is about as useful as {insert your favourite analogy here}.
(The script was given to me to use with the end missing, and I do not know enough Julia to know if that is good or bad syntax.)

No offense to whoever provided this to you because they may not have owed you more assistance, but they did objectively let you down in a few ways, not just an incomplete expression. The output you see is expected because you’re only in a REPL session. To quote Interact.jl, ā€œit works in Jupyter notebooks, Atom IDE, or as a plain old web page.ā€

Interact has also stagnated, with a latest release in 2022. Stagnated packages aren’t necessarily unusable, but changes to the dependencies or base Julia could have broken things that aren’t getting patched. That’s why good practice for reproducible scripts is providing a project and possibly a manifest file to specify and automatically reproduce the code’s environment (though you would manually have to run the acceptable Julia versions). Source code in any language generally lacks information about dependencies because it is more efficiently specified elsewhere. Is it possible for you to request that information from whoever provided the script (as well as verify a complete script)? Even if they didn’t save a bona fide project file, you could make one if they told you what versions of Julia, Plots, and Interact they used, as that seems to be all the dependencies of the script.