Added some environment variables for the path to the executed script (both just to the directory level, and the full path.

This commit is contained in:
Jeremy Mack Wright 2017-04-28 16:44:33 -04:00
parent fcabea11b2
commit 456f520373

View File

@ -127,6 +127,10 @@ class CadQueryExecuteScript:
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
tempFile.close()
# Set some environment variables that may help the user
os.environ["MYSCRIPT_FULL_PATH"] = cqCodePane.file.path
os.environ["MYSCRIPT_DIR"] = os.path.dirname(os.path.abspath(cqCodePane.file.path))
# We import this way because using execfile() causes non-standard script execution in some situations
imp.load_source('temp_module', tempFile.name)