Grasshopper

algorithmic modeling for Rhino

Is there anyway to terminate python execution without passing through the entire code?

Hey,

So I want to put a stop/end to my code before it finishes so I can check the values of my elements. Because the code towards the end is giving me problems, I want to be able to avoid them and to see what might be causing it. I don't want to have to put a # on every line. Is there anyway to have python quit? Better yet, is there anyway to see the value of your elements without having to run through the code all the way or setting it to an output?

Views: 453

Replies to This Discussion

If you are not wrapping your script inside a function then you can use assert False. You need to print the values that you are watching for so you can see the results since assert technically throw an exception.

#your script

print "values that you want to see"

assert False

# rest of the code

Better practice is to use a function and return the values that you want to check in the middle of the code.

def main(inputs):

     # your code

     return values that you want to check

     # rest of the code

Is there nothing like "skip to the end"? I really need to see my geometry. The print command does not show me what I need to see, and its hard to understand lists.

I'm not sure what you want to do but it looks using a function should still work for you. You can return the geometries.

I also assume that you know that you can comment multiple lines buy putting them between """. If you only want to test the last part of the code then comment out the top part!

"""

this will be commented out!

"""

Thanks, the three quotation marks work. I might even try using a debugger with grasshopper.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service