How to avoid a warning message box when sending email via Outlook

2006-08-31 Thread Dermot Doran
Hello All,

I'm very new to using win32com! I just want to send an email message via Outlook. However, I keep getting an annoying message box (generated by Outlook)indicating that my program could be a virus. Does anybody know how to get around this? Here is the sample code I'm using:

from win32com.client import Dispatchs=Dispatch(Outlook.Application)ns=s.GetNamespace(MAPI)ns.Logon() # Note: I've taken the login credentials out of the example :-)mi = ns.Application.CreateItem
(0)mi.Recipients.Add(an,other)mi.Subject=Hello from Python!mi.Body=I just need to figure out how to avoid the message box now!mi.Send()ns.Logoff()
I'm probably missing something silly or have hit a brick wall with what I want to do with CDO.

Cheers!!

Dermot.

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

Re: How to avoid a warning message box when sending email via Outlook

2006-08-31 Thread Dermot Doran
Hi Tim,

looks like I might be back to the drawing board :-( Thanks for letting me know what your experiences have been.

I'm kind of surprised that it works this way since the ns.logon() allows me to access the Outlook address book without any problems. Without the logon I get another warning box requesting that I allow access to an external program.


Ah well.

Cheers!!

Dermot.
On 31/08/06, Tim Golden [EMAIL PROTECTED] wrote:
[Dermot Doran]| I'm very new to using win32com!I just want to send an email| message via Outlook.However, I keep getting an annoying
| message box (generated by Outlook) indicating that my program| could be a virus.Does anybody know how to get around this?As far as I've ever been able to tell, you're stuck with it.Obviously, in a sense, since otherwise any would-be virus /
zombie program would simply turn the option off before usingOutlook to send out its emails!TJGThis e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactiveanti-virus service working around the clock, around the globe, visit:http://www.star.net.uk
--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid a warning message box when sending email via Outlook

2006-08-31 Thread Dermot Doran
Hi Giles,

Yep, the admin can override this. I've been doing some of my own hunting around and it would appear that you can:
- Resolve this if you have admin rights.
- Use Outlook Redemption http://www.dimastr.com/redemption/
- Use Extended MAPI
- Install ClickYes http://www.contextmagic.com/
- Have the Enterprise migrate to Linux! Yes!!

Thanks for responding!

Cheers!!

Dermot.

P.S.

Apologies for top posting (doing this quickly via GMail)!
On 31 Aug 2006 03:51:08 -0700, Giles Brown [EMAIL PROTECTED] wrote:
Tim Golden wrote: [Dermot Doran] | I'm very new to using win32com!I just want to send an email
 | message via Outlook.However, I keep getting an annoying | message box (generated by Outlook) indicating that my program | could be a virus.Does anybody know how to get around this?
 As far as I've ever been able to tell, you're stuck with it. Obviously, in a sense, since otherwise any would-be virus / zombie program would simply turn the option off before using Outlook to send out its emails!
Can't remember the details, but last timeI looked (a year ago) youcould avoid this if you changed a setting for the user at the exchangeserver.I found this out by doing a bit of googling andcan't remember what I did, but managed to solve the same problem.
Giles--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid a warning message box when sending email via Outlook

2006-08-31 Thread Dermot Doran
Thanks Tim!

We have smtp bolted to the floor :-(
On 31/08/06, Tim Golden [EMAIL PROTECTED] wrote:
[Dermot Doran]| looks like I might be back to the drawing board :-(Thanks| for letting me know what your experiences have been.
Just to elaborate slightly on that experience, if all I wantto do is to send an email (ie not look up addresses on Contactsor do any fancy Outlook-related thing) then I just use an SMTPserver. Here at work the admins have Exchange set up as an
SMTP server, which may or may not be the case for you. At homeor from websites etc. I simply use whichever SMTP server I'dnormally send mail through.Obviously this won't do anything like keeping a copy in your
Sent Mail box etc. but it will at least work, and with a bitmore effort you may be able to do things like that manually.TJGBTW, people in this group will tend to frown on top-posting,even though we Outlook users have to work around Outlook's
tendency to offer it a [Reply] ;)This e-mail has been scanned for all viruses by Star. Theservice is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:http://www.star.net.uk--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: httplib, threading, wx app freezing after 4 hours

2006-07-27 Thread Dermot Doran
According to the wxPython in Action book using the wx.CallAfter function in a non-gui thread is a safe wayfor threads to call functions that will then update the gui in the gui thread.

Cheers!!

Dermot.
On 23/07/06, Mark rainess [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote: Mark rainess wrote:
 [...] It runs perfectly for about 4 hours, then freezes. I'm stuck. How do I debug this? [...] Can anyone suggest techniques to help me learn what is going on.
 By inspection: errcode is undefined; I expect you stripped the example a bit too far. If it is set to something other 200, it looks like you loop out. You are calling 
wx.CallAfter() from a different thread than runs the GUI. Is that documented to be safe? I've read that wxPostEvent() is is the call to use for this. Next thing to try is adding enough logging to tell exactly what
 statement hangs.Thanks guys, I found the problem.I had screen-saver set to None and power set to blank monitor after 30minutes. The problem occurred after the monitor blanked. I remembered I
re-flashed my bios a few weeks ago. I didn't check the biospower-management settings. I'm not going to reboot now to check becauseI have too much stuff open.I set power to never blank monitor. Now there is no problem.
I added code to monitor for activity and to kill and restart the threadif activity stops. Now if power-management kills it, it wakes-up whenthe screen returns.I think using wx.CallAfter() the way I have is correct. I will check
that. It does work properly though.Mark--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: New to threads. How do they work?

2006-07-20 Thread Dermot Doran
Hi 

I think the answer to your last question is that the threading module provides a high level interface (i.e. easier to use) to the thread module. The thread module is very low-level. Any threaded python scripts I have written (not expert) have used the threading module which is, in my opinion, a very clean easy to use module. Just takes a bit of hacking with to get used to.


Cheers!!

Dermot.
On 19 Jul 2006 23:53:22 -0700, gel [EMAIL PROTECTED] wrote:
Dennis Lee Bieber wrote: On 19 Jul 2006 19:08:12 -0700, gel 
[EMAIL PROTECTED] declaimed the following in comp.lang.python:  import thread  Step one... Skip the thread module and use threading module instead.  def create():
   pythoncom.CoInitialize()  c = wmi.WMI()  while 1 :   print watching creation  watcher = 
c.watch_for(notification_type=Creation,  wmi_class=Win32_Process, delay_secs=1) I don't know WMI, but is that delay a real sleep operation, or a polling loop?
 And either could be a problem if they hold the GIL -- preventing anything else from running until they return...   thread.start_new_thread(create(),())  
thread.start_new_thread(delete(),()) At the very least, I suggest commenting out the COM and WMI calls -- test threads that ONLY print output and do a time.sleep(1). That should be sufficient to see if the threads themselves are being started.
 -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED]
 HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff: [EMAIL PROTECTED]
) HTTP://www.bestiaria.com/Thanks alot for your help.I had tried using threading with adifferent setup in the function side but did not get success. I think
that I have winner now.Thanks again.What follows is the what I haveworking so far.And another question why do you prefer to us threadingand thread?import wmiimport pythoncomimport threading
def create(): pythoncom.CoInitialize() c = wmi.WMI() while 1 : print watching creation watcher = c.watch_for(notification_type=Creation,
wmi_class=Win32_Process, delay_secs=1) print watcher()def delete(): pythoncom.CoInitialize() d = wmi.WMI() while 1 : print watching deletion
 watcher = d.watch_for(notification_type=Deletion,wmi_class=Win32_Process, delay_secs=1) print watcher()import threadingthreading.Thread(target=create).start()
threading.Thread(target=delete).start()Cheers--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: questions to anyone who uses wxPython

2006-07-20 Thread Dermot Doran
Hi 

the wxPython in Action provides a very good explanation as to how to handle this sort of problem using a combination of pure Python threads and the wx.CallAfter function. Also if you want more help on this you can join the wxPython mailing list via 
www.wxpython.org.

Here is a small example of what I'm talking about that uses a Queue object to get a background thread to await work from the main gui thread. Note it is VERY important that all GUI updates are performed by the main thread in a wxPython program.


import wximport threadingimport Queue
class WorkerThread(threading.Thread):def __init__(self, callBack):threading.Thread.__init__(self)self.callBack = callBackself.work_queue = Queue.Queue()self.setDaemon(True)def run(self):
wx.CallAfter(self.callBack, Thread starting up...)work_to_be_done = Truewhile work_to_be_done:req = self.work_queue.get(True)# Go and perform some long lasting task here!
wx.CallAfter(self.callBack, Sorry I was kind of busy just now!)def helloThere(self):self.work_queue.put_nowait(This could be an object)class MyFrame(
wx.Frame):def __init__(self):wx.Frame.__init__(self, None, -1, Testing wxCallback and Python threads)self.worker_thread = WorkerThread(self.logMessage)panel = wx.Panel(self)
test_btn = wx.Button(panel, -1, Hello!)self.log = wx.TextCtrl(panel, -1, , style=wx.TE_MULTILINE|wx.TE_RICH2|wx.TE_READONLY)sizer = wx.BoxSizer(wx.VERTICAL)sizer.Add(self.log
, 1, wx.EXPAND|wx.ALL, 5)sizer.Add(test_btn, 0, wx.ALIGN_CENTER_HORIZONTAL)panel.SetSizer(sizer)self.Bind(wx.EVT_BUTTON, self.onTestBtn, test_btn)self.Bind(wx.EVT_CLOSE, self.onCloseWindow)

self.worker_thread.start()def onTestBtn(self, evt):self.worker_thread.helloThere()def onCloseWindow(self, evt):self.Destroy()def logMessage(self, msg):self.log.AppendText
(msg)self.log.AppendText(\n)if __name__ == '__main__':app = wx.PySimpleApp()frm = MyFrame()frm.Show()app.MainLoop()

Cheers!!

Dermot.

On 19 Jul 2006 22:52:09 -0700, Frank Millman [EMAIL PROTECTED] wrote:
damacy wrote: hello. i'm using wxPython as my GUI package and whenever my program executes a long process which takes at least 2 or 3 seconds, the user
 interface gets corrupted while executing the progrocess during the period. i have tried the following lines of code... frame = mainwindow(None, -1, 'my program') ...
 ... frame.UpdateWindowUI() and it did not make any difference at all. could anyone help me?I don't really understand the question - what do you mean when you say
the user interface gets corrupted?Nevertheless, the following pointer may help -http://tinyurl.com/hj84lIt is an article in the wxPyWiki that discusses various ways of
handling longrunning tasks.HTHFrank Millman--http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list