[IPython-dev] Problem when sys.argv does not exist

Adam Hupp hupp at cs.wisc.edu
Sat Oct 4 19:19:30 EDT 2003


I'm running into a problem embedding when sys.argv is not defined.
I'm running ipython from a C extension that does not set sys.argv.
The root of the problem is that DPyGetOpt unconditionally checks the
passed arguments against sys.argv.  With no sys.argv this raises an
exception and aborts the whole program.  Checked against 0.5.0.  The
following change to DPyGetOpt.py should fix it:

<               if args == sys.argv:
<                       args = sys.argv[1:]
---
>               if hasattr(sys, "argv"):
>                       if args == sys.argv:
>                               args = sys.argv[1:]

-Adam


More information about the IPython-dev mailing list