Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package_python_function/nested_zip_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ def load_nested_zip() -> None:
os.rename(str(staging_package_path), str(target_package_path)) # Atomic -- TODO BW DOCME

# TODO BW: Update this comment
# We want our path to look like [working_dir, /tmp/package-python-function, ...]
sys.path.insert(1, target_package_path)
# [No longer applicable] We want our path to look like [working_dir, /tmp/package-python-function, ...]
# Refer to https://docs.aws.amazon.com/lambda/latest/dg/python-package.html#python-package-searchpath
# We need to replace the original path that AWS Lambda setup for us.
# sys.path.insert(1, target_package_path)
sys.path[0] = target_package_path
importlib.reload(sys.modules[__name__])

load_nested_zip()
Loading