Re: C API: getting sys.argv

2006-05-16 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > John Machin wrote: >> > PyObject *_argv = PyImport_ImportModule("sys.argv"); >> >> What does the name of the function tell you? You can't do that in one >> hit. Start with >> PyObject *_sys = PyImport_ImportModule("sys"); >> then you need to get the module's argv attribut

Re: C API: getting sys.argv

2006-05-15 Thread [EMAIL PROTECTED]
John Machin wrote: > > PyObject *_argv = PyImport_ImportModule("sys.argv"); > > What does the name of the function tell you? You can't do that in one > hit. Start with > PyObject *_sys = PyImport_ImportModule("sys"); > then you need to get the module's argv attribute. I just figured this out, doh

Re: C API: getting sys.argv

2006-05-15 Thread John Machin
> PyObject *_argv = PyImport_ImportModule("sys.argv"); What does the name of the function tell you? You can't do that in one hit. Start with PyObject *_sys = PyImport_ImportModule("sys"); then you need to get the module's argv attribute. However a better design might be have your extension module

C API: getting sys.argv

2006-05-15 Thread [EMAIL PROTECTED]
Hi, How would one go about getting sys.argv fom within the context of a C API extention module? I want to pass it along to C library that I'm calling from my module code. TIA~ I'm trying to load the sys module using: PyObject *_argv = PyImport_ImportModule("sys.argv"); but it is coming back N