Code doesn't execute

#1

Hi,

I’ve installed Julia and Juno according to the instructions on my laptop and have no problem at all.

Today I tried installing on another PC and it looks ok. But code won’t get executed…

I can type any kind of command in the REPL and it works, but if i create a new File like “test.jl” and write code e.g. println(“test”) and execute it, nothing happens … nothing comes up in the REPL.
Also when I write some code involving variables, they don’t appear in the Workspace.

What can I do to see where the problem is?

#2

I don’t understand what you do. When you write

if i create a new File like “test.jl” and write code e.g. println(“test”) and execute it, nothing happens … nothing comes up in the REPL.

what do you mean by “nothing comes up in the REPL”? If you execute test.jl by julia test.jl, you should not see the REPL at all.

Can you paste the full output of the shell when you run julia test.jl?

Given your description, you currently see this ($ indicating your shell prompt):

$ julia test.jl
$

which I cannot believe :wink:

#3

I’m guessing you mean in Juno? When you execute code inside files in Juno, the results are displayed inline rather than in the repl by default. There is a setting you can toggle to change this (in julia-client I think). But the environment of the file and the repl (assuming you’re using the repl inside atom) share environments, so you should be able to execute x = 4 in the file, then type x in the repl and see 4 as the output.

1 Like
#4

That’s right, I use Juno … i thougt i posted in the Juno board so I didn’t mention that, sorry.

Unfortunately I didn’t find any option in the settings ti change output to the REPL.
I did find “Result display mode” but neither option had the desired effect.

Im fairly new to Julia and Atom/Juno, so forgive my stupidness :wink:

#5

I am seeing the same. I am opening a “project” directory which was created with the generate command in pkg mode.
Currently this is a single-file, and it is not a module. A simple Julia file.
There is more than one way to “run” the file:

(arrow key in the far left vertical command strip)
Top menu: Julia > Run File
Top menu: Julia > Packages > Run File

Occasionally I can get the file to run! I see the output in the REPL.
I have a file with an infinite while loop, and I have to stop it with the “Interrupt Julia” button (Ctrl-C).
The file will no longer run after that, even though the REPL appears to have properly recovered.

Even if I try:
Julia > Stop Julia
Julia > Start Julia

The file will not run. Even if I quit and restart Juno.
I am using Ubuntu 18.04. Julia 1.1.0. Atom 1.36.1 x64.
uber-juno 0.2.0

I can run the file from a terminal, however, it will seg-fault when I Ctrl-C. I can re-start Julia and run it again successfully. But I can’t run at all using the commands of the IDE.

Regards,
Greg

#6

I have it down to the simplest possible case.

Start Juno. Create 2 new files. Add a very simple program like:
File 1:
println(“This is from program 1.”)
File 2:
println(“This is from program 2.”)

Make file 1 active, and run using the > on the left side. It will run.
Julia > Stop Julia
Julia > Start Julia
run file 1
It will not run!
Now make the program 2 active and run it. It will run.
Now make program 1 active and run it. It will run.

So before when I was Ctrl-C (Interrupt Julia) it was stopping Julia,
I would restart Julia, and then my program would not run again.
But simply creating another dummy program and running it, and then
switching back to the original program it will now run!

I think the system should be robust enough to withstand a Ctrl-C and resume normal operations.
For now, I am going to investigate if Julia has a facility to allow a graceful exit from a Ctrl-C interrupt.

Regards,
Greg