December 3rd, 2003, 02:19 AM
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:
Thanks for your help.
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"
December 3rd, 2003, 07:52 AM
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.
December 3rd, 2003, 10:43 AM
Thanks for your reply. I Attached the Project. The shell script is Install.sh.
December 3rd, 2003, 11:21 AM
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.
December 3rd, 2003, 06:47 PM
Thanks all for your replys. Now is working fine.