[Tutor] Path?

Adam Bark adam.jtm30 at gmail.com
Sun Jul 11 20:12:48 CEST 2010


On 11/07/10 18:42, Jim Byrnes wrote:
> I am running Ubuntu.  I downloaded the source code examples for a book 
> I purchased.  Some of the examples load image files located in the 
> same directory as the program.  If I go to the current directory in 
> the terminal the program can use the image files.  However, if I use a 
> launcher or the filemanager it pops up an error dialog saying the file 
> does not exist even though it is in the same directory.
>
> The program simply uses the files name.  Is there a way without 
> editing the source and inserting the full path to run the program from 
> a launcher or the filemanager and allow it to see files in the current 
> directory?
>
> Thanks,  Jim
Maybe create a bash script to call the python code something like:

#!/bin/bash

cd /directory/the/scripts/are/in
python script_name

HTH,
Adam.

PS if you want to use the same script for any python script you could 
change the last line to:

python $1

and call the bash script with the python script as the first argument


More information about the Tutor mailing list