Syntax errors at terminal (new installation)

I have just installed Julia and VS code on a Win10 Pro platform. New to both Julia & VSC.
A trial run of a *.jl program off the Net worked fine. So then I tried to experiment with simple commands at the Terminal. I had assumed that the Terminal would respond to interactive use like the CMD console created by running julia.exe directly. But no, the most trivial commands (eg, a = 6, or A = [1 2; 3 4]) cause a variety of different syntax errors. The *.jl files still run perfectly. Is this expected?
If so, where do I read up about the difference between interactive use of the Terminal vs interactive use at the CMD console? Haven’t mastered all the documentation yet …

That shouldn’t happen. How are you starting julia and how did you install it? What errors exactly do you get?

After I installed VS Code, I installed Julia language as an extension that it recognised, from the marketplace search. So then, when I click on a *.jl file, the Julia editor opens and I edit the *.jl file, save it and press Run. All standard practice as far as I know. And the results are what I expect from the code.

But here are the results of 2 simple Terminal commands:
PS D:\3_progdata\prog_lang\Julia> A = [1 2; 3 4]
At line:1 char:13

  • A = [1 2; 3 4]
  •         ~~
    

Unexpected token ‘4]’ in expression or statement.
At line:1 char:14

  • A = [1 2; 3 4]
  •          ~
    

Unexpected token ‘]’ in expression or statement.
+ CategoryInfo : ParserError: (:slight_smile: , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

PS D:\3_progdata\prog_lang\Julia> a = 6
a : The term ‘a’ is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

  • a = 6
  • ~
    • CategoryInfo : ObjectNotFound: (a:String) , CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

I have uninstalled both Julia and VS Code, removed all their directories, reinstalled them, but no change to these errors.

ParentContainsErrorRecordException seems to be a PowerShell error message, so I’m guessing VSCode is trying to run Julia code in PowerShell and never actually started Julia. I don’t know why that would happen.

I can’t come back to this for a few days, but if I find out further details I’ll let you know.

By the way, I also have a problem that others have also reported: every time you run a *.jl file, you see a series of repeats of the same error message in the OUTPUT view:
“Error: there is no registered task type ‘julia-proc’.”
As far as I could see, no-one has found the cause for that one either. Both of these are benign in that they don’t affect the execution of *.jl files.

If you don’t see the julia> prompt, then that particular Terminal window isn’t (yet) running a Julia REPL but an OS shell. So you should start another Julia session (eg by typing the path to the Julia program - see the installation instructions for more information). You can have more than one Terminal, which can be confusing.

4 Likes