Giter Club home page Giter Club logo

Comments (52)

mokhosh avatar mokhosh commented on July 20, 2024 6

W10 +1

It seems to work randomly. Even if I run it from the command line.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024 2

You've truly made me curious. You can also modify your init script:

screen shot 2014-03-11 at 2 27 15 pm

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024 1

Whoa, wait. I just re-read what you said about the shell script example. Bash doesn't work either?

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024 1

Alright, updated env suggestion in 655ccfb.

On to launchctl. I covered this a bit in #5, but issues/PRs clearly aren't the documentation.

I don't have Alfred, so if this doesn't work let me know.

What you'll want to do is setup launchctl to use the PATHing from your normal setup. This can either be done programmatically:

launchctl setenv <key> <value>

or in ~/.launchd.conf:

$ cat  ~/.launchd.conf
setenv KEY 'value'

Someone on StackOverflow has a ridiculous solution for changing launchctl as your export vars in bash.

Let me know what you think of these, and feel free to update the README. I'm always happy to review and merge PRs!

from atom-script.

 avatar commented on July 20, 2024 1

miromarszal commented 6 days ago

A workaround for Win10:

Right-click on the Atom shortcut
Go to "Properties"
Replace the path in "Target" with cmd /C atom

A side effect: the terminal window stays open.

Hi. Let us consider this proposal. How about creating a BAT file?..

  1. Right-click on the Atom shortcut
  2. Go to "Properties" of the shortcut
  3. Copy the entry in "Target"
  4. Open a text editor such as Notepad
  5. Put in this text file the "Target" copied in (3)
  6. Insert the line " @echo off " before it.
  7. Save & close the text file as (example) openAtom.bat in the same directory as "Target"
  8. Replace the "atom.exe" with "openAtom.bat" in the "Target" of (3).

The command prompt does open,but does not remain open.

Helpful?

  • Dan

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

Right now the plugin is using node to run javascript code. We need a config setup to let you specify your executable of choice (jasmine?). I'll hack on this tonight to get this feature in for you if this is the problem. If you're just wanting to run client side javascript, we don't have a good setup for that. I'd recommend @ardcore's https://github.com/ardcore/atom-safe-eval.


If you do have node, but it's still not running, it may be an environment issue. Script relies on the environment variables that Atom loads with. Atom run from a shell is different than Atom run from the icon/Applications menu. Run env in a bash script from Atom using script to see what I mean.

As for the absolutely useless error message being passed to you, that needs fixing. Since we're using Atom's BufferedProcess we don't have direct access to node's child_process.spawn which we would need in order to provide more useful error messages in the display window:

child.stderr.on('data', function (data) {
  if (/^execvp\(\)/.test(data)) {
    console.log('Failed to start child process.');
    // Let user know the executable was unavailable
  }
  // Other logic
});

An alternative for us of course is to check for the existence of the executable first. Not sure how I feel about that, but it may be necessary.

from atom-script.

mattma avatar mattma commented on July 20, 2024

Well, I re-tested the shell script, ls -las. it works. :) what happened is, I created a shell file but I did not save it. When i run the script, it shows the green check mark but without the result. After I read your replied, I tried again with saved file, it works as promised.

I do have node in my system. I just want to test the script plugin, and no specific purpose on running on client or server side. Well, I tried with server side node code, it still could not run. Could you just provide an example that the script plugin could work as it advertised. So that I could have a reference how to use it. Now, i just simply put any console.log code in coffee or plain js, it does not have a result excerpt an Error code execvp(): No such file or directory every single time.

Maybe it needs a specific file structure?

from atom-script.

Lbatson avatar Lbatson commented on July 20, 2024

@mattma I'm able to run the function you posted above and get the appropriate output both with and without saving the file as shown below. However, the issue you're experiencing is probably because you're launching atom from the dock and not via the command line using the atom command. If you open via the command line all should work properly.

screenshot 2014-03-09 22 08 29
screenshot 2014-03-09 22 10 18

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

@mattma Where are you running Atom from?

The icon/Applications or from the console?

from atom-script.

mattma avatar mattma commented on July 20, 2024

Yes, from icon.Applications. How could I run from the console? Instruction please.

I am experienced user of Sublime Text, and i think this plugin could essentially be the build tool for atom. :)

from atom-script.

Lbatson avatar Lbatson commented on July 20, 2024

@mattma you can launch Atom from your terminal. Open up a terminal window and type atom -h for more information. If it says something like command not found, go to the menu bar Atom > Install Shell Commands

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

