FWD: [python-win32] coinitialize problem

2005-07-01 Thread Gijs Korremans

Hi,

I'm extending a Python application that uses several com objects and threads. 
The origional programmer set the main thread to multithreaded by doing this:
* sys.coinit_flags = 0
* import pythoncom
This is nessacary because otherwise a com (MapObjects2 from ESRI) can't run in 
a thread, but now I need to use another com object, which is running in a 
thread as well. This com object, made by one of our clients, needs to run in a 
single threading model. For some reason, these two com object won't work 
together in one application. MapObjects2 works when the coini_flags is set to 0 
but then the other com object isn't working and the other way around.

I've tried a lot of things to solve this:
1) don't import pythoncom in the main thread
-- set the mapobjects thread with coInitializeEx(COINIT_MULTITHREADED)
-- set the other trhead with CoInitialize()
2) tried the same things but then with initializing coinit in the mainthread 
with both models
3) Made a some test programs, but I had always the same problems, except when 
I made 2 functions for the 2 com objects, and started them with beginthreadex 
(like described on page 626 from Mark Hammonds book Python programming on 
win32) and then coinitialize in the functions, but unfortunately, this is not 
an option in our main program

Strange enough, we use 2 other comobjects, adotable for mssql and a com object 
for sending smses, and these two are always working.

Can anyone help me with a solution? and maybe som examples?

Kind Regards,

Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


return pramater in com object function

2005-06-02 Thread Gijs Korremans
Hi,

One of the functions in the com object I need to use has a pointer in one of 
it's functions
(object.function(string input, struct * output))

(I've created the struct with win32com.client.Record("structure", object))

I've tried to use the id() function but then Python gives me a message that 
it's an int, not a tructure
and when I just give the object without a pointer, the object is still empty 
afterwards.

In the mailinglist archive I saw this message from Mark Hammond:
"Well, their IDL is at fault, and it clearly should be marked as [in,out]. All 
we should need to do is to get the makepy generated code for this function, and 
change the last "type tuple" for this function. It will be a tuple of, eg 
(pythoncom.VT_OBJECT, pythoncom.PARAMFLAG_FIN). Telling Python it is really 
_FIN | _FOUT should do the trick"

So I opened the by genPy generated file and tried to change the last tuple from 
_ApplyTypes_ but it was already 2 (PARAMFLAG_FOUT):
return self._ApplyTypes_(1, 1, (24, 0), ((8, 1), (36, 2)), 'SetIDString', 
None,inID, outID)

Does anyone know how to solve this?


Kind regards, 


Gijs


--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


pointers in com object functions

2005-06-02 Thread Gijs Korremans
Hi,

One of the functions in the com object I need to use has a pointer in one of 
it's functions
(object.function(string input, struct * output))

I've tried to use the id() function but then Python gives me a message that 
it's an int, not a tructure
and when I just give the object without a pointer, the object is still empty 
afterwards.

I've created the struct with win32com.client.Record("structure", object)


Kind regards, 


Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


re[2]: Com object questions

2005-05-23 Thread Gijs Korremans


> Does IPADDRESSSTRUCT appear anywhere in the makepy-generated module ?
Specifically, there should be a RecordMap dict containing any defined 
Records
and their GUID's.

No it's not in the genereted module, but it is in the COM Browser so I'm sure 
the struct is in the com object
Maybe I can find out somewhere what the GUID's is and put it in the RecodMap 
manually?

   Roger

"Gijs Korremans" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hi,

I'm still figuring out how I can use the win32com for the use of a com 
object which I think is made in VB

First I've created a file with MakePy
Then I used the following code to init the com object:
import win32com.client
Client = win32com.client.Dispatch("ClientModule.Client")

Then, when I want to use a function, for example this one:
ipaddr = kddClient.GetLocalIPAddress()
I get this error:
File 
"C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.py",
 
line 69, in GetLocalIPAddress
  return self._ApplyTypes_(11, 1, (36, 0), (), 'GetLocalIPAddress', None,)
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 446, 
in _ApplyTypes_
  return self._get_good_object_(self._oleobj_.InvokeTypes(dispid, 0, 
wFlags, retType, argTypes, *args),user, resultCLSID)
com_error: (-2147024809, 'The parameter is incorrect.', None, None)
I don't know which parameter is incorrect because the function doesn't need 
any parameters

and when I try to use a struct for the IP address using the following code:
ipaddr = win32com.client.Record("IPADDRESS_STRUCT", Client)
I get this message:
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 403, 
in Record
  raise ValueError, "The structure '%s' is not defined in module '%s'" % 
(name, package)
ValueError: The structure 'IPADDRESS_STRUCT' is not defined in module 
''
I think this means that there is no struct IPADDRESS_STRUCT defined in the 
com object but when I'm going to the ComBrowser in PythonWin it is in there.

I'm using python 2.3 with pywin32 build 203

Does anybody know what i'm doing wrong?

Kind regards,


Gijs <



Kind regards, 


Gijs 

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


Com object questions

2005-05-23 Thread Gijs Korremans
Hi,

I'm still figuring out how I can use the win32com for the use of a com object 
which I think is made in VB

First I've created a file with MakePy
Then I used the following code to init the com object:
import win32com.client
Client = win32com.client.Dispatch("ClientModule.Client")

Then, when I want to use a function, for example this one:
ipaddr = kddClient.GetLocalIPAddress()
I get this error:
File 
"C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.py",
 line 69, in GetLocalIPAddress
return self._ApplyTypes_(11, 1, (36, 0), (), 'GetLocalIPAddress', 
None,)
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 
446, in _ApplyTypes_
return self._get_good_object_(self._oleobj_.InvokeTypes(dispid, 0, 
wFlags, retType, argTypes, *args),user, resultCLSID)
com_error: (-2147024809, 'The parameter is incorrect.', None, None)
I don't know which parameter is incorrect because the function doesn't need any 
parameters

and when I try to use a struct for the IP address using the following code:
ipaddr = win32com.client.Record("IPADDRESS_STRUCT", Client)
I get this message:
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 
403, in Record
raise ValueError, "The structure '%s' is not defined in module 
'%s'" % (name, package)
ValueError: The structure 'IPADDRESS_STRUCT' is not defined in module 
''
I think this means that there is no struct IPADDRESS_STRUCT defined in the com 
object but when I'm going to the ComBrowser in PythonWin it is in there.

I'm using python 2.3 with pywin32 build 203

Does anybody know what i'm doing wrong?

Kind regards, 


Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


What are com_record objects

2005-05-18 Thread Gijs Korremans
Hi,

I want to connect to a com object with win32.client.
Through this com object a have to connect to an other device with 
object.Connect(struct IPADDRESS_STRUCT * ip)

the struct IPADDRESS_STRUCT looks like this:

Byte Offset NameTypeLength (Bytes)  Description
0   b1  BYTE1   Byte 1 of an internet address
1   b2  BYTE1   Byte 2 of an internet address
2   b3  BYTE1   Byte 3 of an internet address
3   b4  BYTE1   Byte 4 of an internet address

Because Python doesn't have structs like C, I tried to do it with a class (C 
structs are classes with no private) and with pack but I always get the error 
message "Only com_record objects can be used as records"

I'm new in the python language but I couldn't find anything about structs or 
com_records in python on the internet.

Does anyone know how to do this? 

Kind regards, 


Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


How to debug a multithreaded windowsNT servvice with Boa Constructor

2005-05-18 Thread Gijs Korremans
Hi,

