from pathlib import Path # Get the absolute path for the current script script_path = Path(__file__).resolve().parent print(script_path)
/home/user/documents/code/my_script_folder
import logging # Create a logger object logger = logging.getLogger(__name__) # Set the logging level to DEBUG logger.setLevel(logging.DEBUG) # Log some messages logger.debug("This is a debug message") logger.info("This is an info message") logger.warning("This is a warning message") logger.error("This is an error message") # Get the current logging level level = logger.getLevel() print(level)
DEBUGPackage/Library: The `PathScript` and `PathLog` methods are part of the `Pathlib` module, which is part of the Python standard library. No additional package or library is required to use them.