I was under the impression that some simple Python scripts were allowed in Shapediver. Now I just uploaded a model that got rejected after checking the script.
The script in question could not be simpler, as it simply creates the current date and time based on the syntax of strftime (www.strftime.org).
from datetime import datetime
def schedule_solution_callback(doc):
ghenv.Component.ExpireSolution(False)
if e == None:
e = True
doc = ghenv.Component.OnPingDocument()
d = datetime.now().strftime(f)
if e:
doc.ScheduleSolution(1000, schedule_solution_callback)
Can you let me know what is not allowed about it, so I can change it.
How can I get the current date and time of a Shapediver execution short of just making it an input and generating it in the Javascript that calls it?
Is it because of that ScheduleSolution and OnPingDocument stuff? That part is actually not important, it just happens to be in the User Object I saved.
I will try again with just
from datetime import datetime
d = datetime.now().strftime(f)
Oh, I removed the thing entirely and now I see it’s still rejected. How can I begin to find out WHICH component is not allowed. It would be nice if the error gave just a little bit more hints.
The checking of non-allowed scripts and components should really happen in Grasshopper already. Or the error message gives the nickname of the rejected component(s).
Now its trial and error till I find what’s not allowed
Ah, turns out I left in another small component that contains some script that is not allowed.
Some better reporting of what exactly is not allowed in the script, what had been checked and what had been rejected would really go a very long way in make debugging so much faster.
And it’s not like you don’t know exactly the nickname of each component you had to check, reject, etc…
It’s like PHP telling you there is an error… where exactly? You go figure that part out…
You show us the model uuid and guid in the error message, which does not help us at all in finding the error.
You can use a Python script that gets the current date and time, such a script won’t be denied. Just be sure to understand that computation and export results are getting cached, i.e. next time you request a computation or export for the exact same parameter values, our Geometry Backend API will respond using the cached solution.
There is ways to work around this of course, by using some pseudo parameter that doesn’t have an effect except bypassing the cache.
Improved feedback for script checking is on our roadmap!