A different elm-format crash
ScribblerWriter opened this issue · comments
When I save an .elm file, formatting isn’t happening, and in the console I get the following error:
Sublime Text 3
elm 0.19
I’ve got “Elm Language Support” in the “install_prereleases” section
I’ve upgraded the package
Error loading scope:source.glsl: Unable to find syntax file for scope source.glsl in Packages/Elm Language Support/Syntaxes/Elm.sublime-syntax
Traceback (most recent call last):
File “./python3.3/subprocess.py”, line 1104, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Program Files\Sublime Text 3\sublime_plugin.py”, line 1072, in run_
return self.run(edit)
File “C:\Users\Chris\AppData\Roaming\Sublime Text 3\Installed Packages\Elm Language Support.sublime-package\elm_format.py”, line 33, in run
File “./python3.3/subprocess.py”, line 819, in __init__
File “./python3.3/subprocess.py”, line 1110, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
This was working fine until a few days ago, when the formatting just suddenly stopped working. I haven’t made any changes to my Sublime Text configuration, nor to where elm-format is stored. I’ve checked and made sure that elm-format is still in the path.
Source coloring, compiling and auto-completion seem all to work fine.
I’ve tried reinstalling Elm Language Support, elm-format, tried downloading ELS from the github repository into the Packages folder, but with no success.
Hi there! Sorry to hear you're having this trouble. Are you the same person who posted about this issue on the Elm Slack #editors-and-ides channel? I ask because that person says they were able to fix the problem themselves, and I want to make sure you still need help.
We did release a new beta version of the package around the time you started having this error, so I wonder if it's something that changed in that release.
@ianmackenzie, any idea if #59 could have caused this somehow?
Hi,
Nope, I’m a different person. :) That said, I switched to the Atom editor due to there being more elm tools there, and ran into a similar problem, so I did dig deeper.
It might just be my newness to using npm, but I noticed that once I started searching through my system, there was no elm-format.exe anywhere. Instead, there is only elm-format.cmd in the npm elm-format directory.
So, I just tested with Sublime Text as well, the solution both there and in Atom was to change the path (in this case the “elm_format_binary” setting to <my home path>\\AppData\\Roaming\\npm\\elm-format.cmd
I don’t know if something has changed in how npm does things or if there’s something else that caused it, but it’s working for me after I made that change.
Hmm, it seems like it could indeed be the removal of shell=True
that caused the issue - looks like others have run into similar problems when trying to execute something other than a normal executable on the system PATH.
It seems that there are ways to execute non-.exe files without the use of shell=True
, but I'm guessing that just using shell=True
is the easiest and most reliable way to replicate "do whatever would happen if someone typed elm-format
into a user shell". And the security issues aren't quite as bad in our case - it's not like we're executing a shell command on a server based on input provided by a client.
@sentience, would you like me to open another PR switching elm
and elm-format
to use shell=True
?
i'm on OS X and also getting this message!
Error loading scope:source.glsl: Unable to find syntax file for scope source.glsl in Packages/Elm Language Support/Syntaxes/Elm.sublime-syntax
...but with no stack trace. i'm also on Sublime Text 3 and elm 0.19.
elm-format
has been working for me in Sublime for quite some time. i'm not sure what changed.
i found this debug
flag! i'm on elm-format 0.8.1
, and i'm seeing this in Sublime's console:
[Elm says]: (elm-format) b"I couldn't figure out what version of Elm you are using!\n\nYou should either run elm-format from the directory containing\nyour elm.json (for Elm 0.19) or elm-package.json (for Elm 0.18),\nor tell me which version of Elm with --elm-version=0.19 or --elm-version=0.18"
errors: b''