Hello,
would like to execute a script during CE startup . In manual it says to put a script named startup.py into current CityEngine workspace. So I made a simple script that prints something in CE's console to check if it is working:
startup.py:
from scripting import *
ce = CE()
if __name__ == '__main__':print ("hello world from startup")
but when I startup CE it doesn't print anything to console. However, when I execute it, it works perfectly so it shouldn't contain any errors. but it doesn't get executed automatically during startup. Am I missing something?
also where exactly should this script be located by meaning "current CityEngine workspace" ?
is it
<workspace_root>/scripting.py
<workspace_root>/<project>/scripting.py
<workspace_root>/<project>/<scripts>/scripting.py
I placed it on all loactions and it doesn't work.
Any help appreciated.
Mark
Solved! Go to Solution.
Hello Marek Dekys
Thank you for your question.
On startup the __name__
variable is set to '__startup__'
Please change your script to:
from scripting import *
ce = CE()
if __name__ == '__startup__':
print ("hello world from startup")
Hello Marek Dekys
Thank you for your question.
On startup the __name__
variable is set to '__startup__'
Please change your script to:
from scripting import *
ce = CE()
if __name__ == '__startup__':
print ("hello world from startup")