Not signed in (Sign In)

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

    The help for the command line argument -zz states:

    "-zz Non-GUI mode. In that mode, the GUI is disabled completely. On Linux, this mode allows to use KLayout as a script interpreter for Ruby scripts without a display connection. However, some Ruby objects are not available (i.e. MainWindow)."

    Will this also run Python scripts or is it limited to just Ruby? I am currently working with Windows 10, but will be moving to CentOS 6.

    With KLayout 0.24.9 (64bit) on Windows 10, when I run a script with "klayout_app.exe -b -r clip.rb" the command returns immediately. I want to run this command from a script, and I need to know when it is complete. Is there a way to run KLayout so that it does not return control to the command line until the application exits? Or at least a way to know that it has completed running my script?

    Thanks for a great application.
    • CommentAuthorMatthias
    • CommentTimeMar 28th 2017

    Hi David,

    "Ruby" is just a synonym for "a reasonable language" :-) Python will do as well.

    The issue you see with the .exe returning immediate is because "klayout_app.exe" is built as a GUI application. On Windows, an application behaving the way you expect it needs to be built as a console application. So this is a compile-time decision, not a switch. The "-b" switch can't change the mode the application runs.

    I rarely got the request for a console executable (although that's possible). I guess most users trying to embed KLayout in a scripted flow are simply working on Linux.



    Thank you for getting back to me so quickly.

    Are you saying that on Linux KLayout will run as a command line tool where it will only return when complete?
    I did get the source as well. Could I rebuild the source as a console application?
    • CommentAuthorMatthias
    • CommentTimeMar 30th 2017 edited

    Hi David,

    yes, on Linux there is no difference between a console and GUI application. Just run klayout with -b and it will return when it's finished. You can also evaluate the exit status to check for errors.

    On Windows, you can try compiling as a console application. But building on Windows is very tricky (specifically 0.24.x) and you'd need to tweak the MSVC project manually. Using cygwin (some kind of Linux emulator) may be an option - I even think there is a KLayout package for cygwin available. But I don't have a pointer. Maybe someone else can help out?

    Kind regards,


    • CommentAuthorejprinz
    • CommentTimeSep 30th 2017
    Hi All:

    I had a similar desire on Windows, as I wanted to run the KLayout Python script inside JetBrains PyCharm (best Python environment ever).

    For me the following works:

    1. Create a windows batch file 'python.bat' with the content:

    @echo off
    "C:\Program Files\KLayout (64bit)\klayout_app.exe" -b -r %1

    2. I can then run command line apps under Cygwin bash, e.g.:
    returns some Warnings and "hello world"
    but Windows Powershell returns right away with no output. No clue why since I don't know much about Windows.

    3. I can also specify the 'python.bat' script as a Python interpreter in PyCharm and debug scripts which include the pya Python module. This seems to work.

    Best regards, Erwin