Skip to content

Commit 0897619

Browse files
committed
Merging changes to enable local modules
2 parents 6c35cfb + 984eb05 commit 0897619

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

aws_lambda/aws_lambda.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import logging
55
import os
6+
import sys
67
import time
78
from imp import load_source
89
from shutil import copy, copyfile
@@ -110,6 +111,12 @@ def invoke(src, alt_event=None, verbose=False):
110111
path_to_event_file = os.path.join(src, 'event.json')
111112
event = read(path_to_event_file, loader=json.loads)
112113

114+
#Tweak to allow module to import local modules
115+
try:
116+
sys.path.index(src)
117+
except:
118+
sys.path.append(src)
119+
113120
handler = cfg.get('handler')
114121
# Inspect the handler string (<module>.<function name>) and translate it
115122
# into a function we can execute.

0 commit comments

Comments
 (0)