-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyRealLoc
executable file
·66 lines (51 loc) · 1.8 KB
/
pyRealLoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
#
# pyRealLoc: Find where the controlling Python executable really is.
# 2022-09-14: Written by Steven J. DeRose.
#
import sys
import argparse
__metadata__ = {
"title" : "pyRealLoc",
"description" : "Find where the controlling Python executable really is.",
"rightsHolder" : "Steven J. DeRose",
"creator" : "http://viaf.org/viaf/50334488",
"type" : "http://purl.org/dc/dcmitype/Software",
"language" : "Python 3.9",
"created" : "2022-09-14",
"modified" : "2022-09-14",
"publisher" : "http://github.com/sderose",
"license" : "Public domain"
}
__version__ = __metadata__["modified"]
descr = """
=Name=
pyRealLoc: Find where the controlling Python executable really is.
=Description=
Find where the controlling Python executable really is.
"whence", "which", "type", and such shell commands do little good when using
extra management layers, such as ''venv''. They will typically point you to
the finger pointing to the moon, not to the moon, for example to a symbolic link
a "shim" script.
==Usage==
python3.9 pyRealLoc
(or whatever python command you want to identify).
=Options=
"""
###############################################################################
# Main
#
def processOptions() -> argparse.Namespace:
try:
from BlockFormatter import BlockFormatter
parser = argparse.ArgumentParser(
description=descr, formatter_class=BlockFormatter)
except ImportError:
parser = argparse.ArgumentParser(description=descr)
parser.add_argument(
"--version", action="version", version=__version__,
help="Display version information, then exit.")
args0 = parser.parse_args()
return(args0)
args = processOptions()
print(getattr(sys, "executable"))