Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created March 26, 2017 16:58
Show Gist options
  • Save FabienArcellier/091929eb25b7eb475d8bcf5eafa85eb8 to your computer and use it in GitHub Desktop.
Save FabienArcellier/091929eb25b7eb475d8bcf5eafa85eb8 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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