NOTE: If you want to use the Python bindings, you have to add the installation directory to your $PYTHONPATH:
export PYTHONPATH=$SAGA_LOCATION/lib/python2.5/site-packages/
You can test the Python bindings using the Python interpreter from the commandline. The following set of commands should display the interface deļ¬nition for the SAGA file package:
> python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import saga
>>> help(saga.file)
If this works, the SAGA Python binding seems to be installed properly on your system.
This example shows how to use the saga.file package to copy a file from the local system to a (remote) Globus GridFTP location. Please note that this example will only work if you have the SAGA Globus Adaptors installed and a valid X.509 Grid Proxy (grid-proxy-init).
# Copyright (c) 2005-2008 Ole Weidner (oweidner@cct.lsu.edu)
#
# Use, modification and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import saga
try:
source_url = saga.url("file:////etc/profile")
target_url = saga.url("gridftp://gg201.cct.lsu.edu//tmp/")
my_file = saga.file.file(source_url)
my_file.copy(target_url)
except saga.exception, e:
print "SAGA Error: ", e