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:
- first argument is a string
- first argument is a Param_File object created by paramopen()
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