Logo by Marko (anonymous IP: 3.144.4.54,0) | ||||||||||||
| ||||||||||||
Audio (343) Datatype (51) Demo (203) Development (602) Document (24) Driver (97) Emulation (149) Game (1011) Graphics (500) Library (118) Network (234) Office (66) Utility (932) Video (69) Total files: 4399 Full index file Recent index file
 Amigans.net  OpenAmiga  Aminet  UtilityBase  IntuitionBase  AmigaBounty
Support the site
|
[Show comments] [Show snapshots] [Show videos] [Show content] [Show crashlogs] amigavars module for python INFORMATION The standard python API for access to the environment variables is very posix centric and only allows read only access to a copy of the evironment, loaded at script start and certainly doesn't provide write access to global amiga environment variables. Thus amiga script authors needing to set env vars must resort to pulling tricks like os.system("SETENV foo bar save") and the perhaps even more convoluted f = os.popen("getenv foo noline") var = f.read() f.close() if var[0:6] != "GETENV": do stuff with var to read it back again. This module addresses this by providing three functions analogous to the shell commands. GetEnv(name) Returns the variable name or None if it doesn't exists SetEnv(name,value,save) Set the variable name to value and saves to ENVARC: if save is True UnSetEnv(name,delete) Unset the variable name and delete it from ENVARC: if delete is True INSTALLATION Copy amigavars.so to PYTHON:lib/site-packages USAGE It's a standard module so you can use it any way a standard module might be used. e.g. import amigavars amigavars.GetEnv("foo") or from amigavars import * SetEnv("foo","bar") |
Copyright (c) 2004-2024 by Björn Hagström All Rights Reserved Amiga OS and its logos are registered trademarks of Hyperion Entertainment |