[PD] access environment variables from Pd?
Frank Barknecht
fbar at footils.org
Wed Jun 22 20:54:35 CEST 2005
Hallo,
Mike Wozniewski hat gesagt: // Mike Wozniewski wrote:
> Does anyone know if it's possible to access Linux environment variables
> from within Pd? ie, in a message object? ...or would I have to write
> an external for this?
You could do it with pyext:
import os
class env(pyext._class):
_inlets = 1
_outlets = 1
def bang_1(self):
for k,v in os.environ.items():
self._outlet(1,(k,v))
def get_1(self, k):
v = os.environ.get(str(k))
if v:
self._outlet(1,(k,v))
else:
print "No such environment var: %s " % k
Try "get PWD" on Unix.
Ciao
--
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41
More information about the Pd-list
mailing list