LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Python app to run on KDE startup (http://www.linuxquestions.org/questions/linux-desktop-74/python-app-to-run-on-kde-startup-656530/)

mpmackenna 07-17-2008 10:44 PM

Python app to run on KDE startup
 
I am trying to get gmail notifier to run at startup. I went to my /home/mike/.kde/autostart folder and created a new test file called notifier.py. Then in that file I typed the following lines.
Code:

#!/usr/bin/env python
/usr/share/gmail-notify/notifier.py

When I login instead of the script running it just opens the text file. I googled for the answer to this undeniably simple question, but so far I can't find it. Would someone please point me in the direction? Thanks so much for any assistance.
Mike
Note: I am running Mandriva Linux 2008.1 with KDE. Thanks!
Oh, one more thing, is /usr/share an appropriate place to put the gmail-notify folder? I don't know I am a newb.

bigrigdriver 07-18-2008 12:09 AM

Is notifier.py executable? Just because it's a python script doesn't make it executable. You have to set the executable bit: as root,
chmod u+x /usr/share/gmail-notify/notifier.py

mpmackenna 07-18-2008 12:23 AM

Quote:

Originally Posted by bigrigdriver (Post 3218427)
Is notifier.py executable? Just because it's a python script doesn't make it executable. You have to set the executable bit: as root,
chmod u+x /usr/share/gmail-notify/notifier.py

Still no dice... I think it was set as executable already. User mike has rwx rights to begin with and I ran that command as well. Still cant double click on my notifier.py shortcut and have the program launch.
Thanks for the response.

knudfl 07-18-2008 12:22 PM

The safe way : make a script (in e.g. /usr/local/bin)
and make the "script.sh" an entry in Autostart.
Quote:

#! /bin/sh
cd /usr/share/gmail-notify/
exec python notifier.py
Regards

mpmackenna 07-18-2008 12:31 PM

Quote:

Originally Posted by knudfl (Post 3219106)
The safe way : make a script (in e.g. /usr/local/bin)
and make the "script.sh" an entry in Autostart.

Regards

Same issue, I put a text file named notify.sh in ~/.kde/Autostart/ and when I login it just opens KWrite with the text of the script instead of running the commands.
I used your script with the following statements.
Code:

#!/bin/sh
cd /usr/share/gmail-notify/
exec python notifier.py

Thanks for responding.

arizonagroovejet 07-18-2008 05:30 PM

In my experience stuff in ~/.kde/Autostart has to be a .desktop entry. You can just stick scripts in to ~/.kde/shutdown though which strikes me as rather inconsistent, but there you go.

Anyway, try this: In ~/.kde/Autostart make a file called gmailnotifyer.desktop that contains the following:

Code:

[Desktop Entry]
Type=Application
Name=GMailNotifier
Exec=python /usr/share/gmail-notify/notifier.py


mpmackenna 07-18-2008 08:22 PM

Quote:

Originally Posted by arizonagroovejet (Post 3219346)
In my experience stuff in ~/.kde/Autostart has to be a .desktop entry. You can just stick scripts in to ~/.kde/shutdown though which strikes me as rather inconsistent, but there you go.

Anyway, try this: In ~/.kde/Autostart make a file called gmailnotifyer.desktop that contains the following:

Code:

[Desktop Entry]
Type=Application
Name=GMailNotifier
Exec=python /usr/share/gmail-notify/notifier.py


That worked! Thanks so much for the help.

jiml8 07-18-2008 08:30 PM

I think the problem with your script was your shebang was wrong.

You had it like this:

#!/usr/bin/env python

which has you invoking the env command. You should have had this:

$!/usr/bin/python

then your script would work.

mpmackenna 07-18-2008 08:56 PM

Quote:

Originally Posted by jiml8 (Post 3219455)
I think the problem with your script was your shebang was wrong.

You had it like this:

#!/usr/bin/env python

which has you invoking the env command. You should have had this:

$!/usr/bin/python

then your script would work.

I tried your suggestion just to see if it would help. It still didn't work.

The only thing that has been successful so far is the suggestion made by Arizonagroovejet.

Thanks for the response.

jiml8 07-18-2008 09:00 PM

Well, I did have a typo.

I put in $!/usr/bin/python, which should have been #!/usr/bin/python

I run some bash scripts in my autostart; I do not think it HAS to be a .desktop file.

mpmackenna 07-18-2008 09:03 PM

Quote:

Originally Posted by jiml8 (Post 3219473)
Well, I did have a typo.

I put in $!/usr/bin/python, which should have been #!/usr/bin/python

I run some bash scripts in my autostart; I do not think it HAS to be a .desktop file.

Yeah I caught your typo and corrected it for the test. It seems odd to me too that it would need to be a .desktop file, but that is the only thing that seems to be working for me at the moment. Thanks.

knudfl 07-19-2008 06:00 AM

Sorry, I didn't express the issue clearly.
Suggest : script in /usr/local/bin/"script"
..and a link (or Desktop entry) in Autostart :
http://gentoo-wiki.com/HOWTO_Autostart_Programs

Regards


All times are GMT -5. The time now is 06:56 AM.