Notepad++ 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lynton Grice
Sent: Wednesday, July 23, 2008 11:38 AM
To: python-win32@python.org
Subject: [python-win32] FW: MSMQ - cannotcatchCOM_ERROR 
with"pythoncom.com_error"


Hey Tim,

Wow, you are 100% correct....there was something in WingIDE that is not
happy....strange....

I ran the same code in the standard interpreter and it caught the error
perfectly....

BTW: What IDE's do you guys use for Python?

Thanks a million, have a great day!

Lynton

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden
Sent: 22 July 2008 05:21 PM
Cc: python-win32@python.org
Subject: Re: [python-win32] MSMQ - cannot catchCOM_ERROR
with"pythoncom.com_error"

Lynton Grice wrote:
> 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.....

I can't see anything obvious (aside from the
possible dangers inherent in assuming that
*any* com_error means the queue doesnt' exist).
I assume that the -- "Dies here... -- isn't in the
original code?

Does the same thing happen if you run in the
standard interpreter? (Don't know if WingIDE
does anything fancy to intercept exceptions).

If the same does happen in the interpreter, can
you use the traceback module / sys.exc_info to
determine exactly what exception is raised and
how it relates to pythoncom.com_error?

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to