Ok, here's some real progress. Please see the attached files for the following.
Please set your python version in the makefile, then run:
[embed]> make
... ignore warnings
[embed]> ./embed argv.py
sys.argv is:
Traceback (most recent call last):
File "argv.py", line 3, in ?
print sys.argv
AttributeError: 'module' object has no attribute 'argv'
Here's the problem. When embedded, python does NOT set sys.argv AT ALL! So
ipython crashes badly. However, run now:
[embed]> ./embed embed.py
In [1]: # We're in ipython. Yipee!
All I did was:
[embed]> cat embed.py
import sys
sys.argv = ['']
from IPython.Shell import IPythonShellEmbed
ipshell = IPythonShellEmbed()
ipshell()
manually set sys.argv myself. Simple, heh ? ;)
Anyway, if you test this a bit more and conclude that it all works ok in a
'real world' scenario, I'd like to hear about it. In that case, I can include
this example in the docs for the future.
Now I need to get back to G. Bishop...
Best,
f.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile
Url: http://projects.scipy.org/pipermail/ipython-user/attachments/20030603/958e12e3/attachment.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: embed.c
Url: http://projects.scipy.org/pipermail/ipython-user/attachments/20030603/958e12e3/attachment.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: argv.py
Type: text/x-python
Size: 47 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/ipython-user/attachments/20030603/958e12e3/attachment.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: embed.py
Type: text/x-python
Size: 112 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/ipython-user/attachments/20030603/958e12e3/attachment-0001.py