Skip to content

Commit b79b2e9

Browse files
committed
Add __file__ in run context
1 parent 48eb0ed commit b79b2e9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pymode/run.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def run_code():
2828
lines.pop(ix)
2929

3030
context = dict(
31-
__name__='__main__', input=env.user_input, raw_input=env.user_input)
31+
__name__='__main__',
32+
__file__=env.var('expand("%:p")'),
33+
input=env.user_input,
34+
raw_input=env.user_input)
3235

3336
sys.stdout, stdout_ = StringIO(), sys.stdout
3437
sys.stderr, stderr_ = StringIO(), sys.stderr

0 commit comments

Comments
 (0)