Active Topics

 


Reply
Thread Tools
pbouda's Avatar
Posts: 35 | Thanked: 37 times | Joined on Nov 2009 @ Alcanena / Portugal
#1
Hi,

is there a quick way to check wether I am on Maemo from within python? I used:

if os.environ.has_key("OSSO_PRODUCT_NAME"):

But this does not seem to work anymore...

Peter
 
pbouda's Avatar
Posts: 35 | Thanked: 37 times | Joined on Nov 2009 @ Alcanena / Portugal
#2
Sorry, it works now... don't know what was wrong.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#3
I'm not sure about how to check for Maemo, per se, but if checking for a Hildon-based UI is sufficient (I don't know what your use-case is, so I'm just throwing it out there), there's some code in the init routines of Aarddict that you could lift. I'm not a Python coder myself, but I had to fiddle with that bit to get it to load the stock GTK UI on the N900, due to the fact that its Hildon routines were incompatible with the version in Maemo 5.
EDIT: I guess that wasn't what you're looking for, but I'll leave this here for reference, anyway.
 
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#4
This could help :

import platform

http://docs.python.org/library/platf...odule-platform
__________________
maemo blog
 
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#5
You could check for the hildon library.

Code:
try:
    import hildon
except:
    hildon = None

...

if (hildon):
    print "On Maemo"
else:
    print "Not on Maemo"
__________________
Tidings - RSS and Podcast aggregator for Jolla - https://github.com/pycage/tidings
Cargo Dock - file/cloud manager for Jolla - https://github.com/pycage/cargodock
 

The Following 2 Users Say Thank You to pycage For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#6
You could check for the existence of /proc/component_version. As a bonus, that file also contains the product code of the Maemo-running device.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Guest | Posts: n/a | Thanked: 0 times | Joined on
#7
Originally Posted by pycage View Post
You could check for the hildon library.
I'm pretty sure that's the code I was thinking of, only, not being a Python coder, I couldn't think of the syntax off the top of my head. Thanks! As I pointed out, though, this checks for Hildon - not a specific Maemo device, or even Maemo itself. So if the OP is using platform/device-specific features, they'll need to do it some other way.
 
zwer's Avatar
Posts: 455 | Thanked: 782 times | Joined on Nov 2009 @ Netherlands
#8
Or the most fail-safe way - use system call to grab the output from uname -a command. It will also give you the most data, too.
__________________
Man will never be free until the last king is strangled with the entrails of the last priest.
 
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#9
BTW: Hildon is available on e.g. Ubuntu as well, so just checking for hildon might not be enough evidence that you are really running on Maemo. qwerty12's solution of checking for /proc/component_version seems to be a more reliable check.
 

The Following User Says Thank You to thp For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#10
Originally Posted by zwer View Post
Or the most fail-safe way - use system call to grab the output from uname -a command. It will also give you the most data, too.
This is what the 'platform' module gives you, among other things. Part of the returned values is 'Nokia-N900-42-11', which is pretty precise IMHO...
__________________
maemo blog
 
Reply


 
Forum Jump


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