Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/paramgetpath.html
Jump to: Description · Examples · See Also


AHELP for CIAO 4.17

paccess

Context: paramio

Synopsis

Returns the path to the specified parameter file.

Syntax

paccess(paramfile)
paccess(paramfile, mode)
paccess(fh, param)

paramgetpath(paramfile)
paramgetpath(fh)

Description

The paccess() and paramgetpath() routines are used to find out whether parameters and parameter files are accessible.

paccess()

There are two forms of the paccess() call:

If given a string as the first argument then paccess() will return the full path to the parameter file, or an exception if it can not be found or the parameter file can not be accessed using the supplied mode (the optional second argument).

If given a Param_File object as the first argument then paccess() returns 1 if the second argument is listed in the parameter file, or 0 if not.

paramgetpath()

The paramgetpath() function returns the location of the parameter file for the given argument, which can be either the name of the parameter file or the Param_File object returned by paramopen().


Examples

Example 1

>>> from paramio import *
>>> print(paccess("dmlist"))
/home/ciaouser/cxcds_param/dmlist.par

Example 2

>>> fp = paramopen("dmlist")
>>> print(paramgetpath(fp))
/home/ciaouser/cxcds_param/dmlist.par

Example 3

>>> fp = paramopen("dmcopy")
>>> print(paccess(fp, "infile"))
1
>>> print(paccess(fp, "value"))
0

See Also

paramio
paramclose, paramio, paramopen, pget, pgets, plist, pquery, pset, punlearn