Re: [python-win32] How to enable events for Python Active Scripting?

2023-03-13 Thread Wuping Xin via python-win32
Hi Mark,

- "you would define a function called "ObjectName_EventName"

Thank you again! This is valuable info.  In the following pseudo-code,  the 
Host COM Object implements TWO Events interfaces.  How should I defined 
relevant event sink functions?  For example, if the object instance is named 
"MyHostObject",  should I just directly define the following event sink 
functions?

MyHostObject.Do_A_Event()
MyHostObject.Do_B_Event()
MyHostObject.Do_C_Event()
MyHostObject.Do_D_Event()


interface _IMondayEvents
{
Do_A_Event;
Do_B_event;
}

interface _ITuesdayEvents
{
Do_C_Event;
Do_D_event;
}

coclass HostApplication
{
[default] interface IHostApplication;
[source] interface _IMondayEvents;
[source] interface _ITuesdayEvents;
};


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/13/2023 8:45:37 PM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


[adding the list back in]

I'm still not quite sure what you are trying to do. If you are trying to use 
Active Scripting, then things should "just work" in the same way they work for 
other Active Scripting languages. The IE demos show us handling events from IE. 
This all ties together with interfaces described in typelibs and using 
IConnectionPoint etc. In this world you don't implement Python classes which 
derive from EventSink or ScriptItem, you would define a function called 
"ObjectName_EventName"  - eg the "Image_OnClick()" you will find in 
mousetrack.htm.

If you are just trying to use the IConnectionPoint etc without the Active 
Scripting framework, then your best bet is to check out 
win32com\demos\connect.py, and specifically how it uses 
"win32com.client.connect.SimpleConnection()" with the CLSID of an object 
implementing the interface which fires the events.

I'm afraid it has been many years since I've worked on anything related to COM 
or events, so I really don't have great insights into the finer details. I've 
also no additional demos - everything relevant I have is in the repo.

Cheers,

Mark

On 14/03/2023 10:41 am, Wuping Xin wrote:

Hi Mark,

Thank you again for your suggestion.

Here is my use case:
1.  C++ Host Application, which exposes a COM object model (with COM
events).
2.  Users are expected to write Python script to interact with the COM
object model.

Following your advice, I read the following source files
- win32comext\axscript\client\framework.py
- win32comext\axscript\test\testHost.py

But I am still somewhat unsure how to create event sinks at the Python
script side.
- Should I add a user-define Python class that inherits from EventSink
or ScriptItem?

Do you think you might be able to provide more hints or it would be
great if there is an example to illustrate this?

Much appreciated!

Wuping Xin, PE, PhD
Chief Technology Officer | Caliper Corporation
|
1172 Beacon St, Ste 300 • Newton MA 02461 USA
Mobile: 617-564-1676 • Main: 617-527-4700

-- Original Message --
From "Mark Hammond"

To "Wuping Xin" ; 
python-win32@python.org
Date 3/12/2023 10:54:23 PM
Subject Re: [python-win32] How to enable events for Python Active
Scripting?



It's difficult to know what exactly you mean, but if it is how to use 
IConnectionPoint etc from Python in general, then you should check out the 
following files in the distribution:

com\win32com\demos\connect.py
com\win32com\server\connect.py
com\win32com\client\connect.py

If it is about the use of these interfaces specifically with ActiveScripting, 
then you should find win32comext\axscript\test\testHost.py useful. 
win32comext\axscript\client\framework.py is where the implementation of Active 
Scripting's event handling is implemented - eg, see the functions Connect, 
CreateConnections, ConnectEventHandlers etc in that file.

HTH,

Mark

On 13/03/2023 1:05 am, Wuping Xin wrote:


I have a host application that uses Python Active Scripting.   That host 
application implements IConnectionPoint / IConnectionPointContainers etc, and I 
am able to set COM event callbacks in C++.

