Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dsdanielpark/8377f2f7db73a1d6252a6f1b157964d2 to your computer and use it in GitHub Desktop.
Save dsdanielpark/8377f2f7db73a1d6252a6f1b157964d2 to your computer and use it in GitHub Desktop.
ValueError: attempted relative import beyond top-level package
import sys
from pathlib import Path
file = Path(__file__).resolve()
package_root_directory = file.parents[1]
sys.path.append(str(package_root_directory))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment