A
A
Alexey M.2015-04-29 14:18:34
Python
Alexey M., 2015-04-29 14:18:34

How to get rid of COM connection error with 1C Python script?

Good afternoon! Help with COM connection error with 1C Python script?
The actual error:

com_error: (-2147024891, 'Access is denied.', None, None)

I played around with quotes and a few slashes along the way, split the connection string into variables, and then glued it together, tried both server databases and non-server ones. If you deliberately set the path to the database to be incorrect, the same error still appears, respectively, the problem is on the Python side, the only question is what it is connected with. The COM component is registered, I tried to change the encoding, all to no avail ...
The code is as follows:
import pythoncom
import win32com.client

V83_CONN_STRING = "Srvr=srv01-w2k8;Ref=base_7;Usr=Администратор;Pwd=1;"

pythoncom.CoInitialize()
V83 = win32com.client.Dispatch("V83.COMConnector").Connect(V83_CONN_STRING)

Platform 1C 8.3, Python 3.4, OS Windows Server 2008 R2 x64.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
klis, 2015-04-29
@lnl

If 1C is 32-bit, then you need to do the following:

The V81.Application object runs under the new 1cv8.exe process.
The V81.COMConnector object is an in-process server. There is no process on the remote computer in which it can be created.
To create a V81.COMConnector object on a remote computer, registering the comcntr.dll component in COM with the regsvr32.exe utility is not enough. You need to register the comcntr.dll component as a COM+ application on a remote computer.
To do this:
* run the Component Services utility;
* create an empty COM+ application with:
o Activation type - Server application;
o name, for example, V81_COMConnector;
o Specify the name of the Windows user under whose name the component will launch the special process dllhost.exe;
* In the Components branch, add a new component comcntr.dll from the 1C:Enterprise load modules directory.
As a result, when the V81.COMConnector object is created, a special system process dllhost.exe will be launched on the remote computer, and the V81.COMConnector object will be created in it.

PS Replace V81.COMConnector with V83.COMConnector. Ignore the fact that we are talking about a remote computer.
Source: www.forum.mista.ru/topic.php?id=526603

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question