But I am having a hard time to figure out how to set COM event callback with 
Python Active Scripting - I bought the book "/Python Programming On Win32, but 
/it doesn't provide much information about//Python Active Scripting COM events.

Need help and much appreciate any advice.

Wu

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Re: [python-win32] How to enable events for Python Active Scripting?

2023-03-13 Thread Wuping Xin via python-win32
Thank you again Mark.

In framework.py, Line 223 - Line 235, I see that it only searches for [source, 
default] interface on the coclass.  That means,  multiple event interface is 
NOT supported for now.

I think I'll have to use "win32com.client.connect.SimpleConnection()" to 
manually create the Source/EventSink connection.

Wuping


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/13/2023 10:55:03 PM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


IIRC, each of these objects is a "named item" - so whatever name you use when 
you call AddNamedItem() is the prefix and the suffix is the name of the 
function on the event interface. I'm really not sure how multiple event 
interfaces are supported, if at all.

Cheers,

Mark



On 14/03/2023 1:12 pm, Wuping Xin wrote:
Hi Mark,

- "you would define a function called "ObjectName_EventName"

Thank you again! This is valuable info.  In the following pseudo-code,  the 
Host COM Object implements TWO Events interfaces.  How should I defined 
relevant event sink functions?  For example, if the object instance is named 
"MyHostObject",  should I just directly define the following event sink 
functions?

MyHostObject.Do_A_Event()
MyHostObject.Do_B_Event()
MyHostObject.Do_C_Event()
MyHostObject.Do_D_Event()


interface _IMondayEvents
{
Do_A_Event;
Do_B_event;
}

interface _ITuesdayEvents
{
Do_C_Event;
Do_D_event;
}

coclass HostApplication
{
[default] interface IHostApplication;
[source] interface _IMondayEvents;
[source] interface _ITuesdayEvents;
};


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/13/2023 8:45:37 PM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


[adding the list back in]

I'm still not quite sure what you are trying to do. If you are trying to use 
Active Scripting, then things should "just work" in the same way they work for 
other Active Scripting languages. The IE demos show us handling events from IE. 
This all ties together with interfaces described in typelibs and using 
IConnectionPoint etc. In this world you don't implement Python classes which 
derive from EventSink or ScriptItem, you would define a function called 
"ObjectName_EventName"  - eg the "Image_OnClick()" you will find in 
mousetrack.htm.

If you are just trying to use the IConnectionPoint etc without the Active 
Scripting framework, then your best bet is to check out 
win32com\demos\connect.py, and specifically how it uses 
"win32com.client.connect.SimpleConnection()" with the CLSID of an object 
implementing the interface which fires the events.

I'm afraid it has been many years since I've worked on anything related to COM 
or events, so I really don't have great insights into the finer details. I've 
also no additional demos - everything relevant I have is in the repo.

Cheers,

Mark

On 14/03/2023 10:41 am, Wuping Xin wrote:

Hi Mark,

Thank you again for your suggestion.

Here is my use case:
1.  C++ Host Application, which exposes a COM object model (with COM
events).
2.  Users are expected to write Python script to interact with the COM
object model.

Following your advice, I read the following source files
- win32comext\axscript\client\framework.py
- win32comext\axscript\test\testHost.py

But I am still somewhat unsure how to create event sinks at the Python
script side.
- Should I add a user-define Python class that inherits from EventSink
or ScriptItem?

Do you think you might be able to provide more hints or it would be
great if there is an example to illustrate this?

Much appreciated!

Wuping Xin, PE, PhD
Chief Technology Officer | Caliper Corporation
|
1172 Beacon St, Ste 300 • Newton MA 02461 USA
Mobile: 617-564-1676 • Main: 617-527-4700

-- Original Message --
From "Mark Hammond"

To "Wuping Xin" ; 
python-win32@python.org
Date 3/12/2023 10:54:23 PM
Subject Re: [python-win32] How to enable events for Python Active
Scripting?



