Вопрос

I have a command that involves ctags to index a large directory using python. It goes like this:

cmd = ['ctags', '-R', '-f', 'tagfile', 'my_large_dir']
subprocess.call(cmd)
#wait for ctags to finish then go on

This works perfectly on Win 7 and Ubuntu but not on Mac OSX Mavericks.

I then try to run the actual ctags command from the terminal and it works fine.

I then try to run a touch command from python to see if python has some aversion to creating files in my directory, and that works fine.

However, when I run the command above, it just hangs on the subprocess call.

Any ideas? I'm stumped and I need to figure this out by Friday :(

Update:

I forgot to mention that I had already installed the correct version of ctags from Homebrew. As ren pointed out though, when I used brew install ctags (notice NOT using sudo) it was placed into /usr/local/bin/ctags when I was looking in /usr/bin/ctags, which still had the wrong version I believe. For some reason, the version in /usr/bin/ just hung like it had an infinite loop somewhere...wierd.

Anyway, I pointed the command to the right path and it worked.

Это было полезно?

Решение 2

You are probably trying to run the ctags that comes with XCode.

To use the actual ctags you are looking for:

1) If you haven't installed brew already install it -> http://brew.sh/

2) If you haven't already installed the ctags you are actually looking for:

brew install ctags

3) Then try running this ctags as: /usr/local/bin/ctags instead of just writing ctags

Incase you can't find ctags in the directory I wrote, try running it like this ->

`brew --prefix`/bin/ctags

(yes with the quotes)

Другие советы

This would most likely be because of the incompatibility between GNU ctags and OSX/BSD ctags. For instance, OSX/BSD ctags does not accept the -R command line argument.

If you absolutely need the ability to recurse (which you probably do), I would suggest you install GNU or exuberant ctags via Homebrew.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top