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

Executable not found on Windows #46

Closed
sfavazza opened this issue Nov 12, 2019 · 9 comments
Closed

Executable not found on Windows #46

sfavazza opened this issue Nov 12, 2019 · 9 comments

Comments

@sfavazza
Copy link

The Issue

Hello!
When I freshly install the flycheck-pycheckers package and enable it in elpy mode I got the following error whenever I visit a python file:

File mode specification error: (error Command executable for syntax checker python-pycheckers must be a string: nil)

I did my homework

After some investigation on the issue I realized that the flycheck-pycheckers-command variable is nil.
This because the executable-find function seems not to find the pycheckers.py file.
According to the emacs documentation, this command tries to look in all paths found in exec-path variable and to substitute all suffixes found in the exec-suffixes.

On my machine the exec-suffixes is set to: (".exe" ".com" ".bat" ".cmd" ".btm" "")
As the empty string is included I thought it would have found the file, but no luck.

For test purposes I locally modified the offending statement as:

(defvar flycheck-pycheckers-command
  (executable-find (concat (file-name-directory (or load-file-name buffer-file-name))
                           "bin/pycheckers")))

And I added a batch script called pycheckers.bat in the same bin folder, from which I execute the python script:

python "%~dp0pycheckers.py" %*

So I manage to make it work, but I am looking for a more long-term elegant solution to this issue.

Has anybody ever get into this issue?

Cheers,
Samuele

@msherry
Copy link
Owner

msherry commented Nov 12, 2019

Thanks for the detailed report! I don't have a Windows machine to test or develop on, so unfortunately it might be a while before I can build out a fix. If you have something that works and want to turn it into a pull request, I'm happy to take a look at it!

@sfavazza
Copy link
Author

sfavazza commented Nov 13, 2019

Cool, I am working on my forked repo already.
I got a working version with the hacks I mentioned in the previous post.
I will soon propose a merge request.

Actually, as python 2.7 won't be officially supported anymore by the end on this year, would you mind if I make the code compatible with python 3?

@sfavazza
Copy link
Author

After long time I got some time to spent on this issue, yet I didn't get your answer about the python 3 migration...
Should we discuss this in another thread?

@msherry
Copy link
Owner

msherry commented Feb 15, 2020

Sorry, I must have missed your earlier question. I'd be happy to accept a PR to make the code work correctly under python 3, but I'd want to make sure that it remains backwards-compatible for python 2.7, for people who haven't yet had the chance to migrate!

@sfavazza
Copy link
Author

Well in that case it's already compatible, I always use python 3.

@msherry
Copy link
Owner

msherry commented Apr 10, 2020

Going to close this issue out for lack of attention - please reopen if necessary.

@msherry msherry closed this as completed Apr 10, 2020
@grolongo
Copy link

Hello,

I came accross that error when trying flycheck-pycheckers on Windows (same Emacs config works fine on macOS). I'm trying to use it with flake8 and bandit at the same time, both are in my path and functional from the command line (Powershell). Flake8 works without issue with Flycheck alone too. Is there any fix for this or a workaround available like OP suggested?

Thanks

@msherry
Copy link
Owner

msherry commented Sep 16, 2020

Hi, @grolongo. Thanks for the report!

I suspect the default path for virtualenvs is not the same on Windows as it is on Linux/MacOS, but I don't have a windows machine handy to test with. Can you try debugging what path is being searched? I'm happy to accept pull requests, but I don't really have a way to debug this myself at the moment, unfortunately.

@grolongo
Copy link

@msherry hi, thanks for quick reply.

I would be happy to help but I'm very novice in Emacs/Elisp unfortunately. If you can provide me a debug command or quick guide I would gladly try to debug it and provide you the output of anything that can help fix this issue.

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

3 participants