Skip to content

Built in variables

Jean Dubois edited this page Apr 24, 2024 · 13 revisions

List of built-in variables

Useful ones

__args__

Note: this has been added in Nougaro 0.16.0 beta

List of the command line arguments (type string).

Examples (assuming your Nougaro command is noug):

  • noug -c "print(__args__)" -t d 78876876 -v tth prints ["-c", "-t", "d", "78876876", "-v", "tth"]
  • noug examples/args.noug -t d 78876876 -v tth prints ["examples/args.noug", "-t", "d", "78876876", "-v", "tth"] (check out the contents of args.noug)
  • noug -c "print(__args__)" prints ["-c"]
  • entering the shell then entering print(__args__) prints []

Nougaro informations

  • __noug_version__: string of the Nougaro version (e.g. "0.15.0-beta".) You can use the noug_version lib to have better informations.
  • __data_version__: the Nougaro data version, an internal version keeping track of changes in the config file directory structure
  • __version_id__: an ID increased at least once per version
  • __python_version__: string of the Python version (e.g. "3.10.5")
  • __noug_dir__: string of the absolute path of the directory where shell.(py/exe) is located. May be used with file I/O read and write statements

OS informations

  • __os_name__ : name of the Operating System (e.g. "Windows", "Linux", "Darwin" – for macOS –, "Java" – for Jython –, …)
  • __os_release__ : release of the OS (e.g. "10" for Windows 10, "Vista" for Windows Vista.)
  • __os_version__ : version of the OS (e.g. "10.0.19044" for Windows 10 build 19044.)

Technical information

  • __symbol_table__ : string of the internal "p-formated" symbols dict.

Examples

print("You use Nougaro version " + __noug_version__ + ", interpreted with Python " + __python_version__)
print("You use " + __os_name__ + " " + __os_release__ + " " + __os_version__)

On the Jean Dubois' computer, under Windows 10 21H2, it returns:

You use Nougaro version alpha 0.8.1, interpreted with Python 3.10.5
You use Windows 10 10.0.19044

And under his Linux:

You use nougaro version beta 0.14, interpreted with Python 3.11.4
You use Linux 6.2.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 12 22:39:51 UTC 2023

Note that this code is in examples.noug

Clone this wiki locally