It's difficult to know what exactly you mean, but if it is how to use 
IConnectionPoint etc from Python in general, then you should check out the 
following files in the distribution:

com\win32com\demos\connect.py
com\win32com\server\connect.py
com\win32com\client\connect.py

If it is about the use of these interfaces specifically with ActiveScripting, 
then you should find win32comext\axscript\test\testHost.py useful. 
win32comext\axscript\client\fra

Re: [python-win32] How to enable events for Python Active Scripting?

2023-03-17 Thread Wuping Xin via python-win32
I am still struggling with PyActiveScripting COM events.

Is there a way to "step into" the framework code while running the C++ host?  I 
found PyDump - how can I make use of it?

Thank you
Wuping


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/14/2023 12:47:27 AM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


Feel free to put a PR up!

Cheers,

Mark

On 14/03/2023 3:10 pm, Wuping Xin wrote:
Thank you again Mark.

In framework.py, Line 223 - Line 235, I see that it only searches for [source, 
default] interface on the coclass.  That means,  multiple event interface is 
NOT supported for now.

I think I'll have to use "win32com.client.connect.SimpleConnection()" to 
manually create the Source/EventSink connection.

Wuping


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/13/2023 10:55:03 PM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


IIRC, each of these objects is a "named item" - so whatever name you use when 
you call AddNamedItem() is the prefix and the suffix is the name of the 
function on the event interface. I'm really not sure how multiple event 
interfaces are supported, if at all.

Cheers,

Mark



On 14/03/2023 1:12 pm, Wuping Xin wrote:
Hi Mark,

- "you would define a function called "ObjectName_EventName"

Thank you again! This is valuable info.  In the following pseudo-code,  the 
Host COM Object implements TWO Events interfaces.  How should I defined 
relevant event sink functions?  For example, if the object instance is named 
"MyHostObject",  should I just directly define the following event sink 
functions?

MyHostObject.Do_A_Event()
MyHostObject.Do_B_Event()
MyHostObject.Do_C_Event()
MyHostObject.Do_D_Event()


interface _IMondayEvents
{
Do_A_Event;
Do_B_event;
}

interface _ITuesdayEvents
{
Do_C_Event;
Do_D_event;
}

coclass HostApplication
{
[default] interface IHostApplication;
[source] interface _IMondayEvents;
[source] interface _ITuesdayEvents;
};


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 3/13/2023 8:45:37 PM
Subject Re: [python-win32] How to enable events for Python Active Scripting?

WARNING EXTERNAL EMAIL


[adding the list back in]

I'm still not quite sure what you are trying to do. If you are trying to use 
Active Scripting, then things should "just work" in the same way they work for 
other Active Scripting languages. The IE demos show us handling events from IE. 
This all ties together with interfaces described in typelibs and using 
IConnectionPoint etc. In this world you don't implement Python classes which 
derive from EventSink or ScriptItem, you would define a function called 
"ObjectName_EventName"  - eg the "Image_OnClick()" you will find in 
mousetrack.htm.

If you are just trying to use the IConnectionPoint etc without the Active 
Scripting framework, then your best bet is to check out 
win32com\demos\connect.py, and specifically how it uses 
"win32com.client.connect.SimpleConnection()" with the CLSID of an object 
implementing the interface which fires the events.

I'm afraid it has been many years since I've worked on anything related to COM 
or events, so I really don't have great insights into the finer details. I've 
also no additional demos - everything relevant I have is in the repo.

Cheers,

Mark

On 14/03/2023 10:41 am, Wuping Xin wrote:

Hi Mark,

Thank you again for your suggestion.

Here is my use case:
1.  C++ Host Application, which exposes a COM object model (with COM
events).
2.  Users are expected to write Python script to interact with the COM
object model.

Following your advice, I read the following source files
- win32comext\axscript\client\framework.py
- win32comext\axscript\test\testHost.py