If you install the cli tools:

screen shot 2014-03-09 at 10 48 44 pm

You can run atom from the cli. It picks up your environment variables that way, as well as opening the project you're currently in.

Make sure to fully quit Atom first.

I am experienced user of Sublime Text, and i think this plugin could essentially be the build tool for atom. :)

👏 That would be awesome! We'd probably need a name change for that, but it's becoming clear that people want a unified output pane for running crud.

from atom-script.

mattma avatar mattma commented on July 20, 2024

First, it works as it advertised.

2nd, I do have atom apm installed in my machine. I think I do have atom command available, or I really do not have it.

Anyway, after I tried that, it works great.

Question, can this one run mocha command for testing? can I execute any cli command in there like rm -rf ./filename? just tried and it did not work. If you need any help, feel free to ping me and i will make a pull.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

Yay! Glad that works for you. We're going to update the README to make sure the cli vs. icon running is clear.

Question, can this one run mocha command for testing?

Mocha may be better suited to @tombell's https://github.com/tombell/test-status.

However, I'm currently hacking away on the config settings right now so that you can change it to use your preferred command for each language.

can I execute any cli command in there like rm -rf ./filename?

You can run any cli commands that don't need input using a bash script. Keep in mind however that the current working directory that it's operating from is wherever Atom was opened from.

from atom-script.

aesarius avatar aesarius commented on July 20, 2024

Hey there,
Awesome work there mate!
Just wanted to let you know that I also had to dig up this tread to understand why the package wasn't working for me also... Running Atom from the command line did the trick 👍 but it would be good if you could include this in the readme.md indeed.
Also, how could one set this up to be able to start from the "icon" just because I am using Alfred to open most of my stuff and it would be great not having to go through the term.
Cheers!

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

@aesarius - Thanks for poking me on this. I'll edit it now.

from atom-script.

aesarius avatar aesarius commented on July 20, 2024

No worries mate.
Sorry to bother but what about starting Atom form Alfred then?
How would I go and set-up the env in that case? Through shebang or something like this?
Thanks mate.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

Yet another method is setting up launchctl as part of your bash profile:

p=$(launchctl getenv PATH)
launchctl setenv PATH /my/new/path:$p

That would get executed on every single terminal that is opened though, so nevermind that one.

from atom-script.

aesarius avatar aesarius commented on July 20, 2024

Ok mate.
Will have a look at this when I get a sec 👍
Thanks a lot for your answer!

from atom-script.

aesarius avatar aesarius commented on July 20, 2024

Yeah ok this is rather interesting!
Nice catch 👍

from atom-script.

hansrodtang avatar hansrodtang commented on July 20, 2024

Adding the stuff I need to ~/.bashrc seems to work for me in GUI and the terminal, just wanted to share that in case anybody wants to try it.
Still frustrating about the seeming ambiguity of all the options of settings environment variables.

To update the terminal you might need to use source ~/.bashrc. I used that since I rarely reboot for anything.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

@hansrodtang I definitely don't know the best practice here.

Has anyone seen a good discussion on the forums about this?

from atom-script.

hansrodtang avatar hansrodtang commented on July 20, 2024

For now I just add what I need to ~/.bashrc and add

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

to ~/.bash_profile in accordance to what I read here and here.

Seems like this is something Atom itself should fix/make more transparent to package developers since a properly equipped environment is essential to any programming tool.
Getting GOPATH for Go into Atom with consistent results has been a pain, I'm glad this tweak finally made it work for me.

from atom-script.

JediMindtrick avatar JediMindtrick commented on July 20, 2024

So I had a similar problem. I'm a mac noob, so this first bit may have been the wrong thing to do...

I had put atom into its own folder inside /Applications; so /Applications/atom/atom.app. Atom ran fine, command-line worked...life seemed happy. When I tried to use this plugin I was getting the above error...checked my path by using plugin to run env...path looked like a real one, etc...

Long story short, I removed atom from it's old location, and reinstalled as /Applications/atom.app. Now all is well :)

from atom-script.

edmulraney avatar edmulraney commented on July 20, 2024

