Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to specify path to executable #5

Closed
sglyon opened this issue Mar 1, 2014 · 14 comments
Closed

Allow user to specify path to executable #5

sglyon opened this issue Mar 1, 2014 · 14 comments

Comments

@sglyon
Copy link

sglyon commented Mar 1, 2014

When I try to run a python script, I get ImportErrors because it is using the apple default python, not the one on my PATH

@rgbkrk
Copy link
Member

rgbkrk commented Mar 1, 2014

This is going to cause virtualenv issues too. 😦

Need to find a way to pass the env on to BufferedProcess it seems.

Thanks for reporting this!

@rgbkrk
Copy link
Member

rgbkrk commented Mar 2, 2014

Welp, I understand why this is now. I looked into atom's internals for BufferedProcess, within /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js. It doesn't use the default options from node's child_process.spawn:

(function() {
  var BufferedProcess, ChildProcess;

  ChildProcess = require('child_process');

  module.exports = BufferedProcess = (function() {
    function BufferedProcess(_arg) {
      var args, command, exit, exitCode, options, processExited, stderr, stderrClosed, stdout, stdoutClosed, triggerExitCallback, _ref;
      _ref = _arg != null ? _arg : {}, command = _ref.command, args = _ref.args, options = _ref.options, stdout = _ref.stdout, stderr = _ref.stderr, exit = _ref.exit;
      if (options == null) {
        options = {};
      }
      this.process = ChildProcess.spawn(command, args, options);
      ... more code ...

The default options should be

{ cwd: undefined,
  env: process.env
}

I'm fairly new to node, so I guess I didn't know what to expect here.

For now, I'll just add process.env in directly to atom script until I can make a PR against https://github.com/atom/atom.

/cc @kevinsawicki

@rgbkrk rgbkrk closed this as completed in a72f362 Mar 2, 2014
@rgbkrk
Copy link
Member

rgbkrk commented Mar 2, 2014

@spencerlyon2 Does the current release fix the Python PATH issue for you?

I tested it out with my brew installed Python as well as a virtualenv, but want to make sure it's fixed for you.

I think we should still have a config set up so people can pick the name (or fullpath) for the executable they want to use with a particular language, which would solve the title of the issue but not the issue you're having.

@rgbkrk rgbkrk reopened this Mar 2, 2014
@sglyon
Copy link
Author

sglyon commented Mar 3, 2014

Hey @rgbkrk no luck for me.

First I tried to update the package from within the atom settings buffer. No luck there. Then I tried removing the package and cloning your master branch into ~/.atom/packages and that didn't work
either.

Any ideas?

@Lbatson
Copy link
Contributor

Lbatson commented Mar 3, 2014

@spencerlyon2 try removing the folder from ~/.atom/packages altogether and just do apm install script Once you're done run apm list and it should show script listed at version 1.4.0

@smashwilson
Copy link
Collaborator

@spencerlyon2 I was able to upgrade through the settings, but I did have to quit and restart Atom completely for it to take effect. A reload might have worked too, but I didn't check.

@sglyon
Copy link
Author

sglyon commented Mar 3, 2014

Thanks for the tips, still no luck.

cmd+i still calls the apple build in python

@sglyon
Copy link
Author

sglyon commented Mar 3, 2014

So it does work when I launch atom via the command line. If I try to hit the application icon, it doesn't work

@rgbkrk
Copy link
Member

rgbkrk commented Mar 3, 2014

So it does work when I launch atom via the command line. If I try to hit the application icon, it doesn't work

Ah, that makes perfect sense. launchctl has different environment variables than bash will.

Apparently some people hack around this to force bash to send environment variables to launchctl which will pass on to Applications (with a capital A).

sigh

@McKizzle
Copy link

Hello rgbkrk,

Running atom from the terminal helps load up the proper ENV. I submitted a question on the forums to see if there is a way to change the ENV when starting it from the Applications folder.

Cheers,
Clinton

@rgbkrk
Copy link
Member

rgbkrk commented Mar 12, 2014

@McKizzle There are lots of ways!

@McKizzle
Copy link

@rgbkrk thanks! I'll check that out. :)

@EntilZha EntilZha mentioned this issue Mar 17, 2014
3 tasks
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Mar 28, 2014

I solved by setting process.env in my init script.
Just start atom from terminal, open the console and get process.env, copy and save it in the atom init script and you are done.

@rgbkrk
Copy link
Member

rgbkrk commented Apr 18, 2014

Fixed by #74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants