Show More
@@ -613,7 +613,7 b' Currently the magic system has the following functions:\\n"""' | |||
|
613 | 613 | except IOError,msg: |
|
614 | 614 | print msg |
|
615 | 615 | return |
|
616 |
page.page(self.shell.inspector.format( |
|
|
616 | page.page(self.shell.inspector.format(open(filename).read())) | |
|
617 | 617 | |
|
618 | 618 | def magic_psearch(self, parameter_s=''): |
|
619 | 619 | """Search for object in namespaces by wildcard. |
@@ -1541,7 +1541,7 b' Currently the magic system has the following functions:\\n"""' | |||
|
1541 | 1541 | `dump_file`+'.',sys_exit |
|
1542 | 1542 | if text_file: |
|
1543 | 1543 | text_file = unquote_filename(text_file) |
|
1544 |
pfile = |
|
|
1544 | pfile = open(text_file,'w') | |
|
1545 | 1545 | pfile.write(output) |
|
1546 | 1546 | pfile.close() |
|
1547 | 1547 | print '\n*** Profile printout saved to text file',\ |
@@ -203,7 +203,7 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):' | |||
|
203 | 203 | retval = 1 |
|
204 | 204 | else: |
|
205 | 205 | tmpname = tempfile.mktemp('.txt') |
|
206 |
tmpfile = |
|
|
206 | tmpfile = open(tmpname,'wt') | |
|
207 | 207 | tmpfile.write(strng) |
|
208 | 208 | tmpfile.close() |
|
209 | 209 | cmd = "%s < %s" % (pager_cmd,tmpname) |
@@ -602,7 +602,7 b' class path(unicode):' | |||
|
602 | 602 | u'\x85', u'\r\x85', and u'\u2028'. |
|
603 | 603 | |
|
604 | 604 | (This is slightly different from when you open a file for |
|
605 |
writing with fopen(filename, "w") in C or |
|
|
605 | writing with fopen(filename, "w") in C or open(filename, 'w') | |
|
606 | 606 | in Python.) |
|
607 | 607 | |
|
608 | 608 |
@@ -352,7 +352,7 b' class spawnb(object):' | |||
|
352 | 352 | Example log input and output to a file:: |
|
353 | 353 | |
|
354 | 354 | child = pexpect.spawn('some_command') |
|
355 |
fout = |
|
|
355 | fout = open('mylog.txt','w') | |
|
356 | 356 | child.logfile = fout |
|
357 | 357 | |
|
358 | 358 | Example log to stdout:: |
@@ -472,7 +472,7 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
472 | 472 | self.showtraceback() |
|
473 | 473 | else: |
|
474 | 474 | try: |
|
475 |
f = |
|
|
475 | f = open(err.filename) | |
|
476 | 476 | try: |
|
477 | 477 | # This should be inside a display_trap block and I |
|
478 | 478 | # think it is. |
@@ -281,7 +281,7 b' If no filename is given, or if filename is -, read standard input."""' | |||
|
281 | 281 | stream = sys.stdin |
|
282 | 282 | else: |
|
283 | 283 | try: |
|
284 |
stream = |
|
|
284 | stream = open(fname) | |
|
285 | 285 | except IOError,msg: |
|
286 | 286 | print >> sys.stderr, msg |
|
287 | 287 | sys.exit(1) |
@@ -251,7 +251,7 b' class KernelApp(BaseIPythonApplication):' | |||
|
251 | 251 | def init_blackhole(self): |
|
252 | 252 | """redirects stdout/stderr to devnull if necessary""" |
|
253 | 253 | if self.no_stdout or self.no_stderr: |
|
254 |
blackhole = |
|
|
254 | blackhole = open(os.devnull, 'w') | |
|
255 | 255 | if self.no_stdout: |
|
256 | 256 | sys.stdout = sys.__stdout__ = blackhole |
|
257 | 257 | if self.no_stderr: |
General Comments 0
You need to be logged in to leave comments.
Login now