Skip to content

fixed bug #506 #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bpython/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""

from __future__ import print_function
import code
import imp
import os
import sys
import code
from optparse import OptionParser, OptionGroup

from bpython import __version__
Expand Down Expand Up @@ -114,6 +115,9 @@ def exec_code(interpreter, args):
source = sourcefile.read()
old_argv, sys.argv = sys.argv, args
sys.path.insert(0, os.path.abspath(os.path.dirname(args[0])))
mod = imp.new_module('__console__')
sys.modules['__console__'] = mod
interpreter.locals = mod.__dict__
interpreter.locals['__file__'] = args[0]
interpreter.runsource(source, args[0], 'exec')
sys.argv = old_argv