Skip to main content

Some utilities made with the standard library - Windows only

Project description

Some utilities made with the standard library - Windows only

Tested against Windows / Python 3.11 / Anaconda

from nodepsutils import (
    get_tmpfile_with_remove,
    prettify_csv,
    startfile_wait,
    get_dev_dict,
    get_ip_of_this_pc,
    get_short_path_name,
    get_short_path_name_cached,
    send_ctrlc_to_process,
    get_information_from_all_procs_with_connections_and_open_files,
    get_pids_with_open_file,
    get_information_from_all_procs_with_connections,
    get_information_from_all_procs,
    get_tmpfile,
    kill_process,
    kill_processes_with_executable,
    set_read_write,
    set_read_only,
    start_detached_process,
    get_free_port,
    disable_internet_for_app,
    enable_internet_for_app,
    touch,
)

tmpfile1,removefunction=get_tmpfile_with_remove(suffix=".csv")
print(tmpfile1)
print(removefunction)
tmpfile2=get_tmpfile()
print(tmpfile2)
prettyfile = prettify_csv(r"C:\Users\hansc\Downloads\titanic2.csv")
print(prettyfile)
startfile_wait(r"C:\Users\hansc\Downloads\titanic2.csv")

# network devices
devi=get_dev_dict()
print(devi)
# ips 
myip=get_ip_of_this_pc()
myipwithproxy = get_ip_of_this_pc(
    proxy={
        "https": f"socks5://{myip}:50688",
        "http": f"socks5://{myip}:50688",
    }
)
print(myip)
print(myipwithproxy)

# get short path
shortpath=get_short_path_name(
    long_name=r"C:\Users\hansc\Downloads\_1a063db4-b3b7-4bb2-84f5-cc6c9a21b9a8.jfif"
)
print(shortpath)
shortpathcached = get_short_path_name_cached(
    long_name=r"C:\Users\hansc\Downloads\_1a063db4-b3b7-4bb2-84f5-cc6c9a21b9a8.jfif"
)
print(shortpathcached)

# ctrl+c
send_ctrlc_to_process(pid=5342)

# process information
p1=get_information_from_all_procs()
p2=get_information_from_all_procs_with_connections()
p3=get_information_from_all_procs_with_connections_and_open_files()
p4 = get_pids_with_open_file(file=r"C:\Users\hansc\Downloads\todasasmusicax.xlsx")
# killing a process, first gracefully, than forcefully
for v in p4:
    kill_process(pid=(v["ProcessId"]), sleep_between_exitcommands=1)
# killing a process, first gracefully, than forcefully
kill_processes_with_executable(
    path=r"C:\WINDOWS\system32\notepad.exe", sleep_between_exitcommands=1
)   


# change rights of file 
path = r"C:\Users\hansc\Downloads\titanic2.csv"
set_read_write(path)
set_read_only(path)

# start completely detached process (won't close when python closes)
processdata=start_detached_process(
    command=[r"C:\Program Files\BlueStacks_nxt\HD-Player.exe", "--instance", "Rvc64_7"],
    working_dir=r"C:\ProgramData\BlueStacks_nxt\Engine\Rvc64_7",
    convert_exe_to_83=True,
    convert_all_to_83=False,
    accept_already_running=True,
    use_cached_shortpath=True,
    timeout_get_new_process_data=5,
    get_proc_information=True,
)
print(processdata)
# free port with certain length
get_free_port(minlen=5)
# disable internet 
disable_internet_for_app(exefile=r"C:\Program Files\BlueStacks_nxt\HD-Player.exe")
enable_internet_for_app(exefile=r"C:\Program Files\BlueStacks_nxt\HD-Player.exe",disable_firewall=False)
#create a file
touch('c:\\some\\not\\existing\\file.txt')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nodepsutils-0.10.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

nodepsutils-0.10-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file nodepsutils-0.10.tar.gz.

File metadata

  • Download URL: nodepsutils-0.10.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for nodepsutils-0.10.tar.gz
Algorithm Hash digest
SHA256 970a1678149363f9af1d2cd5243f4f17982d1c2efc91b61c7107eefeebbde023
MD5 71a3efd47d9aa67b4c1a26c1ab460dbb
BLAKE2b-256 c22063c6b6fa56e7f1e8a175ef1fbfa3b19e31dbc02cc8d5c6391df4b5971715

See more details on using hashes here.

File details

Details for the file nodepsutils-0.10-py3-none-any.whl.

File metadata

  • Download URL: nodepsutils-0.10-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for nodepsutils-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e68d83ad60e8ef94f2ff2a50fdeab57cf989be720c4087845a051785f6e7fd5d
MD5 2142605f41a7c165e89b46a4f17e675f
BLAKE2b-256 238e2d3c43b3d25ea79f5e8630ad29de59dfa23fdca4ab4745c2b13cf01f6bc4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page