Fortran code runs but doesn't display any input - visual-studio-code

Hi I am using Visual Studio code to try to run some fortran code. I have two issues. Firstly, I am able to run the program in the command line using the fortran compiler I have installed (I know it runs as when there is an error it flags it in the command line). However, the issue is that when I put code with no error it runs, however doesn't display the input I expect. This is the code, which I copied from a youtube tutorial.
program Test
implicit none
character*20 :: name
print *, "Name:"
read *, name
print *, name
end program Test
When it is run, the command line command runs and doesn't present an error, but nothing is output, just a new line. Any ideas on what is causing this.
Also I would like to run it directly from Visual Studio Code, however I am unable to link the compiler to VSC. I have done it before with Python code, and when I press F5 it will run, however when I do the same with the fortran file, it just gives a menu:
I have installed the Modern Fortran extension for VSC. Any idea on what is happening?
Thank you in advance.

Related

Elixir: VS Code ExUnit cannot find Mix

I cannot load or run my tests, from within VS Code.
I'm a new user to Elixir, and to VS Code. I'm running Lubuntu 21.10 (Impish). I've downloaded Erlang/OTP 25 (.deb), and Elixir 1.14 (precompiled binary in /usr/share/elixir), and can get anything I need running in a Bash terminal. Again, in a standard QTerminal window,
erl, iex, mix, elixir, etc. all work fine.
In VS Code, however, I get some errors. I feel stupid, but I'm coming from Sublime Text, so please forgive me.
In the left pane of VS Code, ExUnit shows an error (red):
Clicking on this error gives me this, on the bottom right pane. The command line options, passed to mix test, seem to be the default configuration:
This result is bizarre to me, because I can open the integrated terminal, execute /bin/sh, and then run the exact mix test line that's displayed:
/usr/share/elixir/bin has been added to my PATH variable, in ~/.bashrc, ~/.profile, and /etc/environment.
However, I am further confused by all tests being excluded, and wonder if there's some connection to the core issue:
Note that I can run my tests just fine, using different command line options. I've tried adding tags, but that didn't fix the problem.
I tried Google'ing this, and played around with my settings. Here is what I have configured in the "User" settings.json, and I made sure nothing overrides this in "Workspace" settings:
Changing the useNativeTesting setting doesn't solve the problem.
On another (?) note, I get a "failed to run elixir" upon VS Code startup:
Again, I have no problem running commands from a Linux terminal, or from a terminal within VS Code.
Plot twist: If I remove the precompiled Elixir 1.14, and downgrade to an older version, via apt, the problem goes away. But Lubuntu 21.10 doesn't offer Elixir 1.14, and I'm really into using the new dbg() feature.
But for now, I cannot load or run my tests, from within VS Code, apparently because Mix cannot be found.
Thanks to Daniel Imms, from the VS Code team, for answering my question on Twitter:
"Try moving where ever you init mix and elixir (.bashrc?) into your .bash_profile and then logging out and in again or restarting. I'm guessing it's in your bashrc which doesn't run in non-interactive sessions like in tasks."

When working with python, there is no output when I run vs code

For some reason I cannot run python in vs code. This problem is new. I have used vs code before without a problem. When I click run the code appears to run but there is no output. I assume there is a wrong setting somewhere, but I don't know where to start. I am new to vs code and python.

Is there a reason why my VScode CLI doesnt recognise standard commands?

I am inputing commands into my CLI to run my source code yet it doesn't recognise these standard commands. I have updated my includepath, that became effective as I noticed the squiggles no longer appeared under the text in my source code, but I am unable to run my code from the command terminal for some reason. For some context, I am using C language. My question please is what could be the reason why linux os refuses to understand simple commands such as ' g++ --version'? Any help would be appreciated, thanks.

How to see the results in IPython Console- Spyder

I'm new to spyder and I'm trying to run the code written in the editor but the IPython console isn't showing the results like it's supposed to. All it says is run file and then the file path. I have tried resetting the spyder default settings, restarting the kernel but it doesn't work. so I wrote some code in IPython console and it does work. I don't know where to see the output of my code and I don't know what's wrong.Image
I'm following a tutorial and it's supposed to be like this.Tutorial-Image
(Spyder maintainer here) The problem you're experiencing is caused because Spyder has several evaluation modes. The person in Tutorial-Image is selecting the code in the Editor with the mouse and then running it by pressing the F9 key. That's why you see in that image that the code written in the editor is pasted directly into the console.
In your case case, you're running the code by pressing the Run button (i.e. green play button) or the F5 key. And when do that, you need to add print statements to see its results in the console.
you didn't output anything in your file of code. use the following code to output what you want print
print("hello,world!")
# or
print(a+b) # the a + b was defined in your file of code
EDIT
I installed the spyder and run the code your mentioned.
The following output is

Input does not work in Visual Studio Code

So I just started learning programming and I think something is messed up with my code runner in Visual Studio Code. When I try to use input in Python I can not write anything in the terminal. This problem came out recently. It writes that when I try to input anything that it "cannot edit in read-only editor". I also checked in here what could be the solution, but it did not help. Input still does not work. I am on Linux, and I also tried to uninstall the program and code runner as well, none of them worked so far.
Ps: I tried the Code-runner: Run in Terminal box check method, which did not work at all.