But I am still somewhat unsure how to create event sinks at the Python
script side.
- Should I add a user-define Python class that inherits from EventSink
or ScriptItem?

Do you think you might be able to provide more hints or it would be
great if there is an example to illustrate this?

Much appreciated!

Wuping Xin, PE, PhD
Chief Technology Officer | Caliper Corporation
|
1172 Beacon St, Ste 300 • Newton MA 02461 USA
Mobile: 617-564-1676 • Main: 617-527-4700

-- Original Message --
From "Mark Hammond"

To "Wuping Xin" 

[python-win32] win32com, server/policy.py bug? policy.py Line 639

2023-04-16 Thread Wuping Xin via python-win32
For the following code, the method "GetPerson" has no explicit argument (except 
self).

class MyCOMObject:
_public_methods_ = ["GetPerson"]
#_reg_clsid_ = '{44ee76c7-1290-4ea6-8189-00d5d7cd712a}'
#_reg_desc_ = "My COM server"
#_reg_progid_ = "MyCOMObject"

def get_person(self):
person = Person("haha", 45)
wrapped = win32com.server.util.wrap(person, useDispatcher = 
my_dispatcher)
return wrapped


When calling from VBA, like below , it works fine.
Set o = CreateObject("MyCOMObject")
Set p = o.get_person()

However, when calling from C++, or Delphi, the following error will be thrown:
"TypeError: MyCOMObject.get_person() takes 1 positional argument but 2 were 
given"

Delphi code:

procedure TForm1.Button1Click(Sender: TObject);
var
  o: OleVariant;
  p: OleVariant;
begin
  o := CreateOleObject('MyCOMObject');
  p := o.get_person(); // error will be thrown
  s := p.name;
  age := p.age;
  ShowMessage(s);
end;

The fix is to change Line 639 of policy.py to the following:


 if len(args) == 1 and (args[0] == -2147352572 or args[0] == 
None):
 return func()
 else:
 return func(*args)
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] win32com, server/policy.py bug? policy.py Line 639

2023-04-16 Thread Wuping Xin via python-win32
A better fix is to change Line 639 of win32com/server/policy.py to the 
following:

import inspect
if len(inspect.getfullargspec(func).args) == 1:
return func()
else:
return func(*args)

Then we can make VBA, Delphi, C++  all clients happy.

Agree? Should I submit a pull request?

Wuping

-- Original Message --
From "Wuping Xin" mailto:wup...@caliper.com>>
To "Mark Hammond" mailto:mhamm...@skippinet.com.au>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/16/2023 9:28:48 AM
Subject win32com, server/policy.py bug? policy.py Line 639

For the following code, the method "GetPerson" has no explicit argument (except 
self).

class MyCOMObject:
_public_methods_ = ["GetPerson"]
#_reg_clsid_ = '{44ee76c7-1290-4ea6-8189-00d5d7cd712a}'
#_reg_desc_ = "My COM server"
#_reg_progid_ = "MyCOMObject"

def get_person(self):
person = Person("haha", 45)
wrapped = win32com.server.util.wrap(person, useDispatcher = 
my_dispatcher)
return wrapped


When calling from VBA, like below , it works fine.
Set o = CreateObject("MyCOMObject")
Set p = o.get_person()

However, when calling from C++, or Delphi, the following error will be thrown:
"TypeError: MyCOMObject.get_person() takes 1 positional argument but 2 were 
given"

Delphi code:

procedure TForm1.Button1Click(Sender: TObject);
var
  o: OleVariant;
  p: OleVariant;
begin
  o := CreateOleObject('MyCOMObject');
  p := o.get_person(); // error will be thrown
  s := p.name;
  age := p.age;
  ShowMessage(s);
end;

The fix is to change Line 639 of policy.py to the following:


 if len(args) == 1 and (args[0] == -2147352572 or args[0] == 
None):
 return func()
 else:
 return func(*args)
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] win32com, server/policy.py bug? policy.py Line 639

