Hi guys, this is my first post with a super-newbie question I’d like to ask:
As you may have noticed, I’m new to Julia and I have been coding with Java for a year.
I’d like to get user-input just like in Java but I’m struggling with it.
I’ve tried to use the readline() function: it works great on files, works great on REPL only too, but inside Juno is quite messy
Here is an example inside Juno:
name = readline()
println(name)
This is what I get on console as a result:
julia> asdf
julia> ERROR: UndefVarError: asdf not defined
However, if I do everything on REPL directly, it works fine:
julia> name = readline()
asdf
"asdf"
julia> print(name)
asdf
julia>
What can I do to fix this?
I’m sorry if I got something wrong while writing this post… I do not use blogs very often.
Thanks!
Checked now with a new file, put some julia code into it, and used the “Run all” icon on the left side. Doesn’t work very well, even with no user input it doesn’t run the commands reliable. With user input it seems just to be worse than without.
Same with context menu “Juno” → “Run Block”.
I tried now with VisualCode and it seems to be the same or similar problem.
I guess it is difficult to properly route the STDIN and STDOUT streams through whatever is done by Juno/Atom or VisualCode.
You could run your file in a shell/terminal from Juno with e.g.
That’s a Juno bug that’s mostly fixed with the latest release (Juno 0.12). There’s still a problem with the first line not being printed properly though. Will try to get that fixed today.
First, thank for all the replies!
Second, in order:
You could run your file in a shell/terminal from Juno with e.g.
C:\Users\YOUR_NAME\AppData\Local\Julia-1.3.1\bin\julia.exe .\test.jl
I’m on windows too and I downloaded Julia + juno/atom from the JuliaPro 1.3.1-1 installer from the official website.
Weird thing is that this kind of installation is spread quite everywhere:
JuliaPro-1.3.1-1 folder in C:\
julia folder in C:\Users. This is even more hilarious because at some point I’ve found the folder “padding_some_junk_value” and other creative stuff
JuliaPro_Juno_1.3.1-1, .julia, .juliarPro folders in C:\Users\Lorenzo\
Moral of the story, I could’t find what you suggested with the path provided…
I tried this one too:
With atom/juno provided on JuliaPro 1.31-1 doesn’t work.
I really don’t know what I’m missing…
Just searching for a “julia.exe” may bring up the proper path to yours.
Tried it here, used Windows Explorer, selected C:\, entered julia.exe in the search field, waited quite a while (~2min) and my (multiple) pathes to a julia.exe came up.
In general: Julia is a young language (still), the integrated developing environment(s) (IDEs) are still younger, compared to other worlds like python or R. This fact requires some patience and personal initiative from us users and developers to work around some of the still existing issues. But be assured it will be rewarded! (just saying in case you are already loosing some patience).
Right, regarding the location of the julia binary in JuliaPro: ...\JuliaPro-1.2.0-1_build-236\Julia-1.2.0\bin\julia.exe (adapted for the version of Julia you’re running, of course) shoud be what you’re looking for, where ... is the directory you installed JuliaPro into.
Hi! Here I am again with some “news”… I really hope I don’t bother you too much.
Since JuliaPro is some versions behind for stability and I couldn’t upgrade to the just released latest version of Juno, I uninstalled everything successfully, and installed the whole thing again following these instructions: http://docs.junolab.org/latest/man/installation/
Now I’m running files with the “include(“filepath”)” function on REPL and everything goes fine, even the readline() function now seems flawless. Thanks again pfitzseb.
However, I’ve found a problem the “Run all” button in Juno, in particular, with these combination of commands, it happens the following:
“run all”: “julia>” disappears from REPL
“Stop julia” works as expected
“Enter” to start Julia again will lead into this
However, now I’m happy since I know how to make the stuff work, but I thought It was worth noticing that there is a weird behaviour behind the “run all” button.
Thanks again!