We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb1389a commit a33048dCopy full SHA for a33048d
bpython/args.py
@@ -3,9 +3,10 @@
3
"""
4
5
from __future__ import print_function
6
+import code
7
+import imp
8
import os
9
import sys
-import code
10
from optparse import OptionParser, OptionGroup
11
12
from bpython import __version__
@@ -114,6 +115,9 @@ def exec_code(interpreter, args):
114
115
source = sourcefile.read()
116
old_argv, sys.argv = sys.argv, args
117
sys.path.insert(0, os.path.abspath(os.path.dirname(args[0])))
118
+ mod = imp.new_module('__console__')
119
+ sys.modules['__console__'] = mod
120
+ interpreter.locals = mod.__dict__
121
interpreter.locals['__file__'] = args[0]
122
interpreter.runsource(source, args[0], 'exec')
123
sys.argv = old_argv
0 commit comments