Hi there, Please help me ;-) I know how to push / pop messages off of a MSMQ, also how to create a queue etc.....but my problem is I cannot seen to catch the "com_error" when I try create a MSMQ that already exists ;-( The basic code is as follows:
import win32com.client import pythoncom import os try: queue_info = win32com.client.Dispatch("MSMQ.MSMQQueueInfo") computer_name = os.getenv('COMPUTERNAME') format_name = "direct=os:" + computer_name + "\\private$\\test3" queue_info.FormatName=format_name queue=queue_info.Open(2,0) "Dies here obviously as queue does not exist except pythoncom.com_error: #Queue does not exist...create queue.... queue_info.PathName = ".\\private$\\test3" queue_info.Label = "New Queue" queue_info.Create() I get an Exception raised in WingIDE that says something like "com_error......the queue does not exist or you do not have sufficient permissions etc" - something like that..... This is the line in "IMSMQQueueInfo3.py" that it is dying on..... def Open(self, Access=defaultNamedNotOptArg, ShareMode=defaultNamedNotOptArg): """Method used to open a queue. The PathName property must be specified to open a queue. Parameters include Access (send, peek, or receive) and ShareMode (exclusive or all).""" ret = self._oleobj_.InvokeTypes(1610743835, LCID, 1, (9, 0), ((3, 1), (3, 1)),Access , ShareMode) Here is the wingide error.... http://www.nabble.com/file/p18586458/error.png File "D:\Documents and Settings\Lynton\Desktop\test_reg.py", line 10, in ? queue=queue_info.Open(2,0) File "D:\Python24\Lib\site-packages\win32com\gen_py\D7D6E071-DCCD-11D0-AA4B-00609 70DEBAEx0x3x0\IMSMQQueueInfo3.py", line 46, in Open , ShareMode) Any ideas on how I can catch ANY COM type error here? Why would it ignore the pythoncom.com_error??? Your help would be greatly appreciated ;-) Lynton -- View this message in context: http://www.nabble.com/MSMQ---cannot-catch-COM_ERROR-with-%22pythoncom.com_er ror%22-tp18586458p18586458.html Sent from the Python - python-win32 mailing list archive at Nabble.com. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32