maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900) (https://talk.maemo.org/showthread.php?t=44576)

noobmonkey 2010-02-22 15:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 541195)
If the code you gave me earlier is what you are running..

Don't you need a:
#!/usr/bin/python

Or whatever the appropriate path is for python on the N900 at the beginning?

That could by why the desktop icon isn't working.

You want either:
Code:

Exec=python /opt/healthcheck/healthcheck.py
Or add the line above to the top of healthcheck.py.

Thanks Fatalsaint, again!

Got the (hashkey not working)! /usr/bin/env python
at the beginning

assuming the Exec=python /opt/healthcheck/healthcheck.py is for the .desktop file? (replace current line?)

(the icon loads, and it looks like the application loads, so not sure the error is there.)

fatalsaint 2010-02-22 15:32

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 541216)
Thanks Fatalsaint, again!

Got the (hashkey not working)! /usr/bin/env python
at the beginning

assuming the Exec=python /opt/healthcheck/healthcheck.py is for the .desktop file? (replace current line?)

(the icon loads, and it looks like the application loads, so not sure the error is there.)

Yes you can do one, or the other, or both..

Adding #!/usr/bin/env python to the top of healthcheck.py will allow you to either:
Code:

/opt/healthcheck/healthcheck.py
*or*
cd /opt/healthcheck/
./healthcheck.py

In a terminal.. Or use the Exec code you have right now. Not having that line in the file, requires you to pass it to python first with either:
Code:

python /opt/healthcheck/healthcheck.py
*or*
cd /opt/healthcheck
python healthcheck.py
*or*
Exec=python /opt/healthcheck/healthcheck.py

Etc....

noobmonkey 2010-02-22 16:05

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Ok, tried again with the exec python part - doesnt make a difference :(

So to confirm, .desktop has
Exec=python /opt/healthcheck/healthcheck.py

and the healthcheck.py file has #!/usr/bin/env python as it's first line.

The icon installs, it starts to run, and then just crashes out and dissapears....

qwerty12 2010-02-22 16:21

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 541287)
Ok, tried again with the exec python part - doesnt make a difference :(

With X-Osso-Service present in your desktop file, changing the Exec field there won't make a difference. Edit /usr/share/dbus-1/services/HealthCheck.service instead.

If the problem is that it crashes after some seconds when starting it from the menu (starting it from the terminal shouldn't cause it to crash) you need to initialize an osso.Context since you're using X-Osso-Service.

Try something like:
Code:

import osso
osso_c = osso.Context("healthcheck", "666", True)

If that fails, too, then you can try replacing the previous X-Osso-Type line with X-Osso-Type=application/x-python

If that also fails, comment out the X-Osso-Service line in your desktop file. Of course, only try all this if your program doesn't crash when started from the terminal.

noobmonkey 2010-02-22 16:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 541305)
With X-Osso-Service present in your desktop file, changing the Exec field there won't make a difference. Edit /usr/share/dbus-1/services/HealthCheck.service instead.

If the problem is that it crashes after some seconds when starting it from the menu (starting it from the terminal shouldn't cause it to crash) you need to initialize an osso.Context since you're using X-Osso-Service.

Try something like:
Code:

import osso
osso_c = osso.Context("healthcheck", "666", True)

If that fails, too, then you can try replacing the previous X-Osso-Type line with X-Osso-Type=application/x-python

If that also fails, comment out the X-Osso-Service line in your desktop file. Of course, only try all this if your program doesn't crash when started from the terminal.

I'm assuming the code is to go in my healthcheck.py file, and not the service file?
does run fine from terminal.

qwerty12 2010-02-22 16:30

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 541311)
I'm assuming the code is to go in my healthcheck.py file, and not the service file?
does run fine from terminal.

Yessssssir.

noobmonkey 2010-02-22 16:39

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Okey dokey, trying the osso stuff and will see how it goes :)

noobmonkey 2010-02-22 16:52

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Well
Quote:

import osso
osso_c = osso.Context("healthcheck", "666", True)
didn't work, will try the rest when i get home in 20 mins :D

noobmonkey 2010-02-22 17:17

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Just realised, not actually using python-osso.....

So removing traces of it from my code and the .desktop / build_app files....
Does that mean i can remove the lines
Quote:

X-Osso-Service=com.nokia.healthcheck
X-Osso-Type=application/x-executable
from the .desktop file too?

casper27 2010-02-22 17:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Just installed and same results as rest starts and then crashes just before launch. Getting there though Noob keep churning that code :)


All times are GMT. The time now is 19:07.

vBulletin® Version 3.8.8