Re: [python-win32] VT_DECIMAL variant

2020-04-15 Thread Nikita Lepetukhin
Tim, thanks for replying!


VT_CY number doesn’t fit the precision I need (16 digits to the right of
the decimal point). It has only 4 digits according to this description:

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/5a2b34c4-d109-438e-9ec8-84816d8de40d


The decimal (VT_DECIMAL) has precision up to 28 places (
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/b5493025-e447-4109-93a8-ac29c48d018d
).
It is exactly the same as python decimal has. They match to each other
exactly and much better than VT_CY and python decimal. So maybe it wasn’t
the best solution to automatically convert python decimal to VT_CY variant.
Whatever.. what’s done is done.


As I understand there is another way (“manual”) to make the property set
call. Could you show how to make it?


Nikita Lepetukhin

ср, 15 апр. 2020 г. в 09:03, Tim Roberts :

>
>
> On Apr 14, 2020, at 7:09 PM, Nikita Lepetukhin  wrote:
>
> I use win32com module and everything is ok but I cannot find the way how
> to pass VT_DECIMAL variant value to COM object's method.
> ...
> This is how the interface is described in gencache:
> class IProperty(DispatchBaseClass):
> CLSID = IID('{0A4C05A0-107B-4A8B-9E34-44ED9B117A25}')
> coclass_clsid = IID('{2171DCF1-B70B-4CAB-9EB7-F7FED71956B4}')
>
> _prop_map_get_ = {
> "Value": (0, 2, (12, 0), (), "Value", None),
> }
>
>
> That’s a property that returns a VT_VARIANT.
>
>
> In python code I get the object by the following way:
> ...
> I need to pass here VT_DECIMAL variant (due to data precision
> requirements) but it comes to COM object implementation as VT_R8 variant.
> I tried to use decimal python type but it comes as VT_CY variant.
>
> Could you help me to find out how to pass VT_DECIMAL variant from python
> to COM?
> I would appreciate your help very much!
>
>
> The VT_CY type, the Python decimal type, and the C# decimal type are all
> the same — a 128-point fixed point value with 92 bits of precision.  That’s
> probably what you should use.  In order to use VT_DECIMAL, then you
> probably can’t use automatic translation.
> —
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
> ___
> 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


[python-win32] VT_DECIMAL variant

2020-04-15 Thread Nikita Lepetukhin
Tim, thanks for replying!


VT_CY number doesn’t fit the precision I need (16 digits to the right of
the decimal point). It has only 4 digits according to this description:

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/5a2b34c4-d109-438e-9ec8-84816d8de40d


The decimal (VT_DECIMAL) has precision up to 28 places (
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/b5493025-e447-4109-93a8-ac29c48d018d
).
It is exactly the same as python decimal has. They match to each other
exactly and much better than VT_CY and python decimal. So maybe it wasn’t
the best solution to automatically convert python decimal to VT_CY variant.
Whatever.. what’s done is done.


As I understand there is another way (“manual”) to make the property set
call. Could you show how to make it?


Nikita Lepetukhin

ср, 15 апр. 2020 г. в 09:03, Tim Roberts :

>
>
> On Apr 14, 2020, at 7:09 PM, Nikita Lepetukhin  wrote:
>
> I use win32com module and everything is ok but I cannot find the way how
> to pass VT_DECIMAL variant value to COM object's method.
> ...
> This is how the interface is described in gencache:
> class IProperty(DispatchBaseClass):
> CLSID = IID('{0A4C05A0-107B-4A8B-9E34-44ED9B117A25}')
> coclass_clsid = IID('{2171DCF1-B70B-4CAB-9EB7-F7FED71956B4}')
>
> _prop_map_get_ = {
> "Value": (0, 2, (12, 0), (), "Value", None),
> }
>
>
> That’s a property that returns a VT_VARIANT.
>
>
> In python code I get the object by the following way:
> ...
> I need to pass here VT_DECIMAL variant (due to data precision
> requirements) but it comes to COM object implementation as VT_R8 variant.
> I tried to use decimal python type but it comes as VT_CY variant.
>
> Could you help me to find out how to pass VT_DECIMAL variant from python
> to COM?
> I would appreciate your help very much!
>
>
> The VT_CY type, the Python decimal type, and the C# decimal type are all
> the same — a 128-point fixed point value with 92 bits of precision.  That’s
> probably what you should use.  In order to use VT_DECIMAL, then you
> probably can’t use automatic translation.
> —
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
> ___
> 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] VT_DECIMAL variant

