On Mon, 28 Mar 2016 13:52:31 +0200, liscju wrote: > +def copyusedenviron(environ): > + return {key: environ[key] for key in usedenvvariables if key in environ} Use dict(). The dict comprehension requires Python 2.7+. https://www.python.org/dev/peps/pep-0274/