•  
  • Helping you upgrade your CG career

    How to get temp folder path in Maya python

    0
    votes

    In Mel, to get the temp folder path you can use the mel command :

    getenv "TEMP";

    When I lookup the python version of getenv, the documentation says Only available in MEL :( Is there an alternative method with python to get environment variable of temporary folder?

    asked 3 Years ago by
    Avatar image of CG Helpline user davidmccabe

    CGH Score : 0
    0 Comments :
    Add a Comment for this question
    Please Login or Register to add comment
    1 Answers :
    0
    votes

    In Python you can use tempfile to get the temp folder, so no need to depend on Mel. Here is the exact python code :

    import tempfile 
    temp_folder = tempfile.gettempdir()

    answered 3 Years ago by
    Avatar image of CG Helpline user KanoKan

    Denmark
    CGH Score : 212
    Expertise : Maya; Lighting; PyMel;
    0 Comments :
    Add a Comment for this answer
    Please Login or Register to add comment

    Submit your Answer :




    SUBMIT

    Page rendered in 0.1134 seconds. Memory usage : 3.95MB.