Application data files
Prev
Next

Application data files

Each KDE application as a data directory of it's own for storing any extra data files it may need to run.

Data files are specified using the the application_data argument for setup(). application_data is a list of files to install.

    application_data = ['extracode.py', ('pics', ['pics/warning.png'])]
You can simply specify the name of each file as a string and they will be installed directly in the application data directory. Or you can use a tuple containing the name of the sub-directory under the application data directory to install into, and as the second tuple item, the list of files to install into the given sub-directory.

Since most large Python programs are broken up into multiple source files it is recommended that all of the Python files that comprise your application be installed into the application directory. This helps eliminate problems with the Python module path and the interpreter not being able find the correct file to import.

Even with all of the python files in the Application data directory, it is still desirable to have your application's "executables" available in KDE's bin directory. PyKDE Extensions provides an easy way for creating symbolic links from the "bin" directory to scripts in the application directory.

    executable_links = [('myapplication','myapplication.py'), ('myapplicationgui','myapplicationgui.py')]
This example specifies an executable symbolic link myapplication that points to the myapplication.py script in the application data directory.

Prev
Next
Home