I'm trying to debug a multithreaded windowsNT service with Boa Constructor but 
it's not working.
I don't know how to debug a service (there's nothing on the internet about 
that) so I've made an extra module espacially for the debugger which starts all 
my threads. (if anyone knows how to debug a service, you're welcome to tell me)

This module is working fine and I can debug it but when I want to debug the 
threads it's not working.
I used a code similar like this one:
import ThreadOne
FirstThread = ThreadOne.ThreadOne()
FirstThread.start()
On the second line, I can walk through the __init__ with the debugger but after 
that the debugger is not working anymore: The debuggerwindow sais ready instaid 
of running but the thread is still updating the logfile which means it's still 
running.
I've used both hard (if hassattr(sys, 'breakpoint'): sys.breakpoint() ) and 
soft (the red dots) breakpoints

I'm currently using 5 threads but I've tried a test app with only 1 thread and 
I had the same problem.

I'm using Boa 0.4.0 with python 2.3 and wxPython 2.5.5


Kind regards, 


Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

-- 
http://mail.python.org/mailman/listinfo/python-list


boa can't connect to zope

2005-03-18 Thread Gijs Korremans
Hi, 

I want to debug python applications on a remote pc with Boa Constructor. To do 
this, I have to install Zope and install the remote module from boa to the 
roodfolder from the management interface (http://localhost:8080/manage). I've 
done this, set the username and password en clicked start. the management 
interface says now "The debug server is active" but when I want to connect to 
the server with boa constructor I get an error (connection refused) and when I 
do a portscan on the server, the port 26200 is not open. 

I'm running win2003 server with python 2.3 and zope 2.7.4. 
Can you tell me how to open the port on win2003 or tell me what else I'm doing 
wrong? 

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

--
http://mail.python.org/mailman/listinfo/python-list


{SPAM} Remote debugging

2005-03-16 Thread Gijs Korremans
Hi,

For developing Python 2.3 applications I use Boa Constructor for debugging the 
application. This is working fine but now I want to debug an application on a 
remote PC (win 2003 server) installed as a NT Service. I know it is possible 
with Boa Constructor and HAP debugger but it doesn’t work with both debuggers.

With the HAP debugger it is possible to connect to the remote pc but it doesn’t 
stop at the breakpoints

The Boa Constructor doesn’t work at all, when I go to Tools->Attach to debugger 
and press Ok I get the error message “error: (10061, ‘Connection refused’)” 
I followed the steps in Boa Debugger help and every thing I found on google: 
Add the debugger to Zope.

I’ve installed the source code on the same place at the server and at the 
client pc (D:\project\)

Does anybody know how to do this?

Kind regards, 


Gijs Korremans
R&D Department

Global Supply Chain Services (pty) Ltd.
P.O. Box 1263
Rivonia 2128
South Africa
Tel: +27 (0)11 802 1329
Fax: +27 (0)11 802 6528
E-mail: [EMAIL PROTECTED]

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

--
http://mail.python.org/mailman/listinfo/python-list


{SPAM} start a python application as a win NT service

2005-03-14 Thread Gijs Korremans
Hi,

I'm using windows 2003 small business server and I want to install my python 
programm as a NT (it's just an old name) service. Does anybody know how to do 
this?


Kind regards, 


Gijs Korremans
R&D Department

Global Supply Chain Services (pty) Ltd.
P.O. Box 1263
Rivonia 2128
South Africa
Tel: +27 (0)11 802 1329
Fax: +27 (0)11 802 6528
E-mail: [EMAIL PROTECTED]

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

--
http://mail.python.org/mailman/listinfo/python-list


{SPAM} Remote debugging with boa constructor

2005-03-14 Thread Gijs Korremans
Hi,

I'm a newby on the Python language but I have to modify an excisting pyhon 
application which runs as a Windows NT service (on 2003 server). I've heared 
that it's possible to debug an application with boa constructor over the 
internet, I tried some things what I found on the internet but it doesn't work. 
Does anybody know how to do this?
Debugging is working on a local pc.

tnx

Gijs

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

--
http://mail.python.org/mailman/listinfo/python-list