Instantly share code, notes, and snippets.

Embed
What would you like to do?
isolate tmpdir
#!/usr/bin/python
# coding=utf-8
import os
import tempfile
from subprocess import call
def main():
os.environ["TMPDIR"] = "/home/far/tmp"
print(tempfile.gettempdir())
call(["bash", "script.sh"])
if __name__ == "__main__":
main()
#!/bin/bash
tmp=$(mktemp)
echo $tmp
@FabienArcellier

This comment has been minimized.

Show comment
Hide comment
@FabienArcellier

FabienArcellier Mar 26, 2017

python app.py
/home/far/tmp
/home/far/tmp/tmp.YdqkpH7thy
Owner

FabienArcellier commented Mar 26, 2017

python app.py
/home/far/tmp
/home/far/tmp/tmp.YdqkpH7thy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment