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

WinError 193. (Run on Windows without Composer?) #204

Open
rusproject opened this issue Apr 29, 2022 · 4 comments
Open

WinError 193. (Run on Windows without Composer?) #204

rusproject opened this issue Apr 29, 2022 · 4 comments

Comments

@rusproject
Copy link

rusproject commented Apr 29, 2022

Hello! Can't get it work on windows, getting WinError 193 or WinError 2.

Phpcs itself working perfectly when I run it from command prompt (C:\php\php.exe C:\php\php-cs-fixer-v3.phar fix D:\project2\model\_Criteria.php --verbose)

but not from ST4 plugin. I've tried to specify "phpcs_php_prefix_path": "C:\\php\\php.exe", or "phpcs_php_prefix_path": "C:/php/php.exe", but it doesn't work, keep getting an error


[Phpcs] Project files:
[Phpcs]  Current: None
[Phpcs]  Last Known: None
[Phpcs] No project file defined, therefore skipping reload
[Phpcs] C:\php\php-cs-fixer.phar fix D:\project\code\model\_Criteria.php --verbose
[Phpcs] C:\php\php-cs-fixer.phar fix D:\project\code\model\_Criteria.php --verbose
[Phpcs] cwd: C:\Users\alex
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 904, in on_post_save
    run_view_callbacks('on_post_save', view_id)
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 788, in on_post_save
    cmd.fix_standards_errors("Fixer", view.file_name())
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 560, in fix_standards_errors
    fixes = Fixer().get_errors(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors
    self.execute(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 286, in execute
    self.parse_report(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 289, in parse_report
    report = self.shell_out(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shell_out
    proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=info, cwd=self.workingDir)
  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
[Phpcs] C:\php\phpcs.phar --report=checkstyle --standard=PSR2 -n D:\project\code\model\_Criteria.php
[Phpcs] C:\php\phpcs.phar --report=checkstyle --standard=PSR2 -n D:\project\code\model\_Criteria.php
[Phpcs] cwd: D:\project\code\model
Exception in thread Thread-2858:
Traceback (most recent call last):
  File "./python3.3/subprocess.py", line 1104, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 488, in run
    self.checkstyle_reports.append(['Sniffer', Sniffer().get_errors(path), 'dot'])
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors
    self.execute(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 231, in execute
    self.parse_report(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 234, in parse_report
    report = self.shell_out(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shell_out
    proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=info, cwd=self.workingDir)
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

SublimeLinter: WARNING: phpcs cannot locate 'phpcs'
Please refer to the readme of this plugin and our troubleshooting guide: http://www.sublimelinter.com/en/stable/troubleshooting.html

Are there some instructions or examples for installing and/or configuring phpcs for sublime text 4 on windows (without using composer for phpcs installation)?

@rusproject
Copy link
Author

rusproject commented Apr 29, 2022

del comment

@benmatselby
Copy link
Owner

Hey @rusproject I no longer work on this project, as I use vscode. I also don't have access to windows, so will struggle to help I am afraid. Apologies.

@skeeith
Copy link

skeeith commented Jun 9, 2022

@benmatselby I'm planning to fix some of this issue. can you guide me where to start or point me where?

I see that phpcs.py is like the main file

@benmatselby
Copy link
Owner

Hey @skeeith

Full disclosure, I won't be able to test this on windows, and I don't even use Sublime Text anymore, so testing this on a Mac is going to take some time for me to set it all up again.

However, as per your request.

Aye, phpcs.py is the place you want to start. After that it's worth noting that all the commands inherit from ShellCommand. The main Sublime Text command is PhpcsCommand which orchestrates the rest.

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

No branches or pull requests

3 participants