Support Forum

Scripting in python

User

Tuesday 3rd December 2019
Attachments:
(only for registered users)

test.PNG


testscript.PNG

I am attempting to run one of the example python scripts just to test the ability to output .gds files in this manner. Whenever I run a script however, no file is saved and if I press the execute button again a pop up appears that says "A script is still running, abort it?" I am positive that I'm outputting to the correct absolute path in the file save line. Is there some sort of setup protocol to allow LayoutEditor to find my python directory? Or is there something else I need to do. I've attached screenshots of 2 example scripts I am trying to run.Thanks in advance.
Jürgen
LayoutEditorFull
Tuesday 3rd December 2019
There are two possible causes: * You are using an older release of the LayoutEditor with the free version without a license key. Python scripting is included in the free version of the current release of the LayoutEditor, but in the past Python scripting required a full version for older releases. If you are not using the latest release, please update. * The Desktop folder is write protected by default in most Windows system, try to use a different folder. In the latest example shipped with the LayoutEditor the lines ``` import os l.drawing.saveFile( os.path.expanduser('~')+"/testout.gds") ``` are used, this version should run on all platforms without any modifications
User

Wednesday 4th December 2019
Even if I comment out the saveFile line, the program still does not run. The latest available free version I see online is from 8/20/2019 which is the version I'm using. Is there a newer version available?
Jürgen
LayoutEditorFull
Thursday 5th December 2019
That version is fine. With that version and without a license key the shipped examples all run fine. By comment out further line you should be able to detect where it is hanging. The second script you attached can be a ever lasting loop when you set some parameter to an invalid value. (e.g. increase the diameter so that all the wanted circle do no longer fit in the rec)
User

Friday 6th December 2019
I think I have found the problem. Once I press Utilities>Macros>Edit Macros, this line pops up in my LayoutEditor Starter Shell: "QWindowsNativeFileDialogBase::shellItem: SHCreateItemFromParsingName(file:///C:/Program Files (x86)/LayoutEditor/bin/../macros)) failed (An attempt was made to reference a token that does not exist.)" I have already uninstalled and reinstalled LayoutEditor. How can I fix this error? I am now attempting to run the following basic script: import LayoutScript from LayoutScript import * #create a new layout object l=project.newLayout(); print("Done") It fails at the project.newLayout(); line(I have tried this line with and without the semicolon). I know this because the program will run and print "Done" if I take out this line. No error shows when I press execute still, it seems to just run forever but not actually do anything. It seems it has something to do with finding the macros folder? Please advise on how to fix this. Thanks
Jürgen
LayoutEditorFull
Friday 6th December 2019
Is the path C:/Program Files (x86)/LayoutEditor/macros and C:/Program Files (x86)/LayoutEditor/Python present on your system? I guess is that there is some kind of 'system protection' installed that limit the access to the program files tree. Please try to remove the LayoutEditor installation and installed the LayoutEditot *.zip* package. That package will be visible after clicking on 'View all LayoutEditor packages' on the download page. This package need just to be unzip and you can start it from your local files by double clicking on the *start.bat* file.