I had the same issue in Ubuntu. Here's what I did to get it working:

  1. Install mono and scriptcs (I already had mono-develop installed but if you don't want the IDE then apt-get install mono-complete I think will give you what you need without installing the IDE. For scriptcs get the dev version from github then run sudo ./build.sh)
  2. Copy the "scriptcs.exe" (src/ScriptCs/bin/Release) into a file called "scriptcs"
  3. Add the path to the Release directory containing the scriptcs executable to your PATH. My .bashrc: export PATH=$PATH:~/installs/scriptcs-dev/src/ScriptCs/bin/Release
  4. Install Atom Runner. File -> Preferences -> Packages -> Search Atom Runner
  5. Add
'runner':
  'extensions':
    'csx': '/home/user/installs/scriptcs-dev/src/ScriptCs/bin/Release/scriptcs -script'

to your config.json (ctrl shift p, config)

You should now be able to run C# files saved as .csx files by pressing ctrl shif p then type r and hit enter.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

@edmulraney For yours, this is actually the case of scriptcs not being a part of atom-script's grammar file. Looks like you have it working in Atom Runner (not this package) though.

from atom-script.

edmulraney avatar edmulraney commented on July 20, 2024

@rgbkrk Haha oops, well spotted. Different package completely. I found this thread when searching for a solution to my scriptcs issue so hopefully someone else will find it useful..

from atom-script.

jbavari avatar jbavari commented on July 20, 2024

I've just worked around this issue on OSX.

The way I solved it was by using the fix-path module to adjust my path when running from the app file.

Hope this helps any other users with this issue.

from atom-script.

oddysee avatar oddysee commented on July 20, 2024

@jbavari How did you use fix-path for the script plugin? Is there a pull request or branch I can use?

from atom-script.

BramVanroy avatar BramVanroy commented on July 20, 2024

All of the discussion above seems Linux-centred. However, I'm happily running on W10 and I'm not entirely sure how I can start Atom from cmd, or with custom parameters on an icon, so the package would work. Any suggestions?

from atom-script.

hurrymaplelad avatar hurrymaplelad commented on July 20, 2024

@oddysee Wrapped up fix-path as an atom package. You should just be able to apm install atom-fix-path or install it from the settings pane. Thanks @jbavari for the suggestion.

from atom-script.

 avatar commented on July 20, 2024

+1 @rgbkrk for

# init.coffee
process.env.PATH = ['/usr/local/bin', process.env.PATH].join(':')

but who knows what PATH is set to by default? I prefer just being totally explicit and setting my entire PATH. That way if a binary can't be found, I know precisely which directories need to be added.

# init.coffee
process.env.PATH = [
  "/usr/local/bin",
  "/usr/bin",
  "/bin"
].join(":")

Less is more™

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

@naomik On Mac at least, PATH gets set by launchctl. If you want to see what it gets set to on startup, put

alert(process.env.PATH)

in your init.coffee and see what you get back.

from atom-script.

 avatar commented on July 20, 2024

@rgbkrk yeah I still prefer to just set what's required. I do the same in my .zshrc but maybe that's me being overly controlling.

I generally hate relying on defaults because I can never remember what they are (and they're different on a lot of platforms). It's takes more time for me to look up defaults than it does for me to write what I actually need.

from atom-script.

rgbkrk avatar rgbkrk commented on July 20, 2024

Yeah, I prefer to use what's in my bashrc. The problem lies in how Atom is launched (or restarted after an upgrade...) 😒

from atom-script.

ersiner avatar ersiner commented on July 20, 2024

You may use osx-env-sync to solve this problem on OS X for all applications in the proper way.

from atom-script.

turotulco avatar turotulco commented on July 20, 2024

Windows 7. I just went into MyComputer, chose Advanced System Settings, and pressed the button marked Environment Variables. Path is the top environment variable. Add ";C:\Python" to the end of the path (or the beginning; or whatever your python path is named). This is the environment that will be loaded every time a command prompt is spawned.

from atom-script.

ToSeven avatar ToSeven commented on July 20, 2024

window10 I just run c program but script generate some terrible things , I use google to solve it ,but there is nothing so can you help me?

default

from atom-script.

danielbayley avatar danielbayley commented on July 20, 2024

Just to add another solution… there's also the env-from-shell package.

from atom-script.

SarbajitNandy avatar SarbajitNandy commented on July 20, 2024

I'm a pc user. I have downloaded atom recently, and want to set it up for Python coding. Though I have already downloaded 'Script' for run codes. but facing a great problem at the time of running . though the whole code is perfect, getting this message "Python is not recognized as an internal or external command". plz help me to solve this.

from atom-script.

miromarszal avatar miromarszal commented on July 20, 2024

A workaround for Win10:

  1. Right-click on the Atom shortcut
  2. Go to "Properties"
  3. Replace the path in "Target" with cmd /C atom

A side effect: the terminal window stays open.

from atom-script.

miromarszal avatar miromarszal commented on July 20, 2024

I should have thought about this one, works like a charm.

from atom-script.

Kristi92 avatar Kristi92 commented on July 20, 2024

Error
Line Number Based runner not available for JavaScript.

If it should exist, add an issue on GitHub, or send your own pull request.

from atom-script.

Kristi92 avatar Kristi92 commented on July 20, 2024

can anyone help me with this issue please
?

from atom-script.

bhflm avatar bhflm commented on July 20, 2024

image

Ubuntu 16.04 😕

from atom-script.

MStonehouse avatar MStonehouse commented on July 20, 2024

For Ubuntu and Linux Mint.

Hello bhflm.

Just ran into the same problem you had. This might help.

If you installed the flatpack version from software manager Atom won't be able to find node.

Uninstall Atom.

Go to https://atom.io/ and download the .deb version.

Once downloaded double click on the deb download. A popup window will open. Click on install package.

Not only will Atom now recognize the path to node, your install is now less than 1GB (flatpack is 3.4GB)

from atom-script.

trbielec avatar trbielec commented on July 20, 2024

Workaroud for python3:

#1787

If you want to use Python3 by default, you can open Atom Settings, Atom→Preferences→Open Config Folder, and open.atom/packages/script/lib/grammars/python.coffee, Changing python to python3 under 'Selection Based' and 'File Based', saving it.

from atom-script.

MCilento93 avatar MCilento93 commented on July 20, 2024

Nothing specific for conda?
I would like to change the init.coffee suitably to startup atom (when launched by icon) in pre-activated conda env.
Thank you

from atom-script.

omarflight avatar omarflight commented on July 20, 2024

how to fix this
'python' is not recognized as an internal or external command,
operable program or batch file.

from atom-script.

MCilento93 avatar MCilento93 commented on July 20, 2024

how to fix this
'python' is not recognized as an internal or external command,
operable program or batch file.

if you have python installed from official release, you should not have issues.
If you are using conda you can open atom from pre-activated cmd

from atom-script.

luciferchase avatar luciferchase commented on July 20, 2024

I dig through this thread and tried running atom from the cmd itself still I am unable to run any Kotlin file. A little help?
image

from atom-script.

M5planetX avatar M5planetX commented on July 20, 2024

Prerequisites

Description

Steps to Reproduce

  1. Install atom
  2. Install GitHub for Windows
  3. Install atom-script
  4. Run atom

Expected behavior:

normal atom welcome screen

Actual behavior:

Versions

Atom: 1.60.0 x64
Electron: 9.4.4
OS: Microsoft Windows 10 Home
Thrown From: script package 3.32.2

Stack Trace

Failed to activate the script package

At Cannot find module 'temp'
Require stack:
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammar-utils.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammars\index.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammars.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\code-context-builder.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\script.js
- C:\Users\Pc\AppData\Local\atom\app-1.60.0\resources\app.asar\static\index.html

Error: Cannot find module 'temp'
Require stack:
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammar-utils.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammars\index.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\grammars.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\code-context-builder.js
- C:\Users\Pc\.atom\packages\atom-script-3.32.2\lib\script.js
- C:\Users\Pc\AppData\Local\atom\app-1.60.0\resources\app.asar\static\index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:797:17)
    at o._resolveFilename (electron/js2c/renderer_init.js:43:689)
    at Function.get_Module._resolveFilename (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:157942)
    at Module.require (/app.asar/static/index.js:61:43)
    at require (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149229)
    at /packages/atom-script-3.32.2/lib/grammar-utils.js:6:24)
    at /packages/atom-script-3.32.2/lib/grammar-utils.js:128:28)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149913)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:153507)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149229)
    at /packages/atom-script-3.32.2/lib/grammars/index.js:12:24)
    at /packages/atom-script-3.32.2/lib/grammars/index.js:614:29)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149913)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:153507)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149229)
    at /packages/atom-script-3.32.2/lib/grammars.js:11:22)
    at /packages/atom-script-3.32.2/lib/grammars.js:46:24)
    at Module.get_Module._compile (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:149913)
    at Object.value [as .js] (~/AppData/Local/atom/app-1.60.0/resources/app/static/<embedded>:11:153507)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)

Commands

Non-Core Packages

script 3.32.2 

Additional Information

Hello all,
I've installed atom, GitHub for windows, and the atom-script-3.32.2 package successfully but I am unable to run any code using ctrl+shift+B and whenever I open atom I get this message.
Pls help

from atom-script.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.