Re: [python-win32] Compiling pywin32 with PyOxidizer

2021-02-02 Thread Mark Hammond

On 2/02/2021 11:54 pm, Will Deem wrote:

Good morning Pywin32 mailing list,

  I appear to be running into an issue compiling my program using pyoxidizer 
with pywin32. It appears there is some reliance on the __file__ attribute, 
which is breaking as pyoxidizer is loading the modules into memory and there is 
no __file__ attribute.

  Has anyone created a successful workaround for this issue? If not, is there a 
means of monkey patching the __file__ attribute for the win32evtlog module so 
the program can successfully compile?


That traceback isn't very helpful as it doesn't say what reference to 
__file__ is a problem - but everywhere __file__ is referenced the code 
is trying to find an actual file - often a DLL file.


The traceback also says "ModuleNotFoundError: No module named 
'win32evtlog'" - I don't think that's related to __file__.


I've never heard of anyone using pywin32 with pyoxidizer, so you are 
blazing the trail here :)


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


[python-win32] Compiling pywin32 with PyOxidizer

2021-02-02 Thread Will Deem
Good morning Pywin32 mailing list,

 I appear to be running into an issue compiling my program using pyoxidizer 
with pywin32. It appears there is some reliance on the __file__ attribute, 
which is breaking as pyoxidizer is loading the modules into memory and there is 
no __file__ attribute.

 Has anyone created a successful workaround for this issue? If not, is there a 
means of monkey patching the __file__ attribute for the win32evtlog module so 
the program can successfully compile?

 My traceback log is attached.

Fair winds and following seas,
Will




traceback.log
Description: Binary data
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Error: VARIANT Type is unknown

2021-02-02 Thread Olle Pontén
Yes I did. It produced the variant type unknown error as described in the
first post.

import win32api
import win32com.server.util
from win32com import client as w32Client

win32Client =
win32com.client.gencache.EnsureDispatch("{69072C2D-6ED1-4051-BF8D-70286A303CDD}")

s = "AL"
r = "On"

win32Client.scriptCmd(s,r)
Traceback (most recent call last):

  File "", line 1, in 
win32CC.scriptCmd('s','n')

  File
"C:\Users\Natchos\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py",
line 37, in scriptCmd
return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), (31,
1)),cmd

TypeError: The VARIANT type is unknown (0x001f)

I did mange to find a workaround using another package(comtypes) and
working with ctypes:

from comtypes import client as ctClient
import comtypes
import ctypes

AutoIPam = ctClient.CreateObject("ImagingWin.AutoIPam")
s = ctypes.c_wchar_p(cmd)
r = ctypes.c_wchar_p(param)
AutoIPam.scriptCmd(s,r)

This version does work and does not throw an error. I can confirm the
instrument responds to the commands sent thusly.

On Tue, Jan 26, 2021 at 7:47 PM Tim Roberts  wrote:

> Olle Pontén wrote:
> >
> > Hmm ok, I could find the following information using OLEView (se
> > attachment).
> > It states that the two in parameters are noted as VT_LPWSTR for the
> > scriptCmd command.
> > Would that mean that I have no way of interfacing with them at all?
>
> No, it doesn't mean that!  If it doesn't ask for a variant, then you
> don't deliver a variant.  Did you try just passing a string, as Mark
> suggested?
>
> --
> 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