*************************************************************************** IPython post-mortem report IPython version: 0.7.2.svn SVN revision : $Revision: 1114 $ Platform info : os.name -> nt, sys.platform -> win32 *************************************************************************** Current user configuration structure: {'Version': 0, 'alias': [], 'args': [], 'autocall': 1, 'autoedit_syntax': 0, 'autoindent': 1, 'automagic': 1, 'banner': 1, 'c': '', 'cache_size': 1000, 'classic': 0, 'color_info': 1, 'colors': 'Linux', 'confirm_exit': 1, 'debug': 0, 'deep_reload': 0, 'editor': 'notepad', 'embedded': False, 'execfile': [], 'execute': ['', 'sys.path.append(r"c:\\python\\packages")', 'sys.path.append(r"C:\\python\\pypy\\dist-py")'], 'gthread': 0, 'help': 0, 'ignore': 0, 'import_all': [], 'import_mod': ['sys'], 'import_some': [[]], 'include': [], 'ipythondir': 'c:\\Documents and Settings\\JorgenSt\\_ipython', 'log': 0, 'logfile': '', 'logplay': '', 'magic_docstrings': 0, 'messages': 1, 'multi_line_specials': 1, 'nosep': 0, 'opts': Struct({}), 'pdb': 0, 'pprint': 1, 'profile': '', 'prompt_in1': 'In [\\#]: ', 'prompt_in2': ' .\\D.: ', 'prompt_out': 'Out[\\#]: ', 'prompts_pad_left': 1, 'pylab': 0, 'qthread': 0, 'quick': 0, 'rcfile': 'ipythonrc.ini', 'readline': 1, 'readline_merge_completions': 1, 'readline_omit__names': 0, 'readline_parse_and_bind': ['tab: complete', '"\\C-l": possible-completions', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\M-i": " "', '"\\M-o": "\\d\\d\\d\\d"', '"\\M-I": "\\d\\d\\d\\d"', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard'], 'readline_remove_delims': '-/~', 'screen_length': -2, 'separate_in': '\n', 'separate_out': '', 'separate_out2': '', 'system_verbose': 0, 'tk': 0, 'upgrade': 0, 'wildcards_case_sensitive': 0, 'wthread': 0, 'wxversion': '0', 'xmode': 'Context'} *************************************************************************** Crash traceback: --------------------------------------------------------------------------- exceptions.NameError Python 2.4.2: C:\Python24\python.exe Thu Mar 16 22:32:40 2006 A problem occured executing Python code. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call last. c:\python\ipython\ipython.py 1 2 3 4 5 #!/usr/bin/env python 6 # -*- coding: utf-8 -*- 7 """IPython -- An enhanced Interactive Python 8 9 The actual ipython script to be installed with 'python setup.py install' is 10 in './scripts' directory. This file is here (ipython source root directory) 11 to facilitate non-root 'zero-installation' (just copy the source tree ---> 12 somewhere and run ipython.py) and development. """ IPython.Shell.start.mainloop = undefined 13 14 import IPython 15 16 IPython.Shell.start().mainloop() 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 C:\python\ipython\IPython\Shell.py in mainloop(self=, sys_exit=0, banner=None) 43 44 #----------------------------------------------------------------------------- 45 # This class is trivial now, but I want to have it in to publish a clean 46 # interface. Later when the internals are reorganized, code that uses this 47 # shouldn't have to change. 48 49 class IPShell: 50 """Create an IPython instance.""" 51 52 def __init__(self,argv=None,user_ns=None,user_global_ns=None, 53 debug=1,shell_class=InteractiveShell): 54 self.IP = make_IPython(argv,user_ns=user_ns,user_global_ns=user_global_ns, 55 debug=debug,shell_class=shell_class) 56 57 def mainloop(self,sys_exit=0,banner=None): ---> 58 self.IP.mainloop(banner) self.IP.mainloop = > banner = None 59 if sys_exit: 60 sys.exit() 61 62 #----------------------------------------------------------------------------- 63 class IPShellEmbed: 64 """Allow embedding an IPython shell into a running program. 65 66 Instances of this class are callable, with the __call__ method being an 67 alias to the embed() method of an InteractiveShell instance. 68 69 Usage (see also the example-embed.py file for a running example): 70 71 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override]) 72 73 - argv: list containing valid command-line options for IPython, as they c:\python\ipython\IPython\iplib.py in mainloop(self=, banner="Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v...ut 'object'. ?object also works, ?? prints more.\n") 1342 1343 If an optional banner argument is given, it will override the 1344 internally created default banner.""" 1345 1346 if self.rc.c: # Emulate Python's -c option 1347 self.exec_init_cmd() 1348 if banner is None: 1349 if not self.rc.banner: 1350 banner = '' 1351 # banner is string? Use it directly! 1352 elif isinstance(self.rc.banner,basestring): 1353 banner = self.rc.banner 1354 else: 1355 banner = self.BANNER+self.banner2 1356 -> 1357 self.interact(banner) self.interact = > banner = 'Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]\nType "copyright", "credits" or "license" for more information.\n\nIPython 0.7.2.svn -- An enhanced Interactive Python.\n? -> Introduction to IPython\'s features.\n%magic -> Information about IPython\'s \'magic\' % functions.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\'. ?object also works, ?? prints more.\n' 1358 1359 def exec_init_cmd(self): 1360 """Execute a command given at the command line. 1361 1362 This emulates Python's -c option.""" 1363 1364 #sys.argv = ['-c'] 1365 self.push(self.rc.c) 1366 1367 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): 1368 """Embeds IPython into a running python program. 1369 1370 Input: 1371 1372 - header: An optional header message can be specified. c:\python\ipython\IPython\iplib.py in interact(self=, banner="Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v...ut 'object'. ?object also works, ?? prints more.\n") 1439 1440 The optional banner argument specify the banner to print 1441 before the first interaction; by default it prints a banner 1442 similar to the one printed by the real Python interpreter, 1443 followed by the current class name in parentheses (so as not 1444 to confuse this with the real interpreter -- since it's so 1445 close!). 1446 1447 """ 1448 cprt = 'Type "copyright", "credits" or "license" for more information.' 1449 if banner is None: 1450 self.write("Python %s on %s\n%s\n(%s)\n" % 1451 (sys.version, sys.platform, cprt, 1452 self.__class__.__name__)) 1453 else: -> 1454 self.write(banner) self.write = > banner = 'Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]\nType "copyright", "credits" or "license" for more information.\n\nIPython 0.7.2.svn -- An enhanced Interactive Python.\n? -> Introduction to IPython\'s features.\n%magic -> Information about IPython\'s \'magic\' % functions.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\'. ?object also works, ?? prints more.\n' 1455 1456 more = 0 1457 1458 # Mark activity in the builtins 1459 __builtin__.__dict__['__IPYTHON__active'] += 1 1460 1461 # exit_now is set by a call to %Exit or %Quit 1462 self.exit_now = False 1463 while not self.exit_now: 1464 if more: 1465 prompt = self.outputcache.prompt2 1466 if self.autoindent: 1467 self.readline_startup_hook(self.pre_readline) 1468 else: 1469 prompt = self.outputcache.prompt1 c:\python\ipython\IPython\iplib.py in write(self=, data="Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v...ut 'object'. ?object also works, ?? prints more.\n") 2146 2147 - data(None): if data is given, it gets written out to the temp file 2148 immediately, and the file is closed again.""" 2149 2150 filename = tempfile.mktemp('.py','ipython_edit_') 2151 self.tempfiles.append(filename) 2152 2153 if data: 2154 tmp_file = open(filename,'w') 2155 tmp_file.write(data) 2156 tmp_file.close() 2157 return filename 2158 2159 def write(self,data): 2160 """Write a string to the default output""" -> 2161 Term.cout.write(data) global Term.cout.write = > data = 'Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]\nType "copyright", "credits" or "license" for more information.\n\nIPython 0.7.2.svn -- An enhanced Interactive Python.\n? -> Introduction to IPython\'s features.\n%magic -> Information about IPython\'s \'magic\' % functions.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\'. ?object also works, ?? prints more.\n' 2162 2163 def write_err(self,data): 2164 """Write a string to the default error output""" 2165 Term.cerr.write(data) 2166 2167 def exit(self): 2168 """Handle interactive exit. 2169 2170 This method sets the exit_now attribute.""" 2171 2172 if self.rc.confirm_exit: 2173 if ask_yes_no('Do you really want to exit ([y]/n)?','y'): 2174 self.exit_now = True 2175 else: 2176 self.exit_now = True c:\python\ipython\IPython\genutils.py in write(self=, data="Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v...ut 'object'. ?object also works, ?? prints more.\n") 114 self.stream = stream 115 self._swrite = stream.write 116 self.flush = stream.flush 117 118 def write(self,data): 119 try: 120 self._swrite(data) 121 except: 122 try: 123 # print handles some unicode issues which may trip a plain 124 # write() call. Attempt to emulate write() by using a 125 # trailing comma 126 print >> self.stream, data, 127 except: 128 # if we get here, something is seriously broken. --> 129 print >> sys.stderr, \ global sys.stderr = ', mode 'w' at 0x009BE0B0> global stream = undefined 130 'ERROR - failed to write data to stream:', stream 131 132 class IOTerm: 133 """ Term holds the file or file-like objects for handling I/O operations. 134 135 These are normally just sys.stdin, sys.stdout and sys.stderr but for 136 Windows they can can replaced to allow editing the strings before they are 137 displayed.""" 138 139 # In the future, having IPython channel all its I/O operations through 140 # this class will make it easier to embed it into other environments which 141 # are not a normal terminal (such as a GUI-based shell) 142 def __init__(self,cin=None,cout=None,cerr=None): 143 self.cin = IOStream(cin,sys.stdin) 144 self.cout = IOStream(cout,sys.stdout) NameError: global name 'stream' is not defined *************************************************************************** History of session input: *** Last line of input (may not be in above history):