2023-04-17 Thread Wuping Xin via python-win32
Thanks. I'll submit a PR.

When calling from a Delphi COM client (using OleVariant ),  arg[0] will be set 
by Delphi a value of 0x8002000C, when the target Python method has NO argument 
(i.e., taking only "self"). This makes args non-empty.

When calling from a C++ MFC/COM client, arg[0] will be set a value of "None", 
when the target Python method has NO argument (i.e., talking only "self"). This 
makes args non-empty.

The following code would be a "protection" for parameterless Python method.

import inspect
if len(inspect.getfullargspec(func).args) == 1:
return func()
else:
return func(*args)

Wuping


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/17/2023 8:14:31 AM
Subject Re: win32com, server/policy.py bug? policy.py Line 639

WARNING EXTERNAL EMAIL




On 16/4/2023 11:48 pm, Wuping Xin wrote:
A better fix is to change Line 639 of win32com/server/policy.py to the 
following:

import inspect
if len(inspect.getfullargspec(func).args) == 1:
return func()
else:
return func(*args)

Then we can make VBA, Delphi, C++  all clients happy.

Agree? Should I submit a pull request?

I'm not sure ATM - I'd be quite surprised if there was a bug in COM functions 
with no args, so it may be more subtle than that. But you should certainly get 
either a PR or issue on github for this, ideally with a complete repro. It 
might be quite some time (ie, many weeks) before I can look at this in more 
detail.

Thanks,

Mark


Wuping

-- Original Message --
From "Wuping Xin" mailto:wup...@caliper.com>>
To "Mark Hammond" mailto:mhamm...@skippinet.com.au>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/16/2023 9:28:48 AM
Subject win32com, server/policy.py bug? policy.py Line 639

For the following code, the method "GetPerson" has no explicit argument (except 
self).
class MyCOMObject:
_public_methods_ = ["GetPerson"]
#_reg_clsid_ = '{44ee76c7-1290-4ea6-8189-00d5d7cd712a}'
#_reg_desc_ = "My COM server"
#_reg_progid_ = "MyCOMObject"
def get_person(self):
person = Person("haha", 45)
wrapped = win32com.server.util.wrap(person, useDispatcher = 
my_dispatcher)
return wrapped
When calling from VBA, like below , it works fine.
Set o = CreateObject("MyCOMObject")
Set p = o.get_person()
However, when calling from C++, or Delphi, the following error will be thrown:
"TypeError: MyCOMObject.get_person() takes 1 positional argument but 2 were 
given"
Delphi code:
procedure TForm1.Button1Click(Sender: TObject);
var
  o: OleVariant;
  p: OleVariant;
begin
  o := CreateOleObject('MyCOMObject');
  p := o.get_person(); // error will be thrown
  s := p.name;
  age := p.age;
  ShowMessage(s);
end;
The fix is to change Line 639 of policy.py to the following:

 if len(args) == 1 and (args[0] == -2147352572 or args[0] == 
None):
 return func()
 else:
 return func(*args)
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] win32com, server/policy.py bug? policy.py Line 639

2023-04-17 Thread Wuping Xin via python-win32
I created a new issue (with sample Delphi project to replicate the issue, 
including the Python source file where the COM server is defined):
https://github.com/mhammond/pywin32/issues/2043

And I submit a PR:
https://github.com/mhammond/pywin32/pull/2044

Thank you.

Wuping

-- Original Message --
From "Wuping Xin" mailto:wup...@caliper.com>>
To "Mark Hammond" mailto:mhamm...@skippinet.com.au>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/17/2023 8:42:14 AM
Subject Re[2]: win32com, server/policy.py bug? policy.py Line 639

Thanks. I'll submit a PR.

When calling from a Delphi COM client (using OleVariant ),  arg[0] will be set 
by Delphi a value of 0x8002000C, when the target Python method has NO argument 
(i.e., taking only "self"). This makes args non-empty.

When calling from a C++ MFC/COM client, arg[0] will be set a value of "None", 
when the target Python method has NO argument (i.e., talking only "self"). This 
makes args non-empty.

The following code would be a "protection" for parameterless Python method.

import inspect
if len(inspect.getfullargspec(func).args) == 1:
return func()
else:
return func(*args)

Wuping


-- Original Message --
From "Mark Hammond" 
mailto:mhamm...@skippinet.com.au>>
To "Wuping Xin" mailto:wup...@caliper.com>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/17/2023 8:14:31 AM
Subject Re: win32com, server/policy.py bug? policy.py Line 639

WARNING EXTERNAL EMAIL




On 16/4/2023 11:48 pm, Wuping Xin wrote:
A better fix is to change Line 639 of win32com/server/policy.py to the 
following:

import inspect
if len(inspect.getfullargspec(func).args) == 1:
return func()
else:
return func(*args)

Then we can make VBA, Delphi, C++  all clients happy.

Agree? Should I submit a pull request?

I'm not sure ATM - I'd be quite surprised if there was a bug in COM functions 
with no args, so it may be more subtle than that. But you should certainly get 
either a PR or issue on github for this, ideally with a complete repro. It 
might be quite some time (ie, many weeks) before I can look at this in more 
detail.

Thanks,

Mark


Wuping

-- Original Message --
From "Wuping Xin" mailto:wup...@caliper.com>>
To "Mark Hammond" mailto:mhamm...@skippinet.com.au>>
Cc "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 4/16/2023 9:28:48 AM
Subject win32com, server/policy.py bug? policy.py Line 639

For the following code, the method "GetPerson" has no explicit argument (except 
self).
class MyCOMObject:
_public_methods_ = ["GetPerson"]
#_reg_clsid_ = '{44ee76c7-1290-4ea6-8189-00d5d7cd712a}'
#_reg_desc_ = "My COM server"
#_reg_progid_ = "MyCOMObject"
def get_person(self):
person = Person("haha", 45)
wrapped = win32com.server.util.wrap(person, useDispatcher = 
my_dispatcher)
return wrapped
When calling from VBA, like below , it works fine.
Set o = CreateObject("MyCOMObject")
Set p = o.get_person()
However, when calling from C++, or Delphi, the following error will be thrown:
"TypeError: MyCOMObject.get_person() takes 1 positional argument but 2 were 
given"
Delphi code:
procedure TForm1.Button1Click(Sender: TObject);
var
  o: OleVariant;
  p: OleVariant;
begin
  o := CreateOleObject('MyCOMObject');
  p := o.get_person(); // error will be thrown
  s := p.name;
  age := p.age;
  ShowMessage(s);
end;
The fix is to change Line 639 of policy.py to the following:

 if len(args) == 1 and (args[0] == -2147352572 or args[0] == 
None):
 return func()
 else:
 return func(*args)
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Python Active Scripting Error - should I ignore it?

2023-06-29 Thread Wuping Xin via python-win32
When I running a Python Active Script,  DebugView captured the following 
errrors - any advice?

[22076]   File 
"C:\Users\.\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axscript\client\framework.py",
 line 729, in SetScriptSite
[22076] from . import debug
[22076]   File 
"C:\Users\\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axscript\client\debug.py",
 line 9, in 
[22076] from win32com.axdebug import adb, axdebug, contexts, documents, 
gateways, stackframe
[22076]   File 
"C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axdebug\documents.py",
 line 37, in 
