Skip to content
Closed
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
Change __name__ to '__main__'
  • Loading branch information
afrieder committed Jul 8, 2017
commit 5827922b3cb527121682e8be435ea372976dd2cf
4 changes: 2 additions & 2 deletions bpython/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ 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
mod = imp.new_module('__main__')
sys.modules['__main__'] = mod
interpreter.locals = mod.__dict__
interpreter.locals['__file__'] = args[0]
interpreter.runsource(source, args[0], 'exec')
Expand Down