winsyspath
Definitive Python wrapper for Windows System Path
Compatibility
- Python 2.7.x
- Python 3.x and newer
Example
import winsyspath
# Directory to add in the System Path
path = 'C:\\'
# Init System Path wrapper and read its actual value
syspath_wrapper = winsyspath.WinSysPath()
# Try to add a path into System path
try:
if syspath_wrapper.add(path):
print("The path "{}" is correctly added to the System Path".format(path))
else:
print("The path "{}" is already in System Path, so cannot be added".format(path))
except (EnvironmentError, WindowsError, OSError, ValueError) as ex:
print("Error -> {}".format(str(ex)))
# Reload System path value (needed only if it is modified outside python)
syspath_wrapper.reload()
# Print System Path value as a list
print(syspath_wrapper.get())
# Print System Path value as a string
print(syspath_wrapper.get_str())
# Try to remove a path from System path
try:
if syspath_wrapper.remove(path):
print("The path "{}" is correctly removed from System Path".format(path))
else:
print("The path "{}" is not in System Path, so cannot be removed".format(path))
except (EnvironmentError, WindowsError, OSError, ValueError) as ex:
print("Error -> {}".format(str(ex)))
Sources
Release files for winsyspath 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| winsyspath-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Release files / winsyspath-0.1.0-py2.py3-none-any.whl
| Download URL | winsyspath-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
22703c00fecac7b60f29493ea3f386588cb32ab15409c48df49040f680fbfdf4
|
|
BLAKE2b-256 checksum How to use checksums |
4aa288d0209968e0d1d14f479120b85bb4639ba9069602963c926c381d4160c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |