LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-14-2004, 11:03 PM   #1
evilmrhenry
Member
 
Registered: Oct 2003
Distribution: Knoppix
Posts: 103

Rep: Reputation: 15
trouble creating a link to an application


KDE 3.1.4, Debian.

I have a python script that works, and I want to create a clickable shortcut to it.
The command "python script.py" works when input from the command line.

Here's what I've tried:

Right-click->new->link to application;

in the execute tab I've tried:

python script.py
'/usr/bin/python' script.py
python /home/paranoia/Desktop/python/script.py

The only one that works is the last one.
While this works for me, I'm going to be using this script on multiple computers, and cannot count on the file being in the same place.


I then tried a shell script:

#! /bin/sh
python script.py

This works, but only from the console. (./shell_script) Double-clicking on it doesn't do anything.
I can also get this to work by substituting '/home/paranoia/Desktop/python/script.py' for script.py, but the same problems from the "link to application" are created.

Obviously, the problem lies an inability to find files given a relative, not absolute, name.

So, is there any way to execute relative commands in a link to an application or shell script?
 
Old 02-15-2004, 12:15 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,974
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Try using a fully qualified path to the
python-script in the shell-script?

Code:
#!/bin/sh
python /path/to/script/script.py

Cheers,
Tink
 
Old 02-15-2004, 12:18 AM   #3
scott_R
Member
 
Registered: Jul 2003
Location: Brighton, Michigan, USA
Distribution: Lots of distros in the past, now Linux Mint
Posts: 746

Rep: Reputation: 31
Have you tried using the ./ or ~ path modifiers? Granted they don't help much, but ~/ might make it easier, as long as you install it in the same directory in whatever user's home directory. Otherwise, you might want to place it in a directory in your path, and create a new group, then add access as needed.

Last edited by scott_R; 02-15-2004 at 12:20 AM.
 
Old 02-15-2004, 01:19 AM   #4
evilmrhenry
Member
 
Registered: Oct 2003
Distribution: Knoppix
Posts: 103

Original Poster
Rep: Reputation: 15
Quote:
python /path/to/script/script.py
This does work, but I want the file to work independent of folder location.

Quote:
Have you tried using the ./ or ~ path modifiers?
python ./script.py works the same. ~ would help, but not much.


Oddly, after trying some things out, it appears that not even the following code will work from KDE (works fine from the console):

#! /bin/sh
echo qwerty >> testing.txt

testing.txt (created earlier) remains blank. Here are the properties for shell_script, according to the dialog:

Type: Shell Script

Permissions:
Code:
       Read Write Exec
User   X    X     X
Group  X    _     X
Others X    _     X
Set UID, Set GID, Sticky are all unchecked.

User: paranoia
Group: paranoia


EDIT:

Hey, it works now. I finally thought of looking for this problem in Google including the word "bug", and found this: http://dot.kde.org/1049507062/1049536268/ which gave me the line I needed to fix my problem. I also found the file testing.txt in ~ that my shell script had been dumping into. Sigh.

Just for anyone else with the same problem, this is my finished shell_script:

#!/bin/sh
cd `dirname $0`
exec python script.py

Make sure your shell script and path to your shell script doesn't have spaces in the name.

EDIT-EDIT:
By changing the script to:

#!/bin/sh
tempname=`dirname "$0"`
exec python "$tempname/script.py"

spaces in the filename or directory name will work.

Last edited by evilmrhenry; 02-15-2004 at 02:07 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating my own Application Cursor pihu Linux - General 3 09-02-2005 02:53 AM
how to link helpblocks application to gtk application m.harshavardhan Linux - Software 0 08-16-2005 08:39 AM
Creating a wizard like application Diederick Programming 1 07-07-2005 12:58 AM
Creating a Multithreaded Application kamransoomro84 Programming 3 06-03-2004 08:55 AM
Link to application breany Linux - Software 6 08-21-2002 09:03 PM


All times are GMT -5. The time now is 05:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration