IanH9999 1 Posted December 2, 2020 I'm finding that to use the various functions and procedures within the library I'm having to convert between instances of PPyObject and Variants a lot, but I have no idea why. I can see that the VarPyth.pas header states that that it allows you to use Python objects like COM automation objects, but I'm having trouble understanding the relationship between the two. For example, when calling BuiltInModule.setattr why do I need to pass a Variant rather than a PPyObject? Share this post Link to post
pyscripter 689 Posted December 2, 2020 1 hour ago, IanH9999 said: I can see that the VarPyth.pas header states that that it allows you to use Python objects like COM automation objects, but I'm having trouble understanding the relationship between the two. For example, when calling BuiltInModule.setattr why do I need to pass a Variant rather than a PPyObject? The mechanism that Delphi uses to dispatch such calls does not support it. You need some consistency. Either you use the low-level Python interface and PPyObjects or VarPyth and custom variants. Although you can easily convert PPyObjects to Variants and back (VarPythonCreate, ExtractPythonObjectFrom), sticking to one of the two simplifies life. Share this post Link to post