On Thu, Apr 14, 2011 at 2:08 PM, Leandro Hermida <softdev@leandrohermida.com> wrote:
Hi,
I have a tool with a <code file="my_script.py"/> tag and in that code file I'm trying to get the tool dirpath where that script and the tool XML exist. I've tried:
os.path.abspath(os.path.dirname(sys.argv[0])) os.path.abspath(os.path.dirname(__file__))
And both don't work as expected. Is there a galaxy class I could import which will have the tool directory path?
regards, Leandro
For standard Python tools in Galaxy, I'm using os.path.split(sys.argv[0])[0] to get the path, which on reflection probably should be written as os.path.dirname(sys.argv[0]) as you suggest. What do __file__ and sys.argv[0] give you? The simplest way to debug this is to add a print statement, since Galaxy will show the stdout. Peter