Skip to content

Commit 984eb05

Browse files
committed
Issue nficano#31
Adding local directory to the sys.path. This allows local invoking to include local modules.
1 parent 39476c3 commit 984eb05

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)