2012-05-29 37 views
1

我試圖使用Php代碼嗅探器與Sublime,但是在崇高的終端中,我每次嘗試嗅探文件時都會得到以下內容:OSError:[Errno 13]使用Sublime phpcs軟件包時,python的權限被拒絕,OSX 10.7

Traceback (most recent call last): 
File "./sublime_plugin.py", line 350, in run_ 
File "./phpcs.py", line 382, in run 
File "./phpcs.py", line 270, in run 
File "./phpcs.py", line 98, in get_errors 
File "./phpcs.py", line 138, in execute 
File "./phpcs.py", line 141, in parse_report 
File "./phpcs.py", line 106, in shell_out 
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__ 
errread, errwrite) 
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child 
raise child_exception 
OSError: [Errno 13] Permission denied 

貌似有一個權限問題的地方,但是:

  • 我已經設置phpcs的/ opt/local/lib目錄/ PHP /梨/ bin文件中的可執行文件,並檢查所有的父目錄的
  • 我已經將phpcs.py作爲可執行文件設置爲sublime包dir(你呃不知道是否需要它),同上父母的
  • 我已經檢查,我可以在命令行上運行phpcs罰款。它在PATH中,它做它要做的事情並返回沒有錯誤的結果。

更新與按ms4py註釋輸出 - 一個 '打印CMD' 在LN 105:

['php', '-l', '-d display_errors=On', u'/Users/pete/projects/portal/apps/frontend/modules/chilled/actions/actions.class.php'] 
[u'/opt/local/lib/php/pear/bin', '--report=checkstyle', '-n', u'--standard=PEAR', u'/Users/pete/projects/portal/apps/frontend/modules/chilled/actions/actions.class.php'] 
+0

權限錯誤是由於phpcs.py正在第105行(https://github.com/benmatselby/sublime-phpcs/blob/master/phpcs.py#L105)執行。在這行之前放置一個'print cmd'並告訴我們這個命令。 – schlamar

+2

檢查了一下,這裏是修復:https://github.com/benmatselby/sublime-phpcs/issues/4 – schlamar

+0

當我有一個不同的錯誤,已經在配置中添加了路徑,所以我不認爲是這樣。 – petesiss

回答

1

把評論在這個答案並標記爲社區維基:

Check this out, here is the fix: github.com/benmatselby/sublime-phpcs/issues/4 – schlamar May 29 '12 at 13:47

Well the setting should link directly to the executable: '/opt/local/lib/php/pear/bin/phpcs' - schlamar May 29 '12 at 14:15

由於在github問題中有解釋,在phpcs中有一個新的設置來解決這個問題,允許用戶提供一個路徑到php cs可執行文件,如果Sublime不能自動找到它:

phpcs_executable_path

相關問題