Re: Convert PyIDispatch object to struct IDispatch*

2008-04-11 Thread Huayang Xia
On Apr 11, 9:47 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Huayang Xia wrote: > > On Apr 11, 12:15 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> > >> escr

Re: Convert PyIDispatch object to struct IDispatch*

2008-04-11 Thread Huayang Xia
On Apr 11, 12:15 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> > escribió: > > > I am trying to use ctypes to call dll functions. One of the functions > > requires argument &q

Convert PyIDispatch object to struct IDispatch*

2008-04-10 Thread Huayang Xia
I am trying to use ctypes to call dll functions. One of the functions requires argument "struct IDispatch* ". I do have a PyIDispatch object in python. How can I convert this "PyIDispatch object" to "struct IDispatch* "? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to use .NET DLL from Python

2008-02-07 Thread Huayang Xia
n 6 feb, 21:17, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > On Feb 6, 9:59 pm, "Luis M. Gonz�lez" <[EMAIL PROTECTED]> wrote: > > > > > > > On Feb 6, 6:27 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > > > > > > > >

Re: Is there a way to use .NET DLL from Python

2008-02-07 Thread Huayang Xia
What's the difference between .NET DLL and normal C DLL? Do you mean after clr.AddReference('ClassLibrary1'), there is no need to import ClassLibrary1? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Huayang Xia
Or maybe we can do it in IronPython? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Huayang Xia
On Feb 6, 4:59 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > On Feb 6, 6:27 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > > > Hello All, > > > I have several .NET DLL (I have no source code for them), is there > > anyway to use them from pyt

Is there a way to use .NET DLL from Python

2008-02-06 Thread Huayang Xia
Hello All, I have several .NET DLL (I have no source code for them), is there anyway to use them from python instead of from C#. Thanks, Huayang -- http://mail.python.org/mailman/listinfo/python-list

PyPerforce: How to open file for editing

2008-01-24 Thread Huayang Xia
I'm completely new to pyperforce. I want to open a file (check out a file) for editing. How can I do it from PyPerforce? Another thing is how can I add files to my created label? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Memory Management in Embedded Python

2007-01-18 Thread Huayang Xia
Hi there, I have a piece of code like this: void funct(PyObject* pyobj) { char str[128]; strncpy(str, "just a test string", sizeof(str)); PyObject* pydata = PyObject_CallMethod(pyobj, "method_x", "s", str); Py_DECREF(pydata); } After the fu

Re: How to modify object attribute by python C API

2007-01-12 Thread Huayang Xia
re is no exception thrown (in C++) so that we can integrate the error handling. What is the best way(less code) to handle the error checking in normal practice? On Jan 11, 4:37 pm, "Huayang Xia" <[EMAIL PROTECTED]> wrote: > I get a python object by running a class' constructor

How to modify object attribute by python C API

2007-01-11 Thread Huayang Xia
I get a python object by running a class' constructor. Then I need to modify the instance's attribute just like obj.attr1.attr2 = 'a' if in python's term. PyObject* py_obj_attr1 = PyObject_GetAttrString(obj, "attr1"); PyObject_SetAttrString(py_obj_attr1, "attr2", PyString_FromString("a"));

Re: where to find the spec of format in PyObject_CallMethod

2007-01-10 Thread Huayang Xia
Thanks. I have mixed arguments. I found the format spec @ http://docs.python.org/api/arg-parsing.html On Jan 10, 5:31 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Wed, 2007-01-10 at 14:05 -0800, Huayang Xia wrote: > > I am trying to use PyObject_CallMethod. It needs a f

where to find the spec of format in PyObject_CallMethod

2007-01-10 Thread Huayang Xia
I am trying to use PyObject_CallMethod. It needs a format string to specify what are the followed arguments. Is it possible to use a PyObject* as an argument? Where can I find the spec for the format? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: subclassing a module: misleading(?) error message

2007-01-04 Thread Huayang Xia
So you know you are subclassing a module. There is an answer @ http://www.velocityreviews.com/forums/showpost.php?p=1819038&postcount=2 On Jan 4, 3:49 pm, "Erik Johnson" wrote: > I ran into a problem I didn't understand at first. I got part of it figured > out. Let me first demonstrate the origi

Re: what is this?

2007-01-04 Thread Huayang Xia
Sequence slicing [starting-at-index : but-less-than-index [ : step]]. Start defaults to 0, end to len(sequence), step to 1. So l[i::rows] means: slicing start from i, ending with len(l) and step with rows. So function colsplit(l, cols) returns a list of sequence with conversion of: Assume cols =

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
te. That was the reason I skipped it. On Dec 19, 4:14 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Huayang Xia a écrit : > > > I'm confused. What is the definition of closure. > > > I'm not sure if it's correct, I get the definition from wikipedia: &

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
I'm confused. What is the definition of closure. I'm not sure if it's correct, I get the definition from wikipedia: "A closure typically comes about when one function is declared entirely within the body of another, and the inner function refers to local variables of the outer function. At runtim

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
That is a really concise and precise answer. Thanks. So the object binding can only happen explicitly at the closure declaration argument list(non-free variable). On Dec 19, 10:37 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Huayang Xia wrote: > > When does the closure get t

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
Thanks for the clarification. But my question is: When does the closure get the value of the maxIndex in the following code snippet? def testClosure(maxIndex) : def closureTest(): return maxIndex maxIndex += 5 return closureTest

Re: When Closure get external variable's value?

2006-12-18 Thread Huayang Xia
It will print 15. The closure gets the value at run time. Could we treat closure as part of the external function and it shares the local variable with its holder function? -- http://mail.python.org/mailman/listinfo/python-list

When Closure get external variable's value?

2006-12-18 Thread Huayang Xia
What will the following piece of code print? (10 or 15) def testClosure(maxIndex) : def closureTest(): return maxIndex maxIndex += 5 return closureTest() print testClosure(10) My question is when the closure function gets val

Security Descriptor and CoInitializeSecurity

2006-12-01 Thread Huayang Xia
I'd like to call pythoncom.CoInitializeSecurity with a PySecurityDescriptor object to set the process-wide security values. But I'm not able to find a way to let the code go through. I have read MSDN and searched web, I've not been able to find answer. I cooked a security descriptor like this (ass