1PMPYTHON(1)                 General Commands Manual                PMPYTHON(1)
2
3
4

NAME

6       pmpython - run a python script using a preferred python variant
7

SYNOPSIS

9       pmpython [python-args-and-script]
10

DESCRIPTION

12       pmpython  provides  a  way  to  run python scripts using a customisable
13       python interpreter, rather than embedding the name of a particular ver‐
14       sion of python into each script.
15
16       This  can  be useful as it allows version-independent python code to be
17       run anywhere.  All python modules shipped with PCP support versions 2.6
18       and  later  (in  the python2 series), and 3.3 and later (in the python3
19       release series).
20
21       Due to python monitoring and collecting scripts being relatively simple
22       in PCP (not requiring new modules, language features, etc), it has been
23       possible to ensure they work for all of the above python versions.
24
25       However, the name of the python interpreter is  not  always  the  same,
26       thus,  it is common for PCP python scripts to use a “shebang” line that
27       launches the python interpreter indirectly as follows:
28
29          #!/usr/bin/env pmpython
30
31       env(1) is used to find the correct path  for  the  pmpython  executable
32       from the user's $PATH.
33
34       By  default  the  name  of the python interpreter is found from the the
35       value of $PCP_PYTHON_PROG from  the  environment  (if  set)  else  from
36       /etc/pcp.conf.  The latter is the more typical case where this value is
37       based on some heuristics about the platform at the time the  PCP  pack‐
38       ages were build and favour the use of python3 in all recent releases of
39       PCP (for those platforms that support it).
40
41       This allows an appropriate name to be used for the  python  interpreter
42       instead  of  a hard-coded python version name, while still allowing the
43       user to override the python interpreter as follows:
44
45          $ PCP_PYTHON_PROG=python3 pmpython --version
46          Python 3.4.2
47          $ PCP_PYTHON_PROG=python2 pmpython --version
48          Python 2.7.9
49
50       This is convenient for shipping identical  scripts  on  multiple  plat‐
51       forms,  and  for  testing different python versions with the one script
52       (e.g. in the case where multiple  versions  of  python  are  installed,
53       PCP_PYTHON_PROG  can  be  set  in the local environment to override the
54       global setting).
55
56       pmpython is a replacement for an earlier tool  with  similar  function,
57       namely pcp-python(1).
58

PCP ENVIRONMENT

60       Environment variables with the prefix PCP_ are used to parameterize the
61       file and directory names used by PCP.  On each installation,  the  file
62       /etc/pcp.conf  contains  the  local  values  for  these variables.  The
63       $PCP_CONF variable may be used to specify an alternative  configuration
64       file, as described in pcp.conf(5).
65

SEE ALSO

67       env(1), pcp(1), pcp-python(1) and PCPIntro(1).
68
69
70
71Performance Co-Pilot                  PCP                          PMPYTHON(1)
Impressum