Archived:How to get system information using PySymbian
This article shows how to retrieve system information in Python.
Note: The function ring_type is not available for S60 1st Edition.
The value returned by the battery function may be incorrect while the device is being charged.
from sysinfo import *
print "Battery level:", battery()
print "Signal strenght:", signal_bars()
print "Signal strenght in dBm:", signal_dbm()
print "Display resolution:", str(display_pixels()) + "x" + str(display_pixels())
print "Display size:", str(display_twips()) + "x" + str(display_twips()), "twips"
print "Free space:", free_drivespace()
print "IMEI:", imei()
print "RAM free/total:", str(free_ram()) + "/" + str(total_ram())
print "ROM:", total_rom()
print "Active profile:", active_profile()
print "Ring type:", ring_type()
print "Operating system version:", os_version()
print "Firmware version:", sw_version()
The information is displayed.
The following functions are available in the sysinfo module:
Returns the currently active profile as a string, which can be one of the following: 'general', 'silent', 'meeting', 'outdoor', 'pager', 'offline', , 'drive' or 'user <profile value>'.
Returns the current battery level. On devices based on S60 2nd Edition Feature Pack 1 (S60 2.1) or earlier the value ranges from 0 (empty) to 7 (full). On newer devices the value ranges from 0 (empty) to 100 (full). On the emulator the value is always 0.
Returns the width and height of the display in twips. A twip is 1/1440 of an inch or 1/567 of a centimeter.
Returns the width and height of the display in pixels.
Returns a dictionary with the available drive letters as keys and the free storage space on each drive as values.
Returns the IMEI code of the device as a Unicode string. If used on an emulator, the returned string will always be u'000000000000000'.
Returns the maximum size of the RAM drive on the device.
Returns the amount of RAM memory on the device.
Returns the amount of free RAM memory available on the device.
Returns the amount of read-only ROM memory on the device.
Returns the current ringing type as a string, which can be one of the following: 'normal', 'ascending', 'ring once', 'beep', or 'silent'.
Returns the current network signal strength ranging from 0 to 7, with 0 meaning no signal and 7 meaning a strong signal. If used on an emulator, the returned value will always be 0.
Available starting with SDK 2.8. Returns the current network signal strength in dBm. If used on an emulator, the returned value will always be 0.
Returns the software version as a Unicode string. If used on an emulator, the returned string will always be u'emulator'. For example, a software version can be returned as u'V 30.0.015 15-07-08 RM-159 N95(c)NMP'.
Returns the operating system version number of the device as a three element tuple (major version, minor version, build number). The elements are as follows:
- The major version number, ranging from 0 to 127 inclusive
- The minor version number, ranging from 0 to 99 inclusive
- The build number, ranging from 0 to 32767 inclusive.
On Nokia N80 the sw_version function returns error -46.
On Nokia N95 and Nokia E90 the max_ramdrive_size function returns KErrNotSupported.