Skip to content

Instantly share code, notes, and snippets.

@mh0w
Last active July 8, 2024 15:57
Show Gist options
  • Save mh0w/04e00ce5a05226366d599d1d3b31ebd8 to your computer and use it in GitHub Desktop.
Save mh0w/04e00ce5a05226366d599d1d3b31ebd8 to your computer and use it in GitHub Desktop.
Add directory to PATH
import sys
import os
# Define the path to add to sys.path, such as the current working directory
print(os.getcwd())
path_to_add = os.getcwd()
# Add the path_to_add to the system path
if path_to_add not in sys.path:
sys.path.append(path_to_add)
# Verify that the current directory is added to the system path
print(sys.path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment