Python code to get system info, for desktop Python, MicroPython and CircuitPython
It's a simple Python code to get system info, tested on cpython (desktop Python), MicroPython on Raspberry Pi Pico2 and CircuitPython on ESP32-S3.
ex_py_info.py
"""
Exercise to get system info in Python
Tested on:
- desktop Python on Windows 11
- MicroPython on Raspberry Pi Pico 2 (RISCV)
- CircuitPython on ESP32-S3
"""
import os, sys
print(sys.implementation.name, ":")
print(sys.version)
print(sys.platform)
if sys.implementation.name == 'cpython':
# Desktop Python
import platform
print("=============================================")
print("Running on: ", platform.platform())
print("=============================================")
elif sys.implementation.name == 'micropython' or sys.implementation.name == 'circuitpython':
# MicroPython or CircuitPython
print("====================================")
print(sys.implementation[0], os.uname()[3],
"\nrun on", os.uname()[4])
print("====================================")
else:
print("====================================")
print(" - UNKNOWN -")
print("====================================")
cpython (desktop Python) 3.13.0 Running on: Windows-11-10.0.22631-SP0 |
micropython v1.24.0-preview on Raspberry Pi Pico2 with RP2350-RISCV |
circuitpython 9.1.4 on ESP32-S3-Zero with ESP32S3 |
Comments
Post a Comment