2020-04-15 Thread Tim Roberts

Nikita Lepetukhin wrote:


Tim, thanks for replying!


VT_CY number doesn’t fit the precision I need (16 digits to the right 
of the decimal point). It has only 4 digits according to this description:


https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/5a2b34c4-d109-438e-9ec8-84816d8de40d


The decimal (VT_DECIMAL) has precision up to 28 places 
(https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/b5493025-e447-4109-93a8-ac29c48d018d 
). 
It is exactly the same as python decimal has. They match to each other 
exactly and much better than VT_CY and python decimal. So maybe it 
wasn’t the best solution to automatically convert python decimal to 
VT_CY variant. Whatever.. what’s done is done.


It's possible this is a misunderstanding in the pythoncom code. CURRENCY 
goes back to the days of Visual Basic 6, whereas DECIMAL is much more 
recent.  It may be appropriate to file a bug report.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.




smime.p7s
Description: S/MIME Cryptographic Signature
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] VT_DECIMAL variant

2020-04-15 Thread Tim Roberts

Nikita Lepetukhin wrote:
ok, I will report a bug. But to be honest I'm trying to find the 
solution.
Do I understand right that currently there is no way to pass 
VT_DECIMAL variant from python to com?


Oh, it is possible; the library does many automatic conversions, but 
it's possible to do it by hand.  I just don't know the recipe.  If Tim 
Golden is listening, perhaps he can point us to a reference.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.




smime.p7s
Description: S/MIME Cryptographic Signature
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] VT_DECIMAL variant

2020-04-15 Thread Nikita Lepetukhin
ok, I will report a bug. But to be honest I'm trying to find the solution.
Do I understand right that currently there is no way to pass VT_DECIMAL
variant from python to com?

On Wed, Apr 15, 2020 at 9:05 PM Tim Roberts  wrote:

> Nikita Lepetukhin wrote:
> >
> > Tim, thanks for replying!
> >
> >
> > VT_CY number doesn’t fit the precision I need (16 digits to the right
> > of the decimal point). It has only 4 digits according to this
> description:
> >
> >
> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/5a2b34c4-d109-438e-9ec8-84816d8de40d
> >
> >
> > The decimal (VT_DECIMAL) has precision up to 28 places
> > (
> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/b5493025-e447-4109-93a8-ac29c48d018d
> > <
> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-oaut/b5493025-e447-4109-93a8-ac29c48d018d>).
>
> > It is exactly the same as python decimal has. They match to each other
> > exactly and much better than VT_CY and python decimal. So maybe it
> > wasn’t the best solution to automatically convert python decimal to
> > VT_CY variant. Whatever.. what’s done is done.
> >
> It's possible this is a misunderstanding in the pythoncom code. CURRENCY
> goes back to the days of Visual Basic 6, whereas DECIMAL is much more
> recent.  It may be appropriate to file a bug report.
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
>
> ___
> 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] VT_DECIMAL variant

2020-04-15 Thread Nikita Lepetukhin
Thanks Tim! Now I have a hope ))
Could I reach Tim Golden somehow?


On Wed, Apr 15, 2020 at 10:09 PM Tim Roberts  wrote:

> Nikita Lepetukhin wrote:
> > ok, I will report a bug. But to be honest I'm trying to find the
> > solution.
> > Do I understand right that currently there is no way to pass
> > VT_DECIMAL variant from python to com?
>
> Oh, it is possible; the library does many automatic conversions, but
> it's possible to do it by hand.  I just don't know the recipe.  If Tim
> Golden is listening, perhaps he can point us to a reference.
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
>
> ___
> 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