Commit 4350a091 authored by Philip Thiem's avatar Philip Thiem

A few non-python 3 print statements

--HG--
branch : distribute
extra : rebase_source : 75f0b0e993a44ccfef8292717af58943e187d4cd
parent 1f43ab9b
...@@ -21,11 +21,11 @@ Let's create a simple script, foo-script.py: ...@@ -21,11 +21,11 @@ Let's create a simple script, foo-script.py:
... """#!%(python_exe)s ... """#!%(python_exe)s
... import sys ... import sys
... input = repr(sys.stdin.read()) ... input = repr(sys.stdin.read())
... print sys.argv[0][-14:] ... print(sys.argv[0][-14:])
... print sys.argv[1:] ... print(sys.argv[1:])
... print input ... print(input)
... if __debug__: ... if __debug__:
... print 'non-optimized' ... print('non-optimized')
... """ % dict(python_exe=nt_quote_arg(sys.executable))) ... """ % dict(python_exe=nt_quote_arg(sys.executable)))
>>> f.close() >>> f.close()
...@@ -54,7 +54,7 @@ the wrapper: ...@@ -54,7 +54,7 @@ the wrapper:
... + r' arg1 "arg 2" "arg \"2\\\"" "arg 4\\" "arg5 a\\b"') ... + r' arg1 "arg 2" "arg \"2\\\"" "arg 4\\" "arg5 a\\b"')
>>> input.write('hello\nworld\n') >>> input.write('hello\nworld\n')
>>> input.close() >>> input.close()
>>> print output.read(), >>> print(output.read(),)
\foo-script.py \foo-script.py
['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b'] ['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
'hello\nworld\n' 'hello\nworld\n'
...@@ -86,18 +86,18 @@ enter the interpreter after running the script, you could use -Oi: ...@@ -86,18 +86,18 @@ enter the interpreter after running the script, you could use -Oi:
... """#!%(python_exe)s -Oi ... """#!%(python_exe)s -Oi
... import sys ... import sys
... input = repr(sys.stdin.read()) ... input = repr(sys.stdin.read())
... print sys.argv[0][-14:] ... print(sys.argv[0][-14:])
... print sys.argv[1:] ... print(sys.argv[1:])
... print input ... print(input)
... if __debug__: ... if __debug__:
... print 'non-optimized' ... print('non-optimized')
... sys.ps1 = '---' ... sys.ps1 = '---'
... """ % dict(python_exe=nt_quote_arg(sys.executable))) ... """ % dict(python_exe=nt_quote_arg(sys.executable)))
>>> f.close() >>> f.close()
>>> input, output = os.popen4(nt_quote_arg(os.path.join(sample_directory, 'foo.exe'))) >>> input, output = os.popen4(nt_quote_arg(os.path.join(sample_directory, 'foo.exe')))
>>> input.close() >>> input.close()
>>> print output.read(), >>> print(output.read(),)
\foo-script.py \foo-script.py
[] []
'' ''
...@@ -136,10 +136,10 @@ Finally, we'll run the script and check the result: ...@@ -136,10 +136,10 @@ Finally, we'll run the script and check the result:
>>> input, output = os.popen4('"'+nt_quote_arg(os.path.join(sample_directory, 'bar.exe')) >>> input, output = os.popen4('"'+nt_quote_arg(os.path.join(sample_directory, 'bar.exe'))
... + r' "%s" "Test Argument"' % os.path.join(sample_directory, 'test_output.txt')) ... + r' "%s" "Test Argument"' % os.path.join(sample_directory, 'test_output.txt'))
>>> input.close() >>> input.close()
>>> print output.read() >>> print(output.read())
<BLANKLINE> <BLANKLINE>
>>> f = open(os.path.join(sample_directory, 'test_output.txt'), 'rb') >>> f = open(os.path.join(sample_directory, 'test_output.txt'), 'rb')
>>> print f.read() >>> print(f.read())
'Test Argument' 'Test Argument'
>>> f.close() >>> f.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment