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