##// END OF EJS Templates
don't inject unicode into sys.argv...
MinRK -
Show More
@@ -1612,6 +1612,9 b' Currently the magic system has the following functions:\\n"""'
1612 args = [ os.path.expanduser(a) for a in arg_lst[1:] ]
1612 args = [ os.path.expanduser(a) for a in arg_lst[1:] ]
1613
1613
1614 sys.argv = [filename] + args # put in the proper filename
1614 sys.argv = [filename] + args # put in the proper filename
1615 # protect sys.argv from potential unicode strings on Python 2:
1616 if not py3compat.PY3:
1617 sys.argv = [ py3compat.cast_bytes(a) for a in sys.argv ]
1615
1618
1616 if 'i' in opts:
1619 if 'i' in opts:
1617 # Run in user's interactive namespace
1620 # Run in user's interactive namespace
@@ -28,6 +28,7 b' import sys'
28 from IPython.config.application import boolean_flag
28 from IPython.config.application import boolean_flag
29 from IPython.config.configurable import Configurable
29 from IPython.config.configurable import Configurable
30 from IPython.config.loader import Config
30 from IPython.config.loader import Config
31 from IPython.utils import py3compat
31 from IPython.utils.path import filefind
32 from IPython.utils.path import filefind
32 from IPython.utils.traitlets import Unicode, Instance, List, Bool
33 from IPython.utils.traitlets import Unicode, Instance, List, Bool
33
34
@@ -207,6 +208,9 b' class InteractiveShellApp(Configurable):'
207 # were run from a system shell.
208 # were run from a system shell.
208 save_argv = sys.argv
209 save_argv = sys.argv
209 sys.argv = [full_filename] + self.extra_args[1:]
210 sys.argv = [full_filename] + self.extra_args[1:]
211 # protect sys.argv from potential unicode strings on Python 2:
212 if not py3compat.PY3:
213 sys.argv = [ py3compat.cast_bytes(a) for a in sys.argv ]
210 try:
214 try:
211 if os.path.isfile(full_filename):
215 if os.path.isfile(full_filename):
212 if full_filename.endswith('.ipy'):
216 if full_filename.endswith('.ipy'):
General Comments 0
You need to be logged in to leave comments. Login now