[python-win32] error

Sagar Khushalani s.khushalani at yahoo.co.uk
Thu Feb 21 06:01:23 CET 2008


Thanks! Another question, related and random. Someone, anyone?

I am trying to implement an MSMQ, and I have no idea whats going wrong. I looked at:

http://comsci.liu.edu/~murali/python/python28.txt

one of the few places that actually has help with that. I tried to implement it but for some reason it didnt work. I even tried just the Example #1, and even that didnt work. I have attached the error in the text file.I know its a long error, but I can't find any decent documentation on win32com and MSMQs. This is the same error I get when I tried my own program. In the main file, I put this:

    queueinfo = win32com.client.Dispatch("MSMQ.MSMQQueueInfo")
    queueinfo.PathName = ".\\private$\ErrorQueue"
    queue = win32com.client.Dispatch("MSMQ.MSMQQueueInfo")

and I have the Open and rest of the stuff in another file which is a different process and adds/removes stuff from it.  

    queueinfo = win32com.client.Dispatch("MSMQ.MSMQQueueInfo")
    queueinfo.PathName = ".\\private$\ErrorQueue"
    queue = win32com.client.Dispatch("MSMQ.MSMQQueueInfo")

            msg = win32com.client.Dispatch("MSMQ.MSMQMessage")
            if eval(sec)%2 == 0:
                self.txtArea.WriteText("Service is up and running\n")
                msg.Label = "ON"
                msg.Body = "P1:UP"
                 msg.Send(self.errors)
            else:
                self.txtArea.WriteText("Error! Writing message to queue. Service is down\n")
                msg.Label = "ERROR"
                msg.Body = "P1:DOWN"
                msg.Send(self.errors)
            self.errors.Close()

Please help me. I'm very confused.



Tim Roberts <timr at probo.com> wrote: Sagar Khushalani wrote:
> I'm using wxPython and  the processing module. I create a "main" file 
> which has a gui with buttons. Each button creates starts a separate 
> process. However, when I click any of the buttons, I get an 
> stderr/stdout box from wxPython with the following error. I checked 
> online, and found some similar errors that are related to bugs, but 
> they were not exactly the same. Has anyone had the same problem?
>  
> Traceback (most recent call last):
>   File "C:\Homework\Python\main.py", line 54, in startP1
>     p1.start()
>   File "C:\Python25\Lib\site-packages\processing\process.py", line 
> 111, in start
>     self._popen = Popen(self, self._stoppable)
>   File "C:\Python25\Lib\site-packages\processing\process.py", line 
> 393, in __init__
>     creationflags=new_console and CREATE_NEW_PROCESS_GROUP
>   File "C:\Python25\lib\subprocess.py", line 586, in __init__
>     errread, errwrite) =  self._get_handles(stdin, stdout, stderr)
>   File "C:\Python25\lib\subprocess.py", line 715, in _get_handles
>     c2pwrite = self._make_inheritable(c2pwrite)
>   File "C:\Python25\lib\subprocess.py", line 744, in _make_inheritable
>     DUPLICATE_SAME_ACCESS)
> WindowsError: [Error 6] The handle is invalid
> I get this error regardless of whether I run it from IDLE or from the 
> DOS prompt.

By default, a Windows GUI application does not have stdin (or stdout or 
stderr, but wxPython can provide those).  The files are not created, so 
the handles are invalid.

You might try something like this:
    sys.stdin = open('nul','rb')
If that doesn't work, try asking on the wxPython mailing list.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

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



Sagar Khushalani
  Graduate Student, UTA
  Networking / Systems and Architecture
s.khushalani at yahoo.co.uk 
http://www.sagark.info
        

---------------------------------
  Yahoo! Answers - Get better answers from someone who knows. Try it now.

Sagar Khushalani
  Graduate Student, UTA
  Networking / Systems and Architecture
s.khushalani at yahoo.co.uk 
http://www.sagark.info

       
---------------------------------
 Support the World Aids Awareness campaign this month with Yahoo! for Good
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080221/8bd59ab3/attachment-0001.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: error.txt
Url: http://mail.python.org/pipermail/python-win32/attachments/20080221/8bd59ab3/attachment-0001.txt 


More information about the python-win32 mailing list