Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN

You are viewing 1/3rd of the document.
Purchase the document to get full access instantly.

Immediately available after payment
Both online and downloadable
No strings attached

Addr displaying version and nameif args posix subprocess

Ethernet: 169.254.29.140

Local Area Connection* 1: 169.254.179.170

System Name: DESKTOP-NRMLIPP

(api1) PS E:\systeminformation> python systeminfo.py -o

hello

usage: systeminfo.py [-h] [-n] [-i] [-o] [-c] [-m] [-d] [-p]

File "E:\systeminformation\systeminfo.py", line 52, in <module>

cpu_info = subprocess.check_output(['lscpu']).decode().split('\n')

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py" with Popen(*popenargs, **kwargs) as process:

^^^^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [WinError 2] The system cannot find the file specified

cpu_info = subprocess.check_output(['lscpu']).decode().split('\n')

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__

FileNotFoundError: [WinError 2] The system cannot find the file specified

(api1) PS E:\systeminformation> python systeminfo.py -d

E:\: 468.75 GB total, 18.24 GB used, 450.51 GB free

(api1) PS E:\systeminformation> python systeminfo.py -p

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output

self._execute_child(args, executable, preexec_fn, close_fds,

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child

hello

(api1) PS E:\systeminformation> python systeminfo.py -p

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__

self._execute_child(args, executable, preexec_fn, close_fds,

Directory: E:\systeminformation

Mode LastWriteTime Length Name

Traceback (most recent call last):

File "E:\systeminformation\systeminfo.py", line 52, in <module>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py" with Popen(*popenargs, **kwargs) as process:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [WinError 2] The system cannot find the file specified

ERROR: Could not find a version that satisfies the requirement python (from versions: none)

ERROR: No matching distribution found for python

(api1) PS E:\systeminformation> python systeminfo.py -c

hello

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output

return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

self._execute_child(args, executable, preexec_fn, close_fds,

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child

hello

Traceback (most recent call last):

return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

self._execute_child(args, executable, preexec_fn, close_fds,

File "C:\Users\Kalpana\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child

FOR THE INPUT(python language) means the code that i have written is

—------------->>

import socket

import subprocess

parser.add_argument('-i', '--ip', action='store_true', help='Display IP addresses by interface')

parser.add_argument('-o', '--os', action='store_true', help='Display OS version and name')

args = parser.parse_args()

# Displaying system name with domain name

if args.ip:

interfaces = psutil.net_if_addrs()

if addr.family == socket.AF_INET:

print('{}: {}'.format(ifname, addr.address))

os_release = subprocess.check_output(['uname', '-r']).decode().strip()

os_version = subprocess.check_output(['uname', '-v']).decode().strip()

os_info = os.sys.getwindowsversion()

os_version = '{}.{}.{}'.format(os_info.major, os_info.minor, os_info.build)

cpu_info = subprocess.check_output(['lscpu']).decode().split('\n')

cpu_model = [line.split(':')[1].strip() for line in cpu_info if 'Model name' in line][0]

mem_total = mem_info.total / (1024 ** 3)

print('Installed Memory: {:.2f} GB'.format(mem_total))

for partition in disk_info:

if 'loop' not in partition.device:

print('{}: {:.2f} GB total, {:.2f} GB used, {:.2f} GB free'.format(partition.mountpoint, disk_total, disk_used, disk_free))

# Display list of configured printers

Copyright © 2009-2023 UrgentHomework.com, All right reserved.