Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorenuinc
    • CommentTimeApr 12th 2018
     
    Hi

    I am writing a python script but can not figure out how to do debug the script. I can insert print statements in the script but it becomes time consuming and not very effective. Is there a way to run the "pdb" like thing to step through the python script?

    Thanks
    enuinc
  1.  

    If you are using the built in IDE (Press F5 to get it), then there are two toolbar buttons with tiny short or long green arrows -- to step into or over blocks. Just like pdb. You can also press F10 or F11.

    • CommentAuthorenuinc
    • CommentTimeApr 13th 2018
     
    Thanks. However, I am using the "klayout -z -r test.py" type of way to run it. do you know how to use pdb in such usage mode?
    • CommentAuthorMatthias
    • CommentTimeApr 13th 2018
     

    Hi enuinc,

    Basically for your kind of application, the Python API should be available as a plain Python module. That's not my main scope and raises some license questions, so I have not provided such a module yet.

    As of now, you can use the following trick:

    def mycode():
      ... put your code here ...
    
    # main entry point:
    if "debug_me" in globals():
      import pdb; pdb.run("mycode()")
    else:
      mycode()
    

    For normal operation, use

    klayout -z -r myscript.py
    

    for debugging, use

    klayout -rd debug_me=1 -z -r myscript.py
    

    Matthias