Burton Samograd <[EMAIL PROTECTED]> writes:
> I'm trying to update the fuse python bindings to my app and I was
> curious if there were any C utility functions that would turn a
> sys.argv into a C style argv array, or am I going to have to write
> those myself?

Following up to myself again...found the solution:

----------------------------------------------------------------------
PyObject *argv; /* value from PyArg_ParseTupleAndKeywords elsewhere */
int _argc = PySequence_Length(argv);
char **_argv = malloc(_argc*sizeof(char**));
int i;
for(i=0;i<_argc;i++)
    _argv[i] = PyString_AsString(PyList_GetItem(argv, i));
----------------------------------------------------------------------

Could probabaly use some error checking but it works...

-- 
burton samograd                                 kruhft .at. gmail
kruhft.blogspot.com     www.myspace.com/kruhft  metashell.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to