<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">When tracking down problems like this, one thing you have to be very careful<br>

about is not creating references via your instrumentation. It&#39;s disturbingly<br>
easy to do. :-)<br>
</blockquote><div><br>Yes, it is very tough to do right. <br></div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
__builtins__.__IPYTHON__ and __builtins__.__IPYTHON__active are two culprits,<br>
and the remaining one is a cell object. I&#39;m not sure where he is coming from.<br>
</blockquote><div><br>In my version, I have gotten rid of __IPYTHON__ and IPYTHON_active is an int.<br><br>What is a cell object?  Could I see the foo.py script?<br><br>These are the game I have been playing, but it would be helpful to see what you are doing here. <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
[~]$ python foo.py<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;<br>
40 references:<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.generate_output_prompt of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.shell_hook of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.show_in_pager of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.pre_prompt_hook of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.pre_runcode_hook of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.clipboard_get of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;app_name&#39;, &#39;IP&#39;, &#39;crash_report_fname&#39;,<br>
&#39;user_message_template&#39;, &#39;show_crash_traceback&#39;, &#39;contact_email&#39;, &#39;bug_tracker&#39;,<br>
&#39;contact_name&#39;]<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.dummy_handler of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.ipmagic of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;magic&#39;, &#39;IP&#39;, &#39;user_ns&#39;, &#39;user_global_ns&#39;, &#39;system&#39;, &#39;dbg&#39;,<br>
&#39;meta&#39;, &#39;extensions&#39;, &#39;set_crash_handler&#39;, &#39;set_custom_exc&#39;, &#39;set_hook&#39;]<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.set_hook of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.set_custom_exc of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.set_crash_handler of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.set_hook of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.ipmagic of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.ipalias of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.ipsystem of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;list&#39;&gt;<br>
A list of 19524 elements; probably gc.get_objects().<br>
<br>
&lt;type &#39;cell&#39;&gt;<br>
A cell: &lt;cell at 0x3aab90: InteractiveShell object at 0x3aad90&gt;<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;dir_stack&#39;, &#39;ESC_HELP&#39;, &#39;pycolorize&#39;, &#39;SyntaxTB&#39;,<br>
&#39;indent_current_nsp&#39;, &#39;hooks&#39;, &#39;user_ns&#39;, &#39;user_global_ns&#39;, &#39;system&#39;,<br>
&#39;_main_ns_cache&#39;, &#39;dir_hist&#39;, &#39;autoindent&#39;, &#39;tempfiles&#39;, &#39;BANNER&#39;,<br>
&#39;code_to_run&#39;, &#39;loghead_tpl&#39;, &#39;ESC_PAREN&#39;, &#39;stdin_encoding&#39;, &#39;usage_min&#39;,<br>
&#39;has_readline&#39;, &#39;ns_table&#39;, &#39;getoutput&#39;, &#39;no_alias&#39;, &#39;home_dir&#39;, &#39;filename&#39;,<br>
&#39;ESC_SH_CAP&#39;, &#39;ns_refs_table&#39;, &#39;rc&#39;, &#39;usage&#39;, &#39;starting_dir&#39;, &#39;logger&#39;,<br>
&#39;banner2&#39;, &#39;options_table&#39;, &#39;more&#39;, &#39;shell&#39;, &#39;jobs&#39;, &#39;auto_alias&#39;, &#39;api&#39;,<br>
&#39;buffer&#39;, &#39;ESC_SHELL&#39;, &#39;alias_table&#39;, &#39;InteractiveTB&#39;, &#39;exit_now&#39;,<br>
&#39;builtins_added&#39;, &#39;output_hist&#39;, &#39;internal_ns&#39;, &#39;user_config_ns&#39;, &#39;ESC_QUOTE2&#39;,<br>
&#39;custom_exceptions&#39;, &#39;pager&#39;, &#39;sys_excepthook&#39;, &#39;getoutputerror&#39;,<br>
&#39;esc_handlers&#39;, &#39;input_hist_raw&#39;, &#39;name&#39;, &#39;embedded&#39;, &#39;CACHELENGTH&#39;,<br>
&#39;strdispatchers&#39;, &#39;CustomTB&#39;, &#39;_magic_state&#39;, &#39;compile&#39;, &#39;input_hist&#39;, &#39;meta&#39;,<br>
&#39;_user_main_module&#39;, &#39;ESC_MAGIC&#39;, &#39;ESC_QUOTE&#39;]<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;shell&#39;, &#39;name&#39;]<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;shell&#39;, &#39;name&#39;]<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;_dh&#39;, &#39;_sh&#39;, &#39;__builtins__&#39;, &#39;In&#39;, &#39;_ip&#39;, &#39;_ih&#39;, &#39;__name__&#39;,<br>
&#39;foo&#39;, &#39;_oh&#39;, &#39;Out&#39;]<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_auto of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_auto of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_auto of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_magic of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_help of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_shell_escape of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.handle_shell_escape of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.generate_prompt of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;log_active&#39;, &#39;shell&#39;, &#39;_i&#39;, &#39;log_raw_input&#39;, &#39;_i00&#39;, &#39;_iii&#39;,<br>
&#39;loghead&#39;, &#39;log_output&#39;, &#39;logfname&#39;, &#39;_ii&#39;, &#39;timestamp&#39;, &#39;_logmode&#39;, &#39;logfile&#39;]<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.shutdown_hook of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.result_display of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.synchronize_with_editor of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.editor of &lt;IPython.core.iplib.InteractiveShell<br>
object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.fix_error_editor of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.input_prefilter of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;instancemethod&#39;&gt;<br>
&lt;bound method InteractiveShell.late_startup_hook of<br>
&lt;IPython.core.iplib.InteractiveShell object at 0x3aad90&gt;&gt;<br>
<br>
&lt;type &#39;dict&#39;&gt;<br>
A dict with keys: [&#39;obj&#39;, &#39;InteractiveShell&#39;, &#39;__builtins__&#39;, &#39;__file__&#39;, &#39;gc&#39;,<br>
&#39;refs&#39;, &#39;__name__&#39;, &#39;ref&#39;, &#39;__doc__&#39;, &#39;types&#39;]<br>
<font color="#888888"><br>
<br>
--<br>
</font><div><div></div><div class="h5">Robert Kern<br>
<br>
&quot;I have come to believe that the whole world is an enigma, a harmless enigma<br>
  that is made terrible by our own mad attempt to interpret it as though it had<br>
  an underlying truth.&quot;<br>
   -- Umberto Eco<br>
<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></div></blockquote></div><br>