# Some utilities made with the standard library - Windows only
## Tested against Windows / Python 3.11 / Anaconda
```py
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')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/nodepsutils",
"name": "nodepsutils",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "utils",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c2/20/63c6b6fa56e7f1e8a175ef1fbfa3b19e31dbc02cc8d5c6391df4b5971715/nodepsutils-0.10.tar.gz",
"platform": null,
"description": "\r\n# Some utilities made with the standard library - Windows only\r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n\r\n```py\r\nfrom nodepsutils import (\r\n get_tmpfile_with_remove,\r\n prettify_csv,\r\n startfile_wait,\r\n get_dev_dict,\r\n get_ip_of_this_pc,\r\n get_short_path_name,\r\n get_short_path_name_cached,\r\n send_ctrlc_to_process,\r\n get_information_from_all_procs_with_connections_and_open_files,\r\n get_pids_with_open_file,\r\n get_information_from_all_procs_with_connections,\r\n get_information_from_all_procs,\r\n get_tmpfile,\r\n kill_process,\r\n kill_processes_with_executable,\r\n set_read_write,\r\n set_read_only,\r\n start_detached_process,\r\n get_free_port,\r\n disable_internet_for_app,\r\n enable_internet_for_app,\r\n touch,\r\n)\r\n\r\ntmpfile1,removefunction=get_tmpfile_with_remove(suffix=\".csv\")\r\nprint(tmpfile1)\r\nprint(removefunction)\r\ntmpfile2=get_tmpfile()\r\nprint(tmpfile2)\r\nprettyfile = prettify_csv(r\"C:\\Users\\hansc\\Downloads\\titanic2.csv\")\r\nprint(prettyfile)\r\nstartfile_wait(r\"C:\\Users\\hansc\\Downloads\\titanic2.csv\")\r\n\r\n# network devices\r\ndevi=get_dev_dict()\r\nprint(devi)\r\n# ips \r\nmyip=get_ip_of_this_pc()\r\nmyipwithproxy = get_ip_of_this_pc(\r\n proxy={\r\n \"https\": f\"socks5://{myip}:50688\",\r\n \"http\": f\"socks5://{myip}:50688\",\r\n }\r\n)\r\nprint(myip)\r\nprint(myipwithproxy)\r\n\r\n# get short path\r\nshortpath=get_short_path_name(\r\n long_name=r\"C:\\Users\\hansc\\Downloads\\_1a063db4-b3b7-4bb2-84f5-cc6c9a21b9a8.jfif\"\r\n)\r\nprint(shortpath)\r\nshortpathcached = get_short_path_name_cached(\r\n long_name=r\"C:\\Users\\hansc\\Downloads\\_1a063db4-b3b7-4bb2-84f5-cc6c9a21b9a8.jfif\"\r\n)\r\nprint(shortpathcached)\r\n\r\n# ctrl+c\r\nsend_ctrlc_to_process(pid=5342)\r\n\r\n# process information\r\np1=get_information_from_all_procs()\r\np2=get_information_from_all_procs_with_connections()\r\np3=get_information_from_all_procs_with_connections_and_open_files()\r\np4 = get_pids_with_open_file(file=r\"C:\\Users\\hansc\\Downloads\\todasasmusicax.xlsx\")\r\n# killing a process, first gracefully, than forcefully\r\nfor v in p4:\r\n kill_process(pid=(v[\"ProcessId\"]), sleep_between_exitcommands=1)\r\n# killing a process, first gracefully, than forcefully\r\nkill_processes_with_executable(\r\n path=r\"C:\\WINDOWS\\system32\\notepad.exe\", sleep_between_exitcommands=1\r\n) \r\n\r\n\r\n# change rights of file \r\npath = r\"C:\\Users\\hansc\\Downloads\\titanic2.csv\"\r\nset_read_write(path)\r\nset_read_only(path)\r\n\r\n# start completely detached process (won't close when python closes)\r\nprocessdata=start_detached_process(\r\n command=[r\"C:\\Program Files\\BlueStacks_nxt\\HD-Player.exe\", \"--instance\", \"Rvc64_7\"],\r\n working_dir=r\"C:\\ProgramData\\BlueStacks_nxt\\Engine\\Rvc64_7\",\r\n convert_exe_to_83=True,\r\n convert_all_to_83=False,\r\n accept_already_running=True,\r\n use_cached_shortpath=True,\r\n timeout_get_new_process_data=5,\r\n get_proc_information=True,\r\n)\r\nprint(processdata)\r\n# free port with certain length\r\nget_free_port(minlen=5)\r\n# disable internet \r\ndisable_internet_for_app(exefile=r\"C:\\Program Files\\BlueStacks_nxt\\HD-Player.exe\")\r\nenable_internet_for_app(exefile=r\"C:\\Program Files\\BlueStacks_nxt\\HD-Player.exe\",disable_firewall=False)\r\n#create a file\r\ntouch('c:\\\\some\\\\not\\\\existing\\\\file.txt')\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Some utilities made with the standard library - Windows only",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/nodepsutils"
},
"split_keywords": [
"utils"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "238e2d3c43b3d25ea79f5e8630ad29de59dfa23fdca4ab4745c2b13cf01f6bc4",
"md5": "2142605f41a7c165e89b46a4f17e675f",
"sha256": "e68d83ad60e8ef94f2ff2a50fdeab57cf989be720c4087845a051785f6e7fd5d"
},
"downloads": -1,
"filename": "nodepsutils-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2142605f41a7c165e89b46a4f17e675f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13171,
"upload_time": "2024-03-18T04:05:50",
"upload_time_iso_8601": "2024-03-18T04:05:50.775064Z",
"url": "https://files.pythonhosted.org/packages/23/8e/2d3c43b3d25ea79f5e8630ad29de59dfa23fdca4ab4745c2b13cf01f6bc4/nodepsutils-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c22063c6b6fa56e7f1e8a175ef1fbfa3b19e31dbc02cc8d5c6391df4b5971715",
"md5": "71a3efd47d9aa67b4c1a26c1ab460dbb",
"sha256": "970a1678149363f9af1d2cd5243f4f17982d1c2efc91b61c7107eefeebbde023"
},
"downloads": -1,
"filename": "nodepsutils-0.10.tar.gz",
"has_sig": false,
"md5_digest": "71a3efd47d9aa67b4c1a26c1ab460dbb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12927,
"upload_time": "2024-03-18T04:05:52",
"upload_time_iso_8601": "2024-03-18T04:05:52.747769Z",
"url": "https://files.pythonhosted.org/packages/c2/20/63c6b6fa56e7f1e8a175ef1fbfa3b19e31dbc02cc8d5c6391df4b5971715/nodepsutils-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-18 04:05:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "nodepsutils",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "nodepsutils"
}