[22076] class DebugDocumentText(
[22076] TypeError: Cannot create a consistent method resolution
[22076] order (MRO) for bases DebugDocumentInfo, DebugDocumentText, 
DebugDocument
[22076] *** Debugger Manager could not initialize - : Cannot 
create a consistent method resolution
[22076] order (MRO) for bases DebugDocumentInfo, DebugDocumentText, 
DebugDocument
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python Active Scripting Error - should I ignore it?

2023-06-29 Thread Wuping Xin via python-win32
OK,  I think this is a bug of pywin32,

Line 37 of \win32comext\axdebug\documents.py,

class DebugDocumentText(
gateways.DebugDocumentInfo, gateways.DebugDocumentText, 
gateways.DebugDocument

 gateway.DebugDocumentText already inherits from gateway.DebugDocument.  This 
would cause Python to give a Method Resolution Order (MRO) error, because 
Python cannot determine what class to look methods up on first.

There is no need to list gateway.DebugDocument as the parent class, simply
class DebugDocumentText(
gateways.DebugDocumentInfo, gateways.DebugDocumentText)

Agree?

-- Original Message --
From "Wuping Xin" mailto:wup...@caliper.com>>
To "Python-win32@python.org" 
mailto:Python-win32@python.org>>
Date 6/29/2023 2:15:27 PM
Subject Python Active Scripting Error - should I ignore it?

When I running a Python Active Script,  DebugView captured the following 
errrors - any advice?

[22076]   File 
"C:\Users\.\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axscript\client\framework.py",
 line 729, in SetScriptSite
[22076] from . import debug
[22076]   File 
"C:\Users\\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axscript\client\debug.py",
 line 9, in 
[22076] from win32com.axdebug import adb, axdebug, contexts, documents, 
gateways, stackframe
[22076]   File 
"C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\win32comext\axdebug\documents.py",
 line 37, in 
[22076] class DebugDocumentText(
[22076] TypeError: Cannot create a consistent method resolution
[22076] order (MRO) for bases DebugDocumentInfo, DebugDocumentText, 
DebugDocument
[22076] *** Debugger Manager could not initialize - : Cannot 
create a consistent method resolution
[22076] order (MRO) for bases DebugDocumentInfo, DebugDocumentText, 
DebugDocument
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Python Active Scripting Debug

2025-02-28 Thread Wuping Xin via python-win32

Hi All,

I am trying to debug Python Active Scripting, using Visual Studio.  I am 
100% sure it should work but I just cannot get it work.


I've installed the debug symbols of the Python version, and installed 
Visual Studio Python Native Development tools.


I also set the "Debugging" registry entry for the ActivePy from 0 to 1.

I am able to attach the Python script to the PythonActiveScript host.

But, I just got the following message:

Debugging extensions (axdebug) module does not exist - debugging is 
disabled..



Any insights?

Thank you in advance!

W.X.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Python Active Scripting Debug

2025-03-03 Thread Wuping Xin via python-win32


Thank you Mark for the response.  Appreciate your input.

Best
Wuping

-- Original Message --

From "Mark Hammond" 
To "Wuping Xin" ; "python-win32@python.org" 


Date 3/3/2025 10:24:18 AM
Subject Re: [python-win32] Python Active Scripting Debug

It has been quite a few years since anyone worked on that, but in 
general it should "just work" if everything is registered correctly. 
There are a few demos which should make OK starting points, and 
ensuring everything is registered for debugging, and debugging output 
can be seen (typically via win32traceutil) must be done. Unfortunately, 
I'm not aware of anyone trying to use the VS tools in this way.


Good luck,

Mark

On 2025-02-28 8:54 p.m., Wuping Xin via python-win32 wrote:

Hi All,

I am trying to debug Python Active Scripting, using Visual Studio.  I 
am 100% sure it should work but I just cannot get it work.


I've installed the debug symbols of the Python version, and installed 
Visual Studio Python Native Development tools.


I also set the "Debugging" registry entry for the ActivePy from 0 to 
1.


I am able to attach the Python script to the PythonActiveScript host.

But, I just got the following message:

Debugging extensions (axdebug) module does not exist - debugging is 
disabled..



Any insights?

Thank you in advance!

W.X.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 258, Issue 1

2025-03-01 Thread Wuping Xin via python-win32
The problem is that for Python 3.11+, the frame object has changed, 
hence axdebug is not built for it.


Question:  Would this be fixed any time soon?   This feature is 
definitely needed for Python Active Script debugging.  Also even with 
other Python binding framework such as pybind11,  Active Scripting is 
still valuable because we can expose any existing COM framework to the 
Python Active Script easily,  with much porting efforts.




def _why_cant_build_extension(self, ext):
"""Return None, or a reason it can't be built."""
# axdebug fails to build on 3.11 due to Python "frame" objects 
changing.
# This could be fixed, but is almost certainly not in use any 
more, so

# just skip it.
if ext.name == "axdebug" and sys.version_info >= (3, 11):
return "AXDebug no longer builds on 3.11 and up"

include_dirs = self.compiler.include_dirs + 
os.environ.get("INCLUDE", "").split(

os.pathsep
)


-- Original Message --

From "Wuping Xin" 
To "python-win32@python.org" ; "Mark Hammond" 


Date 3/1/2025 4:14:09 PM
Subject Re: python-win32 Digest, Vol 258, Issue 1


Forget it. I figured out.

W. X.


-- Original Message --
From python-win32-requ...@python.org
To python-win32@python.org
Date 3/1/2025 12:00:02 PM
Subject python-win32 Digest, Vol 258, Issue 1


Send python-win32 mailing list submissions to
python-win32@python.org

To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman/listinfo/python-win32
or, via email, send a message with subject or body 'help' to
python-win32-requ...@python.org

You can reach the person managing the list at
python-win32-ow...@python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of python-win32 digest..."


Today's Topics:

   1. Python Active Scripting Debug (Wuping Xin)


--

Message: 1
Date: Sat, 01 Mar 2025 01:54:24 +
From: "Wuping Xin" 
To: "python-win32@python.org" 
Subject: [python-win32] Python Active Scripting Debug
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Hi All,

I am trying to debug Python Active Scripting, using Visual Studio.  I am
100% sure it should work but I just cannot get it work.

I've installed the debug symbols of the Python version, and installed
Visual Studio Python Native Development tools.

I also set the "Debugging" registry entry for the ActivePy from 0 to 1.

I am able to attach the Python script to the PythonActiveScript host.

But, I just got the following message:

Debugging extensions (axdebug) module does not exist - debugging is
disabled..


Any insights?

Thank you in advance!

W.X.


--

Subject: Digest Footer

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


--

End of python-win32 Digest, Vol 258, Issue 1


___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] python-win32 Digest, Vol 258, Issue 1

2025-03-01 Thread Wuping Xin via python-win32

Forget it. I figured out.

W. X.


-- Original Message --

From python-win32-requ...@python.org

To python-win32@python.org
Date 3/1/2025 12:00:02 PM
Subject python-win32 Digest, Vol 258, Issue 1


Send python-win32 mailing list submissions to
python-win32@python.org

To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman/listinfo/python-win32
or, via email, send a message with subject or body 'help' to
python-win32-requ...@python.org

You can reach the person managing the list at
python-win32-ow...@python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of python-win32 digest..."


Today's Topics:

   1. Python Active Scripting Debug (Wuping Xin)


--

Message: 1
Date: Sat, 01 Mar 2025 01:54:24 +
From: "Wuping Xin" 
To: "python-win32@python.org" 
Subject: [python-win32] Python Active Scripting Debug
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Hi All,

I am trying to debug Python Active Scripting, using Visual Studio.  I am
100% sure it should work but I just cannot get it work.

I've installed the debug symbols of the Python version, and installed
Visual Studio Python Native Development tools.

I also set the "Debugging" registry entry for the ActivePy from 0 to 1.

I am able to attach the Python script to the PythonActiveScript host.

But, I just got the following message:

Debugging extensions (axdebug) module does not exist - debugging is
disabled..


Any insights?

Thank you in advance!

W.X.


--

Subject: Digest Footer

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


--

End of python-win32 Digest, Vol 258, Issue 1


___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32