MCPcopy Index your code
hub / github.com/bleachbit/bleachbit / get_executable

Function get_executable

bleachbit/General.py:104–127  ·  view source on GitHub ↗

Return the absolute path to the executable The executable is either Python or, if frozen, then bleachbit.exe. When running under `env -i`, sys.executable is an empty string.

()

Source from the content-addressed store, hash-verified

102
103
104def get_executable():
105 """Return the absolute path to the executable
106
107 The executable is either Python or, if frozen, then
108 bleachbit.exe.
109
110 When running under `env -i`, sys.executable is an empty string.
111 """
112 if sys.executable:
113 # example: /usr/bin/python3
114 return sys.executable
115 # When running as unittest, sys.argv may look like this:
116 # [' -m unittest', '-v', 'tests.TestGeneral']
117 try:
118 # example: /usr/bin/python3.12
119 # Notice it ends with .12.
120 return os.readlink('/proc/self/exe')
121 except Exception:
122 pass
123 for py in ['python3', 'python']:
124 py_which = shutil.which(py)
125 if py_which:
126 return py_which
127 raise RuntimeError('Cannot find Python executable')
128
129
130def get_real_username():

Callers 11

test_make_sourceMethod · 0.90
test_debug_logMethod · 0.90
test_encodingMethod · 0.90
test_invalid_localeMethod · 0.90
test_previewMethod · 0.90
test_return_textMethod · 0.90
test_shredMethod · 0.90
test_sysinfoMethod · 0.90
test_gui_exitMethod · 0.90
test_get_executableMethod · 0.90
get_system_informationFunction · 0.90

Calls

no outgoing calls

Tested by 10

test_make_sourceMethod · 0.72
test_debug_logMethod · 0.72
test_encodingMethod · 0.72
test_invalid_localeMethod · 0.72
test_previewMethod · 0.72
test_return_textMethod · 0.72
test_shredMethod · 0.72
test_sysinfoMethod · 0.72
test_gui_exitMethod · 0.72
test_get_executableMethod · 0.72