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

load tshark executable returned by which tshark #53

Closed
goretkin opened this issue Feb 11, 2015 · 3 comments · Fixed by #58
Closed

load tshark executable returned by which tshark #53

goretkin opened this issue Feb 11, 2015 · 3 comments · Fixed by #58

Comments

@goretkin
Copy link
Contributor

On my system I have two versions of tshark. The one I get from typing tshark in bash is not the one that pyshark is loading because of the difference between the search order and my path environment variable order.

I don't suspect it's a common problem, but in my case it would be more intuitive to search for tshark first in the path and then in the default locations.

@bbayles
Copy link
Collaborator

bbayles commented Feb 14, 2015

@goretkin, could you try my branch? I think this is a good idea.

@goretkin
Copy link
Contributor Author

@bbayles thanks! which will return a new-line terminated path, so that needs to be stripped. Also check_output needs to be qualified. Then it works great!

@@ -36,7 +36,7 @@ def get_tshark_path():
     # `which tshark`, common paths.
     else:
         try:
-            which_tshark = check_output(['which', 'tshark']).decode('ascii')
+            which_tshark = subprocess.check_output(['which', 'tshark']).decode('ascii').strip()
         except subprocess.CalledProcessError:
             pass
         else:

@bbayles
Copy link
Collaborator

bbayles commented Feb 17, 2015

I like @baszoetekouw's method better than mine - I've replaced my method with his, and added it to #58.

@baszoetekouw and @goretkin, I will merge these on Wednesday morning unless @KimiNewt has some objection.

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants