| CSSED python scripting: User's Guide | ||
|---|---|---|
| <<< Previous | Next >>> | |
On the later chapter we saw how to execute one script, but when you want to execute one script more than one time it's much better to store it in a location where CSSED could find it each time the python plugin is loaded, to add it to the plugins' menu.
CSSED will search for your scripts on the directory $HOME/.cssed/pythonscripts, so if you use regularly one script you should store it there. On linux/unix systems, if the script have the executable bit set - with the chmod command or from the file-browser plugin with the "Change permissions" menu - it will be added to the scripts menu. On Windows systems, all *.py files will be added to the menu, so if you want to hide one file byte-compile it and delete the source file. Byte-compiled python files won't be shown in the menu.
Note: To compile python source you can import it from other python script - as it's automatically compiled - or use the py_compile module. As example to compile an script called test.py in the current directory, you may use:
This will produce the bycode file test.pyc.
import py_compile py_compile.compile("test.py")
You can pack your scripts in groups by grouping them into directories, each directory will be a sub-menu on the scripts menu.

| <<< Previous | Home | Next >>> |
| Executing one script | Coding scripts |