diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 51704c5..afd3f4c 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -1591,7 +1591,11 @@ Currently the magic system has the following functions:\n""" # Make sure that the running script gets a proper sys.argv as if it # were run from a system shell. save_argv = sys.argv # save it for later restoring - sys.argv = [filename]+ arg_lst[1:] # put in the proper filename + + # simulate shell expansion on arguments, at least tilde expansion + args = map(os.path.expanduser, arg_lst[1:]) + + sys.argv = [filename]+ args # put in the proper filename if opts.has_key('i'): # Run in user's interactive namespace