[Ipython-tickets] [IPython] #139: Different behaviour: python vs. ipython when using a C module

IPython ipython-tickets@scipy....
Mon Apr 7 23:55:26 CDT 2008


#139: Different behaviour: python vs. ipython when using a C module
---------------------+------------------------------------------------------
 Reporter:  fperez   |        Owner:  fperez
     Type:  defect   |       Status:  new   
 Priority:  normal   |    Milestone:  0.9.0 
Component:  ipython  |      Version:        
 Severity:  normal   |   Resolution:        
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by yichun):

 In the pasted code the assert simply fails when load module in IPython but
 not in Python. If the assert were removed, I got the error response as in
 the 2nd box.

 Replying to [comment:1 yichun]:
 > I may be having a much simpler problem, simply trying to import sys in
 the C module and having problem with IPython:
 > {{{
 > #!c
 > void module_start() {
 >         sprintf(buf, "sys.path.append('%s/lib/python')",
 get_module_home());
 >         assert(PyRun_SimpleString("import sys") == 0);
 > }
 > }}}
 > Which runs fine in python but not in IPython with the following error:
 > {{{
 >
 ---------------------------------------------------------------------------
 > exceptions.NameError                                 Traceback (most
 recent call last)
 >
 > /path/path/to/current/directory/<string>
 >
 > NameError: name 'sys' is not defined
 > }}}
 >
 > Any insights?
 >
 >
 >

-- 
Ticket URL: <http://ipython.scipy.org/ipython/ipython/ticket/139#comment:2>
IPython <http://ipython.scipy.org>
The IPython interactive Python system


More information about the Ipython-tickets mailing list