atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
734 stars 269 forks source link

"The system cannot find the path specified." When running script with Shebang #421

Open icedvariables opened 9 years ago

icedvariables commented 9 years ago

When I try to run a python script with a shebang like #!/usr/bin/env python I get the error The system cannot find the path specified. When I remove the shebang the script works as normal however. Is this a problem with Atom starting in the wrong directory? I tried starting it from the command line in root but that didn't fix it.

This is also likely a problem for most scripts (I believe this occurs when running Perl scripts as well).

caleb531 commented 9 years ago

What operating system are you running? Knowing that would help a bit. ;)

Caleb

icedvariables commented 9 years ago

Sorry, I'm on Windows 7 at the moment. If I recall correctly this hasn't affected my linux machines.

caleb531 commented 9 years ago

Ah, figured. I believe I know what the issue is, then.

Script (this package) reads the shebang line at the top of each script you execute (if the shebang exists). However, the path /usr/local/bin only exists on Unix systems; it doesn't exist on Windows (I'm not even sure Windows considers that a valid path).

@rgbkrk or @erran: I'm not sure what you'd like to do about this. It might be easiest (and less unpredictable) to simple ignore the shebang line if the detected platform is Windows. That's entirely up to you, though; perhaps you see a better solution to this.

rgbkrk commented 9 years ago

That makes total sense to ignore the shebang line when on Windows.

dessant commented 9 years ago

It would be great to have an option in the settings panel for toggling between ignoring or respecting shebangs.

nitrocode commented 8 years ago

Same issue here. Modifying files in Windows and then running in Linux.

I removed the shebang from each of my python files and so I have to run the scripts using python *.py instead of ./*.py

Not a big deal but it would be nice, as @dessant said, to ignore the shebang line on Windows or at least assume that #!/usr/bin/env INTERPRETTER will check the PATH for the interpretter.

nixel2007 commented 8 years ago

That makes total sense to ignore the shebang line when on Windows.

but you can use shebang on win-system. confirmed by myself :) maybe you could check the path for existance, and if so run it, otherwise ignore?

nitrocode commented 8 years ago

@nixel2007 how do you use the shebang? The idea is that the same shebang line needs to work on both windows and *nix. I use the ubiquitous #!/usr/bin/env python in order to run on Linux.

Do you know of another shebang that's cross platform and works in atom-script?

nixel2007 commented 8 years ago

@nitrocode neh, no cross platform way. You need to put something like #!c/progra~3/OneScript/bin/oscript.exe (but for python) to make it executable on win. Just want to point, that shebang technically works