-
-
Save joseguzman1337/1c8a5e3a77353bd0e62d5bba5be096f1 to your computer and use it in GitHub Desktop.
System_Info.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# System_Info.py - experimenting with platform and os modules | |
/python2 ``` | |
import sys, os, platform | |
# flag to control level of printing out values here | |
longOutput = False | |
print '»sys Module' | |
print '----------' | |
if longOutput: print sys.copyright | |
if longOutput: print 'All built-in module names: ' + str(sys.builtin_module_names) | |
if longOutput: print 'All modules: ' + str(sys.modules) | |
print 'Platform: ' + sys.platform | |
print 'Executable: ' + sys.executable | |
print 'exec_prefix: ' + sys.exec_prefix | |
# returns none when no exception to process. print ' exc_info(): ' + str(sys.exc_info()) | |
print 'Default Encoding: ' + sys.getdefaultencoding() | |
print 'Current value of dont_write_bytecode: ' + str(sys.dont_write_bytecode) | |
print 'Current system flag values: ' + str(sys.flags) | |
print 'Float Info: ' + str(sys.float_info) | |
print sys.getfilesystemencoding() | |
object = 'object' | |
print sys.getrefcount(object) | |
#sys. | |
print '\n' | |
print '» os Module' | |
print '---------' | |
print 'Full OS Environment: ' + str(os.environ) | |
print 'USER: ' + os.environ['USER'] | |
print 'HOME: ' + os.environ['HOME'] | |
print 'PATH: ' + os.environ['PATH'] | |
print 'OS.NAME: ' + os.name | |
print 'OS Uname: ' + str(os. uname()) # returns same as platform.uname(), except platform variant also returns processor (here arm) as additional tuple entry | |
print '\n' | |
print '» platform Module' | |
print '---------------' | |
# returns portable tuple of strings for attributes that can be also separately computed as follows | |
print 'Platform Uname: ' + str(platform.uname()) | |
print 'platform.platform(): ' + platform.platform() | |
print 'Platform Python branch: ' + platform.python_branch() | |
#print 'sys alias: ' + platform.system_alias() | |
#platform. | |
print 'Platform Architecture: ' + str(platform.architecture()) | |
print 'Platform Processor: ' + platform.processor() | |
print 'Python Build: ' + str(platform.python_build()) | |
print 'Platform Python Implementation: ' + str(platform.python_implementation()) | |
print 'Platform Python Version: ' + platform.python_version() | |
print 'Platform Release: ' + platform.release() | |
print 'Platform Python Compiler: ' + platform.python_compiler() | |
#print 'Python Revision:' + str(platform.python_revision(a,b,c)) | |
print 'Platform System: ' + platform.system() #Darwin | |
#print 'Platform System Alias:' + str(platform.system_alias()) | |
print 'Platform Machine: ' + platform.machine() | |
print 'Platform Version: ' + str(platform.version()) | |
print 'Platform IOS (Mac) Version: ' + str(platform.mac_ver())#release, version, machine. Note ios but calls mac_ver(), there is no corresponding ios_ver() to call. | |
#print platform.dist() returns empty entries on ios | |
print 'Platform Node (iDevice name): ' + platform.node() #returns eg. 'Sheldons iPad' | |
# On ios system_alias does not seem to contain anything more useful than regular names or terms | |
print 'Platform System Alias: ' + str(platform.system_alias(platform.system(),platform.release(),platform.version())) | |
#print '===>' + str( | |
#return empty | |
#platform.libc_ver()) | |
#platform.dist()) | |
#platform.popen(x) | |
print '==>' +platform.python_branch() | |
print '==>' +str(platform.python_build() ) | |
print '==>' +platform.python_revision() | |
print '==>' +str(platform.python_version_tuple()) # returns 2,7,5 ie python version in parts | |
print '==>' +str(platform.win32_ver()) | |
#file system | |
print 'Current Directory: ' + os.getcwd() | |
print sys.maxsize | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment