#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Somewhere over the Rainbow
    Posts
    128
    Rep Power
    12

    Troubles with Shell Script


    Hi. I have a problem with my shell script, I used images in my project, all the installation works fine, I copied my project into /usr/bin/ and when I will run my project "couldn't open "filenew.gif": no such file or directory" shows up. Like the link to my project folder doesnt works. What could be the problem?. The link in /usr/bin/ looks fine:

    Link Target: /usr/share/PadPaper-EDITOR-1.01/PadPaper.py

    Part of my Shell Script:

    Code:
    su -c "mkdir -p /usr/share/PadPaper-EDITOR-1.01/ && cp *.py *.gif README COPYING AUTHORS /usr/share/PadPaper-EDITOR-1.01/ && chmod a+x /usr/share/PadPaper-EDITOR-1.01/PadPaper.py && ln -sf /usr/share/PadPaper-EDITOR-1.01/PadPaper.py /usr/bin/PadPaper"
    Thanks for your help.
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    What directory does the application think it is running from?

    And where are the gif files relative to that location?

    It sounds like you have a relative addressing problem.

    Grim
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Somewhere over the Rainbow
    Posts
    128
    Rep Power
    12
    Thanks for your reply. I Attached the Project. The shell script is Install.sh.
    Attached Files
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    133
    Rep Power
    12
    Well, then thing is: What Grim said applies. When you run an application or a script, the current working directory is the base directory from where relative file locations are mapped.

    This is to say that: for every file you name with no path, i.e. just the filename, an equivalent way of naming that file would be './file'.

    The node you are at in the directory structure becomes the base, so if you're in your home folder, a third way of saying the exact same thing would be '~/file'. For me, this would be '/Users/simon/file', with the shell expanding the '~' token.

    In your PadPaper.py file, you point to the GIF files without any path information. Now you know where Python looks for those files; it ain't in your project folder.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Somewhere over the Rainbow
    Posts
    128
    Rep Power
    12
    Thanks all for your replys. Now is working fine.

IMN logo majestic logo threadwatch logo seochat tools logo