mirror of
https://github.com/wassname/blender_ipython.git
synced 2026-08-21 11:13:09 +08:00
28 lines
573 B
Python
Executable File
28 lines
573 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import os
|
|
import sys
|
|
import distutils.spawn
|
|
import subprocess
|
|
import tempfile
|
|
|
|
blender = distutils.spawn.find_executable("blender")
|
|
tempscript = tempfile.mktemp()+"_blender_ipython.py"
|
|
|
|
with open(tempscript,"w") as f:
|
|
f.write("""\
|
|
import sys
|
|
sys.argv[:] = [sys.executable]
|
|
from IPython.zmq.ipkernel import IPKernelApp
|
|
|
|
app = IPKernelApp.instance()
|
|
app.initialize(%r)
|
|
app.start()
|
|
""" % sys.argv[1:])
|
|
|
|
try:
|
|
print("starting:", blender, '-b', '-P', tempscript)
|
|
sys.exit(subprocess.call([blender, '-b', '-P', tempscript]))
|
|
finally:
|
|
os.remove(tempscript)
|