LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 07-17-2008, 11:44 PM   #1
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 15
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.

Last edited by mpmackenna; 07-17-2008 at 11:46 PM.
 
Old 07-18-2008, 01:09 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,796

Rep: Reputation: 323Reputation: 323Reputation: 323Reputation: 323
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
 
Old 07-18-2008, 01:23 AM   #3
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
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.
 
Old 07-18-2008, 01:22 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,152

Rep: Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642
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
 
Old 07-18-2008, 01:31 PM   #5
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by knudfl View Post
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.
 
Old 07-18-2008, 06:30 PM   #6
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: SLED, openSUSE
Posts: 1,032

Rep: Reputation: 174Reputation: 174
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
 
Old 07-18-2008, 09:22 PM   #7
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by arizonagroovejet View Post
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.
 
Old 07-18-2008, 09:30 PM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
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.
 
Old 07-18-2008, 09:56 PM   #9
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jiml8 View Post
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.
 
Old 07-18-2008, 10:00 PM   #10
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
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.
 
Old 07-18-2008, 10:03 PM   #11
mpmackenna
Member
 
Registered: May 2006
Posts: 69

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jiml8 View Post
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.
 
Old 07-19-2008, 07:00 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,152

Rep: Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642
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
 
  


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
how to auto run app on startup? babag Mandriva 2 05-09-2008 12:40 AM
Run Python script as root at startup StuL Linux - General 2 03-05-2008 06:33 PM
Run app on fluxbox workspace 2 at startup mokele Slackware 6 08-23-2006 11:40 PM
KDE Software Issue (Crashed on every KDE app startup) mehmety@gmail.com Linux - Software 1 05-22-2006 12:56 PM
RH 8.0, run app on startup? rivethead Linux - Software 1 02-04-2003 02:19 PM


All times are GMT -5. The time now is 11:24 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