Skip to content

Commit

Permalink
fix module-relative imports in rendered .py templates
Browse files Browse the repository at this point in the history
  • Loading branch information
etuttle committed May 31, 2015
1 parent 049cdd6 commit 8b3eb8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/cfn
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,21 @@ def render_python_template(file):
# just capture sys.stdout.

from cStringIO import StringIO
import sys
import os
import runpy
import sys

capture = StringIO()
orig_path = sys.path

try:
sys.path = sys.path[:]
sys.path[0] = os.path.dirname(file)
sys.stdout = capture
runpy.run_path(file)
finally:
sys.stdout = sys.__stdout__
sys.path = orig_path
res = capture.getvalue()
capture.close()

Expand Down

0 comments on commit 8b3eb8c

Please sign in to comment.