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

[Error 2] The system cannot find the file specified in ST2 on Windows #87

Closed
Keiron-BWS opened this issue Aug 21, 2013 · 8 comments
Closed

Comments

@Keiron-BWS
Copy link

Hi,

I'm getting an error:

[Error 2] The system cannot find the file specified

When trying to sniff files in ST2 on Windows. I've looked at the Windows 7 config file here but still can't get it working...

I get the feeling the error is probably somewhere in here but I can't workout where:

"phpcs_php_prefix_path": "C:\\Users\\User\\Documents\\My Dropbox\\Software\\SublimePortable\\resources\\PHP\\php.exe",

"phpcs_commands_to_php_prefix": "['Sniffer']",

"phpcs_executable_path": "C:\\Users\\User\\Documents\\My Dropbox\\Software\\SublimePortable\\resources\\PHP_CodeSniffer-1.5.0RC3\\scripts\\phpcs.bat",

The output from the console with debugging on is:

[Phpcs] php -l -d display_errors=On C:\Users\User\Documents\test.php
[Phpcs] cwd: C:\Users\User
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 362, in run_
    return self.run(edit)
  File ".\phpcs.py", line 551, in run
  File ".\phpcs.py", line 387, in run
  File ".\phpcs.py", line 128, in get_errors
  File ".\phpcs.py", line 344, in execute
  File ".\phpcs.py", line 347, in parse_report
  File ".\phpcs.py", line 149, in shell_out
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 842, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified

Any suggested greatly appreciated!

@benmatselby
Copy link
Owner

Hello there. Currently don't have access to a windows VM to test this, but try changing:

"phpcs_commands_to_php_prefix": "['Sniffer']",

to

"phpcs_commands_to_php_prefix": "",

@Keiron-BWS
Copy link
Author

Unfotunately still no good:

[Phpcs] php -l -d display_errors=On C:\Users\User\Documents\test.php
[Phpcs] cwd: C:\Users\User
Exception in thread Thread-28:
Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File ".\phpcs.py", line 396, in run
  File ".\phpcs.py", line 128, in get_errors
  File ".\phpcs.py", line 344, in execute
  File ".\phpcs.py", line 347, in parse_report
  File ".\phpcs.py", line 149, in shell_out
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 842, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified

Happy to provide any debug if it will help?

@benmatselby
Copy link
Owner

Can you try changing:

"phpcs_commands_to_php_prefix": "['Sniffer']",

to

"phpcs_commands_to_php_prefix": "['Linter']",

@Keiron-BWS
Copy link
Author

The same:

[Phpcs] php -l -d display_errors=On C:\Users\UserDocuments\test.php
[Phpcs] cwd: C:\Users\User
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 362, in run_
    return self.run(edit)
  File ".\phpcs.py", line 551, in run
  File ".\phpcs.py", line 387, in run
  File ".\phpcs.py", line 128, in get_errors
  File ".\phpcs.py", line 344, in execute
  File ".\phpcs.py", line 347, in parse_report
  File ".\phpcs.py", line 149, in shell_out
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 842, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified

@Keiron-BWS
Copy link
Author

I am closing and re-opening ST2 between changing config file.
It's also ST2 portable but I can't see that making a difference?
And it's running out of my dropbox

@Keiron-BWS
Copy link
Author

Is it likely to do with it being in dropbox or my path? Or the fact it's the portable version?

@benmatselby
Copy link
Owner

Hi @Keiron-BWS, really sorry it has taken me so long to get back to you, just have a lot going on at the moment. I've just changed Macs and the windows VM license is throwing up some obstacles for me as well. However, I can replicate your error now, and I think you can fix it in 2 ways.

1 - Update:

"phpcs_php_path": ""

to

"phpcs_php_path": "C:\\Users\\User\\Documents\\My Dropbox\\Software\\SublimePortable\\resources\\PHP\\php.exe"

This will then run php -l through the above executable.

2 - Update the System PATH in Windows:

  • Right Click Computer
  • Click Properties
  • Click Advanced System Properties
  • Click Environment Variables button
  • Under System Variables double click Path
  • Add ";C:\Users\User\Documents\My Dropbox\Software\SublimePortable\resources\PHP" to the end of the string.

I've now tested with both of these solutions and both work. Let me know if this resolves so I can close the ticket.

@Keiron-BWS
Copy link
Author

Working perfectly, I'll have to update the path periodically to the bat files as my dropbox lives in two different places in different machines, but having PHP in the PATH on both has resolved it.

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

2 participants