Galaxie Shell 0.2.6 documentation


Navigation:   | Index   | Search   | Top   | Up   | Prev   | Next   |
Table of Content: |glxshell.lib.environ module |EINVAL |ENOMEM |GLXEnviron |GLXEnviron.environ |GLXEnviron.getenv() |GLXEnviron.setenv() |GLXEnviron.unsetenv() |

© Copyright 2020-2024, Galaxie Shell Team.

Top » glxshell » glxshell package » glxshell.lib package » glxshell.lib.environ module

glxshell.lib.environ module

exception glxshell.lib.environ.EINVAL[source]

Bases: Exception

exception glxshell.lib.environ.ENOMEM[source]

Bases: Exception

class glxshell.lib.environ.GLXEnviron[source]

Bases: object

property environ: dict

Return the environ property value

getenv(name=None)[source]

getenv - get value of an environment variable

The getenv() function shall search the environment of the calling process for the environment variable name if it exists and return the value of the environment variable. If the specified environment variable cannot be found, None shall be returned.

Parameters:

name (str) – the key name

setenv(envname=None, envval=None, overwrite=None)[source]

setenv - add or change environment variable

The setenv() function shall update or add a variable in the environment of the calling process. The envname argument points to a string containing the name of an environment variable to be added or altered. The environment variable shall be set to the value to which envval points. The function shall fail if envname points to a string which contains an ‘=’ character. If the environment variable named by envname already exists and the value of overwrite is non-zero, the function shall return success and the environment shall be updated. If the environment variable named by envname already exists and the value of overwrite is zero, the function shall return success and the environment shall remain unchanged.

Parameters:
  • envname (str) – the key name

  • envval (str) – the value of the key

  • overwrite (int) – non-zero

Raises:
  • EINVAL – when envname argument points to an empty string or points to a string containing an ‘=’ character

  • ENOMEM – when Insufficient memory was available to add a variable or its value to the environment.

  • TypeError – when he name argument value is not a str type or None

Returns:

0 if success, otherwise -1

Return type:

int

unsetenv(name)[source]

unsetenv - remove an environment variable

The unsetenv() function shall remove an environment variable from the environment of the calling process. The name argument points to a string, which is the name of the variable to be removed. The named argument shall not contain an ‘=’ character. If the named variable does not exist in the current environment, the environment shall be unchanged and the function is considered to have completed successfully.

Parameters:

name (str) – the name of the variable to be removed

Raises:
  • EINVAL – when he name argument value is an empty string, or a string containing an ‘=’ character.

  • TypeError – when he name argument value is not a str type or None

Returns:

0 if success, otherwise -1

Return type:

int

Top » glxshell » glxshell package » glxshell.lib package » glxshell.lib.environ module

© Copyright 2020-2024, Galaxie Shell Team.
This page is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (CC BY-NC-SA 4.0).
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

Last updated on None.
Created using Sphinx 8.0.2.