[PD] access environment variables from Pd?

Frank Barknecht fbar at footils.org
Wed Jun 22 20:54:35 CEST 2005

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():

    def get_1(self, k):
        v = os.environ.get(str(k))
        if v:
            print "No such environment var: %s " % k

Try "get PWD" on Unix.

 Frank Barknecht                               _ ______footils.org__
          _ __latest track: "scans" _ http://footils.org/cms/show/41

More information about the Pd-list mailing list