MCPcopy Index your code
hub / github.com/ipython/ipython / find_cmd

Function find_cmd

IPython/utils/process.py:35–57  ·  view source on GitHub ↗

Find absolute path to executable cmd in a cross platform manner. This function tries to determine the full path to a command line program using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the time it will use the version that is first on the users `PATH`. Warning

(cmd)

Source from the content-addressed store, hash-verified

33
34
35def find_cmd(cmd):
36 """Find absolute path to executable cmd in a cross platform manner.
37
38 This function tries to determine the full path to a command line program
39 using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the
40 time it will use the version that is first on the users `PATH`.
41
42 Warning, don't use this to find IPython command line programs as there
43 is a risk you will find the wrong one. Instead find those using the
44 following code and looking for the application itself::
45
46 import sys
47 argv = [sys.executable, '-m', 'IPython']
48
49 Parameters
50 ----------
51 cmd : str
52 The command line program to look for.
53 """
54 path = shutil.which(cmd)
55 if path is None:
56 raise FindCmdError('command could not be found: %s' % cmd)
57 return path
58
59
60def abbrev_cwd():

Callers 6

latex_to_png_dvipngFunction · 0.90
kpsewhichFunction · 0.90
test_script_defaultsFunction · 0.90
test_find_cmd_lsFunction · 0.90
test_find_cmd_pythonwFunction · 0.90

Calls 1

FindCmdErrorClass · 0.85

Tested by 4

test_script_defaultsFunction · 0.72
test_find_cmd_lsFunction · 0.72
test_find_cmd_pythonwFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…