-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Never use/create win32com.gen_py
, always use one under $TEMP
#1666
Comments
How did you install the python 3 version? |
I first installed the python-3.9.2.exe from python.org, and then your pywin32-300.win32-py3.9.exe. I made a small Windows console program to show the error: // PyWin32_v3Test.cpp : This file contains the 'main' function. Program execution begins and ends there. #include <windows.h> // {BB1A2AE1-A4F9-11cf-8F20-00805F2CD064} int main()
} -cpede |
That looks like the 32bit version of Python 3.9 - if you executable is 64bit, then that would be expected. I believe the WSH tests all work on 3.9, so if that's not the problem I'm not surewhat it might be. |
I’m running application in 32-bit, and Python is also 32-bit.
Does this dump help:
pythoncom error: ERROR: server.policy could not create an instance.
Traceback (most recent call last):
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
myob = call_func(classSpec)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 728, in call_func
return resolve_func(spec)(*args)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 717, in resolve_func
module = _import_module(mname)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 736, in _import_module
__import__(mname)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32comext\axscript\client\pyscript.py", line 17, in <module>
import win32com.client.dynamic
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\__init__.py", line 11, in <module>
from . import gencache
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 657, in <module>
__init__()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 59, in __init__
Rebuild()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 644, in Rebuild
_SaveDicts()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 66, in _SaveDicts
f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb")
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 142, in GetGeneratePath
f = open(fname,"w")
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Python39-32\\lib\\site-packages\\win32com\\gen_py\\__init__.py<file://Python39-32/lib/site-packages/win32com/gen_py/__init__.py>'
pythoncom error: Unexpected gateway error
Traceback (most recent call last):
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
myob = call_func(classSpec)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 728, in call_func
return resolve_func(spec)(*args)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 717, in resolve_func
module = _import_module(mname)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\server\policy.py", line 736, in _import_module
__import__(mname)
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32comext\axscript\client\pyscript.py", line 17, in <module>
import win32com.client.dynamic
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\__init__.py", line 11, in <module>
from . import gencache
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 657, in <module>
__init__()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 59, in __init__
Rebuild()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 644, in Rebuild
_SaveDicts()
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 66, in _SaveDicts
f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb")
File "C:\Program Files (x86)\Python39-32\lib\site-packages\win32com\client\gencache.py", line 142, in GetGeneratePath
f = open(fname,"w")
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Python39-32\\lib\\site-packages\\win32com\\gen_py\\__init__.py<file://Python39-32/lib/site-packages/win32com/gen_py/__init__.py>'
pythoncom error: CPyFactory::CreateInstance failed to create instance. (80004005)
C:\Users\Dantec_PIV\source\repos\PyWin32_v3Test\Debug\PyWin32_v3Test.exe (process 10404) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
Best regards / med venlig hilsen
Carsten Pedersen, MSc
Software Development (Point Software)
Direct +45 4457 8143
[cid:image001.png@01D70BD4.8066C4F0]
Dantec Dynamics A/S / Tonsbakken 16-18 / DK-2740 Skovlunde / Denmark
Phone +45 4457 8000 / www.dantecdynamics.com
This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited. Please be aware of the increase in cybercrime and fraud. If you receive an email purporting to be from someone at Dantec Dynamics which seeks to direct a payment to bank details which differ from those we have already given to you via an authorized invoice signed and stamped by Dantec Dynamics, it is unlikely to be genuine. Please do not reply to the email nor act on any information contained therein but contact us immediately by phone. Please consider the environment before printing this e-mail.
From: Mark Hammond <notifications@github.com>
Sent: 25. februar 2021 22:30
To: mhammond/pywin32 <pywin32@noreply.github.com>
Cc: Carsten Pedersen <cpn@dantecdynamics.com>; Author <author@noreply.github.com>
Subject: Re: [mhammond/pywin32] Python 3 with WSH and IID_IActiveScript (#1666)
That looks like the 32bit version of Python 3.9 - if you executable is 64bit, then that would be expected. I believe the WSH tests all work on 3.9, so if that's not the problem I'm not surewhat it might be.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1666 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACUD6U5K2HIQDJ4SDHJGOYLTA26MFANCNFSM4YEMIPUA>.
This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited. Please be aware of the increase in cybercrime and fraud. If you receive an email purporting to be from someone at Dantec Dynamics which seeks to direct a payment to bank details which differ from those we have already given to you via an authorized invoice signed and stamped by Dantec Dynamics, it is unlikely to be genuine. Please do not reply to the email nor act on any information contained therein but contact us immediately by phone. Please consider the environment before printing this e-mail.
|
huh, yeah, it probably does. Can you please try removing the |
Bingo, that makes it work :-) Two quick questions:
|
Yes, eventually, but a fix for this isn't even committed yet.
Sure.
No, but the installer exe is just a .zip, so you can just manually unpack, then copy the files, then run the postinstall script manually. |
I wish I could find that conversation I referred to - so in the meantime we can track the non-writable gen_py directory here |
win32com.gen_py
, always use one under $TEMP
#1143 ? |
Now it is not working again. And I can't remember how/where I got the traceback file from? How do I read the traceback error when running my c++ program? -cpede |
Generally by wrapping the python code you call in try/catch and a call to |
Hmm I did not do that, since I'm not calling py code at all, only my c++ code, where the last part fails?
|
Right. Maybe registered the python com object with --debug and using win32traceutil? |
OK I found the difference between Python 2.7 which always works and 3.9. It seems that you are copying the pythoncom27.dll and the pythoncom39.dll into the Windows /System32 folder. But 2.7 also copies the dependent python27.dll, whereas python39.dll is located in the Python installation folder. I did not setup the Environment Variables why it can't find it. Copying python39.dll into the Windows /System32 folder makes it work (and probably also setting up the environment variable). |
It also looks like your pywin32 version 2.7 removes the pythoncom27.dll and Python removes the python27.dll from Windows/System32, during uninstall. But 3.8 and 3.9 forget to uninstall all files in Windows/System32 ? |
I have been using the pywin32 in v2.7 together with Python 2.7:
pywin32-221.win32-py2.7.exe
python-2.7.18.msi
together with the Windows Script Hosting ActiveX interface in my C++ application.
After changing to the latest v3 the scripting engine cannot be instantiated using the IID_IActiveScript
interface, because the class is not registered?
Any idea what the problem is?
-cpede
The text was updated successfully, but these errors were encountered: