Code Running Error


#1

I keep receiving an error whenever I try to run code, it doesn’t matter what package I’m using, or what language I’m using, the error looks like this:

Please help me with this problem as it disables my ability to run programs in Atom, thank you.


#2

Have you installed Python on your computer?


#3

No, but this is a recurring error on all languages


#4


#5

If you haven’t installed Python, that’s why you’re getting the error when the package tries to execute python. Have you installed Node on your computer?


#6

So i need to install the platform’s respective language supports in order to run them in atom?


#7

I’m very sorry i am a beginner so I don’t have a lot of knowledge about these concepts


#8

The script package is a relatively tiny JavaScript document that tries to invoke the command-line interface of a given interpreter or compiler. You have to install the program that knows what to do with the code, and then script can send it over.


#9

Whichever package you use to “run” your script -
you need something to make the script work.

In simple terms the Package you use rework your text / file and invoke the command to have an interpreter make the code run.

If you are running “script” go see what the file has - (Windows)
"C:\Users{your user}.atom\packages\script\lib\grammars.coffee "

In my case I am running Python scripts. You need to get the needed resources from python org. Make sure that the installation is rooted to your (global) path.

After you should be able to execute “python” from command prompt to see a result.

The built-in IDLE IDE is also a good place to start as a n00b.

Cheers.


#10

Ok, thx for your help!


#11
I'm guessing you also need to download IPython for Hydrogen to work, too, right?

#12

Perhaps read here:
Installation Guide: Hydrogen


#13

Hey.

Will you be willing to take smaller steps first? How about telling us which coding language you wish to focus on first?

This Package will make a terminal available for Atom…

On its own it is not going to make the code run.

We (you and me / someone else) can try and get you up and running on the terminal first on the code language of your choice.

You have to type out the commands onto the terminal to compile / interpret the code via external apps. But at least then you can get started. Later on we can concentrate on getting you settled on other methods.

Game?


#14

If the code runs in the terminal, it will run in script (there are some circumstances that make this not always true, but these are edge cases). It’s easier for most users to use the keybinding for script than to deal with the terminal, so I only recommend using the terminal in cases where the interpreter/compiler is installed and in the user’s PATH and Atom still can’t find it.


#15

Ok I’m learning HTML,CSS, JS, and Python


#16

2 or 3?

You’ll want to install Node and the Python version you’re using. For testing HTML, CSS, and JS, I recommend using browsersync, which is a Node package that generates an HTTP server and refreshes open pages whenever the files are updated. It requires a small amount of expertise to set up, but I think the learning process to be able to use it would be a valuable early step in the education of someone getting into modern JavaScript development.


#17
  • no action required
  • light conversation

@DamnedScholar:
Consider changing your call sign to “Teacher”. :smile: Thanks for your efforts in helping MeefBeef. Hopefully he can start moving forward now.

@MeefBeef:
Please let us know how you are progressing.

- Dan Padric


#18
  • no action required
  • no disrespect intended
  • sharing opinionated experience

@DamnedScholar:

Are you running Script on your system? Which OS do you have? Was there any “special” things you had to do to get the Package working? (not relating to code language interpretation)

.
Maybe my experience is worth mentioning for others to hear… and Atom is new to me too. I was having trouble with Script at first on Windows 7 (64-bit). The console associated with Script did not open properly as I expected. But that was mentioned in the introduction:


#Atom can’t find node | ruby | python | my socks


This was resolved when opening Atom via a *.BAT file as answer to the following:
https://github.com/rgbkrk/atom-script/issues/61#issuecomment-311502989

Now Script works - but on my system (?) it takes no INPUT from the user.
yourName = input("What is your name? ")
The above Python code will have Script wait for an answer; no further action. There is no visible cursor to offer user input.

More… From reading their source code, I know Script “executes” the Python code with:
python -u code.py

Working through tutorials to teach myself Python, this is a problem. (I am a n00b on Python too!) I need to interact with the result. So the execution should be…
python -i code.py

The Python prompt / environment stays active after executing the source file when using -i. That makes it possible to interrogate some variables or run variation on defined functions / classes. The interactive mode only makes sense when using a terminal.

In my view - having a terminal is better for me than having the Script functionality. The terminal offers me the opportunity to mess around with some command prompt codes to manipulate and interrogate code segments after being executed from a source file.

What are your thoughts?
Regards.


#19

I am, on Windows 10, though I don’t use it much (for a variety of reasons, it doesn’t accomplish what I want when I actually need to execute my code; most of this is because I’m generally writing things for frameworks or applications that aren’t contained in one script. When I’m testing individual bits of code, I find it more useful to use Hydrogen or a REPL (and for that, I usually use repl.it; I could use a package inside Atom, but when I’m testing specific bits, I often want to share them easily and the site allows me to do so).

When running individual scripts, I use either script or the command line depending on which is most convenient for me in the moment.

Was there any “special” things you had to do to get the Package working? (not relating to code language interpretation)

Not as far as I remember. The “special” step in the issue you linked is just to make sure that Atom picks up updated environment variables, which isn’t always necessary. In my case, I had Python, Node, and MinGW installed before installing Atom, so it was never an issue.

Basically: every new process should pick up your environment variables as they are when the process is started. Sometimes they won’t, such as if you’re starting an application from a process that hasn’t picked up the environment variable yet. I don’t know enough about the workings of Windows to know when Windows Explorer (the graphical interface, also known as the desktop environment) picks up new variables, but it acts as a shell process and all shell processes should pick up the environment on start. That’s why starting Atom through cmd works, and that’s why explicitly telling Atom to grab the variables works. If your desktop environment isn’t picking up the variables, you can probably fix it by logging out and you can definitely fix it by rebooting. This is a bit of a tedious step, especially for an older machine, so routing the opening of Atom through cmd is a fine workaround.

This is why, when troubleshooting someone else’s problems with script, atom-runner, linter, and other packages that work similarly, I first make sure that they’ve installed the external program and then have them try to run it on the command line. Whether or not they succeed gives me a lot of information, which I can combine with knowledge of their operating system to give them a definite answer.

Now Script works - but on my system (?) it takes no INPUT from the user.

This is normal (search for “script input” on this forum and you’ll find a bunch of threads about it). script would have to be set up to take input when the compiler/interpreter prompts it, and to my knowledge it is not. I don’t know what would be required to give it this capability, but it should be possible.

For people who are going to be running a lot of live-input scripts, I generally recommend using termination (for having a terminal inside Atom and being able to do literally anything without worrying about the package having a particular feature built into it).


#21

Pretty sure 3.