Skip to content

Instantly share code, notes, and snippets.

@K240-zz
Last active November 5, 2015 10:08
Show Gist options
  • Select an option

  • Save K240-zz/8be4027dbce2a4c8f9d9 to your computer and use it in GitHub Desktop.

Select an option

Save K240-zz/8be4027dbce2a4c8f9d9 to your computer and use it in GitHub Desktop.
startup for python
print "Setting for python"
pythonpath = #(
-- add your python path.
@"d:\dev\3dsmax\python\lib"
)
for p in pythonpath do
(
format "add python path:%\n" p
cmd = "import sys;sys.path.append(r'"+p+"')"
python.execute cmd
)
fn execute_python filename =
(
try
(
fd = openFile filename mode:"r"
seek fd #eof
maxlen=filepos fd
seek fd 0
code = readChars fd maxlen errorAtEOF:false
close fd
return python.execute code
)
catch
(
return false
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment