Re: [python-win32] Repr, and Unicode type [Was: Get key press in Windows 7]
On 11/28/2014 9:46, John Sampson wrote: In answer to Time Roberts, I saw an item prefixed with 'u' (u'\x1a'). What is the purpose of this prefix? I would have thought it meant 'Unicode' but the type according to Python is 'str'. In Py2: a = u'x' type(a) type 'unicode' In Py3.4: a = u'x' type(a) class 'str' Note that u'' is not available in Py 3.0 - 3.2. See e.g. here for more details: https://docs.python.org/3/howto/pyporting.html?highlight=unicode%20literal#from-future-import-unicode-literals Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] How do I change the executable/process name to un-group taskbar icons?
Hi Nathan, On 9/16/2014 3:17, Nathan McCorkle wrote: I've been writing GUIs with wxPython for a while now, and am trying to figure out now how to get each program not to group into a generic 'pythonw' taskbar icon. I found this API, but it doesn't work on my version of Windows XP: SetCurrentProcessExplicitAppUserModelID Is there some other method to change things? Hhm, not sure but I think using wx.App.SetAppName should do that. Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api on Windows 8
Hi Vernon, On 11/03/2014 19:43, Vernon D. Cole wrote: I updated the Python version on my Windows 8.1 box to match yours exactly, and here is what I see: Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Users\vernonpy Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import win32api win32api.GetVersion() 602931718 The difference I see is that my Python says on win32 but yours does not, so there is some difference in the installations. I used the Python x86 msi installer, UAC on, installed for all users from an administrator account, taking all defaults. I am running on an administrator account. How might your installation be different? The only difference is that I installed just for my user (which is an admin account) I'll de-install and install for all users again. Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api on Windows 8
Hi, On 12/03/2014 08:25, Werner wrote: Hi Vernon, On 11/03/2014 19:43, Vernon D. Cole wrote: I updated the Python version on my Windows 8.1 box to match yours exactly, and here is what I see: Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Users\vernonpy Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import win32api win32api.GetVersion() 602931718 The difference I see is that my Python says on win32 but yours does not, so there is some difference in the installations. I used the Python x86 msi installer, UAC on, installed for all users from an administrator account, taking all defaults. I am running on an administrator account. How might your installation be different? The only difference is that I installed just for my user (which is an admin account) I'll de-install and install for all users again. Still searching but got a bit further. The problem is only happening within the WingIDE 5 Python shell, if I do the import using python27/python.exe then it works fine. I have posted to WingIDE support, will see if they have an explanation and hopefully a solution. I checked sys.path on both and they are identical, so it must be something WingIDE is doing. Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] win32api on Windows 8
Hi, Doing some more testing, i.e. removed all again and start to install again. Noted that pywin32-216.win32-py2.7.exe shows this at the end: close failed in file object destructor: sys.excepthook is missing lost sys.stderr I see the same if I use pywin32-218, in both cases I run it by right clicking the installer and select run as admin. O.K., now after having un-installed all what was installed into Py2.7 and installed it all again it works. Only difference I can think of is that I initially did not 'right click' and run as admin. Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
[python-win32] win32api on Windows 8
Hi, I sent this to pywin32-b...@lists.sourceforge.net a while ago but it doesn't show up in the archive, so I try here. I just started working with Windows 8.1 and run into problems with above. 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] Python Type help, copyright, credits or license for more information. import win32api Traceback (most recent call last): File string, line 1, in fragment ImportError: DLL load failed: %1 is not a valid Win32 application. I tried both pywin32-218.win32-py2.7.exe and pywin32-216.win32-py2.7.exe. I had no problems with pywin32 on Windows 7. Appreciate any tip on how to fix this. Werner ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Dropping support for Python 2.3?
On 29/04/2013 00:30, Andreas Holtz wrote: I'm bound to Python 2.5. I make heavy usage of 4Suite which is not supported for Python 2.6+ so I can not upgrade :( Or does anyone know a good XML lib that support xpath? What about Amara 2.x: https://pypi.python.org/pypi?%3Aaction=searchterm=amarasubmit=search Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] ImportError: No module named xxxxxx
On 10/11/2012 13:32, pythonStudent wrote: Hello, When I issue the following statement: import win32com.client I got the following result: Traceback (most recent call last): File pyshell#3, line 1, in module import win32com.client ImportError: No module named win32com.client install win32 com http://starship.python.net/~skippy/win32/Downloads.html These happened too with the following statements: from xlrd import open_workbook Traceback (most recent call last): File pyshell#1, line 1, in module from xlrd import open_workbook ImportError: No module named xlrd install xlrd http://pypi.python.org/pypi/xlrd import pythoncom Traceback (most recent call last): File pyshell#2, line 1, in module import pythoncom ImportError: No module named pythoncom http://starship.python.net/~skippy/win32/Downloads.html I there anything I need to do first or install first before I execute these statements? Yeap, see above Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] AppData directory on Windows?
On 09/01/2011 02:49 PM, Tim Golden wrote: On 01/09/2011 13:39, Kevin Walzer wrote: Hi, I’m getting feedback from a Windows user that says my Tkinter app won’t write data to an app temporary directory. Here’s my code: sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') This is a little brittle. I imagine it will at least break from non-English versions of Windows. It will also break for versions of Python prior to 2.5? when expanduser was expanded to include Windows. The simplest approach is to use the APPDATA env var which goes back a few versions (certainly to XP, probably Win 2000). Alternatively, you can use the Windows Shell API to query the same thing -- this should go back even further if you've got someone using something truly prehistoric. Not that this helps Kevin, in wxPython there is wx.StandardPaths which does a pretty good job of getting the right path. Was hoping that I could point you to the source, but it looks that this is mostly implemented in wxWidget and therefore is in C++ and not in Python. Would be nice to have something like this in pure Python - anyone who speaks C++ and has some free time on his/her hand:). Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Recurring DLL error with py2exe
Hi Jacob, On 08/25/2011 03:02 PM, Jacob Kruger wrote: Thought this problem was specific to pyaudiere, but now got same thing when tried to test using py2exe on a very small, test wxPython app to make sure it was worth focusing on this in terms of GUI's etc., but it again tells me the same thing. Typed in following command line code using sort of standard setup.py file that works on other things like my mapData IF engine, but did change the name of the .py file it should process: python setup.py py2exe The last 2 lines rendered in that window are then the following: *** finding dlls needed *** error: MSVCP90.dll: No such file or directory That specific DLL gets copied quite easily into the relevant subfolder of the dist folder when I run a similar command for my much larger, but, I suppose, simpler, mapData app, since that one doesn't try to import libraries/modules like piaudiere or wxPython as such. Any thoughts on what could really be happening here, or should I try sort out reinstalling windows7 or something...? py2exe is getting confused on this DLL for some reason, you just need to exclude it. dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'MSVCP90.dll', 'mswsock.dll', 'powrprof.dll'] Additional information for wxPython and py2exe can be found on the wiki here: http://wiki.wxpython.org/py2exe Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Recurring DLL error with py2exe
On 08/25/2011 04:30 PM, Jacob Kruger wrote: Ok, where should I include that exclude line? I tried just copying it into the setup.py file a bit higher up, but not sure if needs to be specifically included in some part of it, and I found out if I also tried to tell it not to copy the MSVCRT subfolder it still generates that error so it must have something to do with the actual compilation processing of the external module or something, but, maybe if I just need to tell it to exclude those files from a specific spot in the setup.py file that could sort it out? dll_exludes is a py2exe option, should we in your options dict - see below. Anyway, here's current source of my setup.py file: #---start of source--- from glob import glob from distutils.core import setup import py2exe dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'MSVCP90.dll', 'mswsock.dll', 'powrprof.dll'] data_files = [ (Microsoft.VC90.CRT, glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*')) ] #data_files= [] options = { bundle_files: 1, Option 1 is more trouble then it is worse - would recommend 2 and use a installer such as InnoSetup to deliver a single file. Some of this is shown/explained on the wxPython wiki. ascii: 1, # to make a smaller executable, don't include the encodings compressed: 1, # compress the library archive dll_excludes: dll_excludes, } setup( # The first three parameters are not required, if at least a # 'version' is given, then a versioninfo resource is built from # them and added to the executables. version = 1.0.0, description = testingWxPython, name = aboutBox, options = {'py2exe': options}, # targets to build console = [AboutBox.py], data_files=data_files ) #---end of source--- Could it also maybe be something to do with this line?: console = [AboutBox.py], Since while setup.py is running in console mode, don't know if the resulting wxPython based .exe runs in a console mode window as such..? No problem, it will show a console window and a second window is opened with the wxPython GUI. This is sometimes handy to track down some tracebacks which don't show if you use window. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Recurring DLL error with py2exe
Tim and Mark, On 08/25/2011 07:29 PM, Tim Roberts wrote: Mark Mordeca wrote: Hi, Python is built using 2008. You can find this in the readme.txt under the PCbuild folder (from the 2.7.2 source at least): Memory fault on my part. I was thinking they had bypassed 2008 and gone from 2005 straight to 2010, but I see both 2.6 and 2.7 use VS2008. The OP's problem is that when he tries to compile the dll is not found by py2exe. The simple solution which works for me is just to exclude it as I mentioned in a previous post and it is also mentioned in the wxPython wiki - http://wiki.wxpython.org/py2exe IIRC this problem only shows up with py 2.6 and higher. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] send to mail recipient
On 07/28/2011 04:25 AM, Her Him wrote: I've scoured the Internet for a way to mimic the functionality of the windows 'Send to Mail Recipient' shortcut, but the best I've come up with are a few C++ examples like this one: http://www.codeproject.com/KB/shell/sendtomail.aspx?display=Mobile. Unfortunately C++ and I don't get along and I've had a terrible time trying to translate them into python using the pywin32 module. I understand that there are ways using smtp etc to send an email I've used them before on other projects but that's not what I'm trying to accomplish here. What I want is a way to pop the default email client (In my case Lotus Notes) with a new message and a file attached waiting for the user to type the body of the email add a recipient and send (Just like the 'Send to Mail Recipient' shortcut.) My understanding is that basically you have to emulate the drop target of the 'Send to Mail Recipient' shortcut call its drop function and provide it an IDataObject pr something similar and it just works. But for the life of me I can't accomplish this. If anyone out ther can help it would be very appreciated. If you are only on Windows then maybe simplemapi.py will be fine for you. I use the code originaly done by Ian Cook. http://www.kirbyfooty.com/simplemapi.py I couldn't remember his name so did a bit of googling and found that there is a newer more updated version by John Popplewell which I haven't tried yet. http://www.johnnypops.demon.co.uk/python/simplemapi.py Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] ide for python 3.x
Hi, On 17/05/2010 08:25, Vineet Deodhar wrote: Hi ! Recently I have started learning python. Till now, I have been programming with VFP MySQL. I explored the web looking for the IDE for Python. _Dabo is an excellent framework. (but the IDE is still to be developed, I think)._ As far as open-source IDE's are considered, I couldn't locate one having UI design toolkit. (by UI design, what I mean is that -- e.g. click on a form control, and drag it to the designer area, resize it visually, without writing any code manually). Further, tools like wxPython are supporting only upto Python 2.6 Same case with Netbeans 6.8. Does anybody know whether an IDE (open-source) is available which supports Python 3.x and GUI toolkit? Note that there quit a few libraries not yet supporting 3.x, unless you have an absolute need for 3.x I would suggest that you go with 2.6. With regards to IDE, you might want to look at Boa (https://sourceforge.net/projects/boa-constructor/), not supporting 3.x either, I use it on Py 2.5 and 2.6 with wxPython 2.8. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] zip of file using python
On 08/04/2010 09:52, a h wrote: hi I want to zip a folder using python script. I have written below piece of code, but i found that total size of all file is equal to the size of resultant zip file. so no compression is done. Its just put all the files in a folder and say save it with an extension(.zip). May be i am wrong someway, but i checked it correctly. import zipfile, os archive_list = os.listdir(logs_21-01-2010) # save the files in the archive_list into a PKZIP format .zip file zfilename = logs_21-01-2010_.zip zout = zipfile.ZipFile(zfilename, w) I guess/think you need to define compression, see the doc for: 12.4.1 ZipFile Objects class ZipFile(file[, mode[, compression[, allowZip64]]]) e.g. zipfile.ZipFile('afile.zip', w, zipfile.ZIP_DEFLATED) Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Attempt to make executable from Python script
On 31/03/2010 10:59, travel europe wrote: Harald, I followed the recommendation in your link and got the following result: C:\Python26\distgolden.exe Traceback (most recent call last): File golden.py, line 2, in module File winsys\registry.pyc, line 39, in module File winsys\security.pyc, line 42, in module File winsys\_security\_tokens.pyc, line 10, in module File winsys\accounts.pyc, line 31, in module File winsys\dialogs.pyc, line 46, in module File win32ui.pyc, line 12, in module File win32ui.pyc, line 10, in __load ImportError: DLL load failed: This application has failed to start because the a pplication configuration is incorrect. Reinstalling the application may fix this problem. This is due to Python 2.6 and the new SxS MS Runtime ...! See here for a solution which works for me when using wxPython and Py 2.6. http://wiki.wxpython.org/py2exe Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Attempt to make executable from Python script
Hi, On 30/03/2010 07:39, travel europe wrote: Hello, I am attempting to make an executable from a working Python script per the instructions from the following website: http://logix4u.net/Python/Tutorials/How_to_create_Windows_executable_exe_from_Python_script.html Everything seems to go as planned, except when I run the resulting executable I get the following message: Traceback (most recent call last): File tim.py, line 2, in module File winsys\registry.pyc, line 39, in module File winsys\security.pyc, line 42, in module File winsys\_security\_tokens.pyc, line 10, in module File winsys\accounts.pyc, line 31, in module File winsys\dialogs.pyc, line 45, in module *ImportError: No module named shell* Is winsys\dialogs your stuff? What is your setup.py and can you successfully build a small exe? E.g. the one shown on this wiki http://wiki.wxpython.org/Deployment (needs wxPython) or the one here http://www.py2exe.org/index.cgi/Tutorial ? You might want to post to : py2exe-us...@lists.sourceforge.net Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] MAPI with win32com
I am trying to use MAPI to send an email using win32com, but I get the following exception. from win32com.client import Dispatch s = Dispatch(Mapi.Session) Traceback (most recent call last): File input, line 1, in module File C:\Python25\lib\site-packages\win32com\client\__init__.py, line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Cha\xeene de classe incorrecte', None, None) I first tried this having Thunderbird as my MAPI client, then installed Windows Live Email (I want to test MAPI with one of the newer MS Mail clients) and defined it as the MAPI client (Default Programs - MAPI), still same result. Any hints on what I am doing wrong here would be very much welcomed. I am on Windows 7, Python 2.5.4, py2in32 build 210. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] MAPI with win32com
On 22/03/2010 12:06, Werner F. Bruhin wrote: I am trying to use MAPI to send an email using win32com, but I get the following exception. from win32com.client import Dispatch s = Dispatch(Mapi.Session) Traceback (most recent call last): File input, line 1, in module File C:\Python25\lib\site-packages\win32com\client\__init__.py, line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Cha\xeene de classe incorrecte', None, None) I first tried this having Thunderbird as my MAPI client, then installed Windows Live Email (I want to test MAPI with one of the newer MS Mail clients) and defined it as the MAPI client (Default Programs - MAPI), still same result. Any hints on what I am doing wrong here would be very much welcomed. I am on Windows 7, Python 2.5.4, py2in32 build 210. Werner Just came accross Tim Golden's site (http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html) and tried this: session = win32com.client.gencache.EnsureDispatch (MAPI.Session) But I do get the same exception. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] MAPI with win32com
Tim, Thanks for the quick response. On 22/03/2010 12:26, Tim Golden wrote: On 22/03/2010 11:22, Werner F. Bruhin wrote: On 22/03/2010 12:06, Werner F. Bruhin wrote: I am trying to use MAPI to send an email using win32com, but I get the following exception. from win32com.client import Dispatch s = Dispatch(Mapi.Session) Traceback (most recent call last): File input, line 1, inmodule File C:\Python25\lib\site-packages\win32com\client\__init__.py, line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Cha\xeene de classe incorrecte', None, None) I first tried this having Thunderbird as my MAPI client, then installed Windows Live Email (I want to test MAPI with one of the newer MS Mail clients) and defined it as the MAPI client (Default Programs - MAPI), still same result. Any hints on what I am doing wrong here would be very much welcomed. I am on Windows 7, Python 2.5.4, py2in32 build 210. Werner Just came accross Tim Golden's site (http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html) and tried this: session = win32com.client.gencache.EnsureDispatch (MAPI.Session) But I do get the same exception. Have a look at: http://kb.mozillazine.org/MAPI_Support which explains that TB (like OE) only supports Simple MAPI. There's a whole confusion of terminology around this area, but I'm afraid that the bottom line is: the only client which really supports CDO, ie MAPI.Session is the full Outlook client. It's just about possible to use CDO without installing Outlook (by installing some standalone package whose name escapes me) I found this: http://www.microsoft.com/downloads/details.aspx?FamilyID=E17E7F31-079A-43A9-BFF2-0A110307611Edisplaylang=en At least I get past the above error, will see how far I get with this. but that still only gives you access to Exchange, not to whatever interface TB exposes. Clients and me using TB are fine, I support that with the simplemapi.py (http://www.johnnypops.demon.co.uk/python/simplemapi.py) and it works fine, but clients who use Outlook (e.g. Office 11) get a MAPI error 2 (failure). TJG I don't want to use Outlook, but I like to provide an additional way of sending problem reports from within my application to me (MAPI, smtplib), so hoped that I could use extended MAPI stuff. I guess I just have to get my hands onto an Outlook to be able to test this stuff. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] MAPI with win32com
Hi Malcolm, On 22/03/2010 14:10, pyt...@bdurham.com wrote: Werner, I'm not sure I understand the benefit of being locked into the proprietary and awkward MAPI protocol? Why can't you use industry standard SMTP to send your messages? Simpler and more portable. I already offer the SMTP option, i.e. there are two buttons, one is using smtplib and the other uses MAPI. As Simon pointed out some users don't like that a message is sent where they don't see what is being sent (they actually do in my case as I show the details of the error and on that dialog they click one of the two buttons). Werner Malcolm - Original message - From: Werner F. Bruhinwerner.bru...@free.fr To: python-win32@python.org Date: Mon, 22 Mar 2010 13:40:52 +0100 Subject: Re: [python-win32] MAPI with win32com Tim, Thanks for the quick response. On 22/03/2010 12:26, Tim Golden wrote: On 22/03/2010 11:22, Werner F. Bruhin wrote: On 22/03/2010 12:06, Werner F. Bruhin wrote: I am trying to use MAPI to send an email using win32com, but I get the following exception. from win32com.client import Dispatch s = Dispatch(Mapi.Session) Traceback (most recent call last): File input, line 1, inmodule File C:\Python25\lib\site-packages\win32com\client\__init__.py, line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File C:\Python25\lib\site-packages\win32com\client\dynamic.py, line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Cha\xeene de classe incorrecte', None, None) I first tried this having Thunderbird as my MAPI client, then installed Windows Live Email (I want to test MAPI with one of the newer MS Mail clients) and defined it as the MAPI client (Default Programs - MAPI), still same result. Any hints on what I am doing wrong here would be very much welcomed. I am on Windows 7, Python 2.5.4, py2in32 build 210. Werner Just came accross Tim Golden's site (http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html) and tried this: session = win32com.client.gencache.EnsureDispatch (MAPI.Session) But I do get the same exception. Have a look at: http://kb.mozillazine.org/MAPI_Support which explains that TB (like OE) only supports Simple MAPI. There's a whole confusion of terminology around this area, but I'm afraid that the bottom line is: the only client which really supports CDO, ie MAPI.Session is the full Outlook client. It's just about possible to use CDO without installing Outlook (by installing some standalone package whose name escapes me) I found this: http://www.microsoft.com/downloads/details.aspx?FamilyID=E17E7F31-079A-43A9-BFF2-0A110307611Edisplaylang=en At least I get past the above error, will see how far I get with this. but that still only gives you access to Exchange, not to whatever interface TB exposes. Clients and me using TB are fine, I support that with the simplemapi.py (http://www.johnnypops.demon.co.uk/python/simplemapi.py) and it works fine, but clients who use Outlook (e.g. Office 11) get a MAPI error 2 (failure). TJG I don't want to use Outlook, but I like to provide an additional way of sending problem reports from within my application to me (MAPI, smtplib), so hoped that I could use extended MAPI stuff. I guess I just have to get my hands onto an Outlook to be able to test this stuff. Werner ___ 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
Re: [python-win32] MAPI with win32com
On 22/03/2010 13:58, Tim Golden wrote: [Tim Golden] the only client which really supports CDO, ie MAPI.Session is the full Outlook client. It's just about possible to use CDO without installing Outlook (by installing some standalone package whose name escapes me) [Werner Bruhin] I found this: http://www.microsoft.com/downloads/details.aspx?FamilyID=E17E7F31-079A-43A9-BFF2-0A110307611Edisplaylang=en Yep. Think that's the one. At least I get past the above error, will see how far I get with this. but that still only gives you access to Exchange, not to whatever interface TB exposes. That's really the problem. AFAICT, CDO is *basically* an interface to Exchange via Outlook. You can just about get away without the Outlook bit by installing the download you mention (which presumably includes the necessary bits of Outlook without the front-end). But I don't honestly think you can get away without Exchange. I suspect the idea is that you should be able to. But I'm not aware that anyone's implemented it to the extent that you could. Happy to be wrong. I don't want to use Outlook, but I like to provide an additional way of sending problem reports from within my application to me (MAPI, smtplib), so hoped that I could use extended MAPI stuff. Hmmm. Good luck and keep us posted. The luck run out pretty quickly - get to the logon but then it seems to want an existing profile. So, back on having to get myself a copy of outlook to be able to test this stuff:(. For my understanding, is there some reason you can't simply send via SMTP directly? Do you need the intervening client? I do offer the SMTP option using smtplib which works great, but some clients don't know/like to fill in the configuration stuff needed and others really want to see in their email client of choice the email to go out and it also gives them the record/archive of what has been sent. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] MAPI with win32com
On 22/03/2010 14:28, King Simon-NFHD78 wrote: -Original Message- From: python-win32-bounces+simon.king=motorola@python.org [mailto:python-win32-bounces+simon.king=motorola@python.or g] On Behalf Of pyt...@bdurham.com Sent: 22 March 2010 13:11 To: Werner F. Bruhin; zz Python Win32 Newsgroup Subject: Re: [python-win32] MAPI with win32com Werner, I'm not sure I understand the benefit of being locked into the proprietary and awkward MAPI protocol? Why can't you use industry standard SMTP to send your messages? Simpler and more portable. Malcolm I can't speak for Werner, but I recently had a request from a user of my application for an 'email this project' button on the toolbar, which would create an email message, attach the current project to it, and then allow the user to edit the message body itself. If I use SMTP, I need the user to enter all the SMTP configuration details (host, username, password, TLS etc). The email won't end up in his Sent Items folder. He probably won't be able to use Rich Text or HTML in the email (of course, you could argue that that is a good thing :-) Unfortunately, popping up an Outlook window with the file already attached is just a better user experience. I would love it if there were a way to do this that worked in the user's preferred mail client. If it were cross-platform, that would be even better. At the moment I use 'mailto:' URLs with os.startfile on Windows, and /usr/bin/open on the Mac. These work for opening an email with the To, Subject and message body already filled in, but I don't think there's any way I can attach a file like that. It also doesn't work if the message body is too long, presumably because of command-line length restrictions :-( I used mailto in the past, but I need to attach log files, therefore I switched to using simplemapi.py which works fine except with the newer versions of Outlook (I know that Outlook included with Office 11 has a problem, not sure about others). Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] MAPI with win32com
Hi Mike, On 22/03/2010 14:48, Mike Driscoll wrote: Hi Werner, snip I found this: http://www.microsoft.com/downloads/details.aspx?FamilyID=E17E7F31-079A-43A9-BFF2-0A110307611Edisplaylang=en At least I get past the above error, will see how far I get with this. but that still only gives you access to Exchange, not to whatever interface TB exposes. Clients and me using TB are fine, I support that with the simplemapi.py (http://www.johnnypops.demon.co.uk/python/simplemapi.py) and it works fine, but clients who use Outlook (e.g. Office 11) get a MAPI error 2 (failure). TJG I don't want to use Outlook, but I like to provide an additional way of sending problem reports from within my application to me (MAPI, smtplib), so hoped that I could use extended MAPI stuff. I guess I just have to get my hands onto an Outlook to be able to test this stuff. Werner I found this recipe: http://code.activestate.com/recipes/149461-mapi-send/ That is basically the same thing as I tried, it needs more then the download I mentioned in the other post. Since we dropped Exchange in favor of Zimbra, I cannot test this solution, but maybe it will help you. By the way, is smtplib not working for you? smtplib is working great, but as mentioned before some users prefer using their email client (i.e. see what is going out, have an archive/copy of it ) and MAPI solution if it works (which it does with all kind of software (Thunderbird, older outlook version ) it requires no setup at all in my software. Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Does Python need a native Windows GUI toolkit?
Thomas Heller wrote: Does Python need a native, pure Python, Windows GUI toolkit, one that uses win32 api calls directly to use native windows controls? Or would that development be a waste of resources, in these days of of Python.NET, Windows forms, IronPython, (and last, not least, wxPython and all these other toolkits)? Or are desktop applications too rare now? I would consider it a waste of resources. I use wxPython and if I would change today to something else it would probably be a web/html based tool kit. Why, the only issue I have found with wxPython is that it is too large for devices such as Palm/iPhone/WinMobile. Unless one invests in some professional tools (I am only aware of WinDev, but there must be others) one can not develop one app which runs on these mobile devices and on desktops. Several years ago I started using wxPython (it is probably a lot more mature now) to write some simple programs and was not really pleased. It looked too much like MFC to me. I know that there are now several wrappers over wxPython (althogh I have not used them) like Pythoncard or newer ones like dabo (from what I hear). There have also been other attempts to make nicer interfaces for wxPython which have vanished nowadays. Somehow I have the impression that the approach to put layer over layer over layer is wrong (wxWindows C++ layer, wxPython SWIG layer, Pythoncard/Dabo/whatever python layer). I think that wxPython is doing a very good job for desktop apps, while I see your argument about too many layers I do not think this is that big an issue today. It is much more important to be productive - i.e. to be able to generate a good looking GUI as quickly and easily as possible. Dabo might be a contender for a desktop app, also I have the impression that they are trying to do everything themselves instead of re-using available tools (db layer instead of e.g. sqlalchemy, report designer instead of e.g. Report Manager, logging instead of Python logging, screen designer instead of e.g. XRCed). So, I started writing my own framework, also several years ago. I used ctypes (early versions) to call the win32 api directly, and it was fun and it worked out great. I have my own form editor, I can also construct windows, dialogs, menus, and so on with simple high level code. But also it is possible even at the 'highest level' to directly reach out to the win32 api, or to handle WM_xxx messages directly if the need arises. However, this framework is showing its age because during all this time I developed some new approaches to make the work easier (for example first I wrote the win32 plumbing code manually, now I have tools that automatically generate the code to access constants, define structure definitions, or generate function prototypes from the windows header files. Also the framework too much relies on manual conversions between byte and unicode strings. So, the question is: Are there people that share these ideas? Are they willing to join a coordinated effort to develop a framework like this, using the current and future Python versions, and all the fancy new features of Python? I hope you will find something which will be fun for you and which will improve an existing project. Anyhow, thank you for all the things you have already done for the community like ctypes, py2exe and probably other things I am not aware off! Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Does Python need a native Windows GUI toolkit?
Tony Cappellini wrote: Back to this thread - has anybody used the new pythoncard stuff? What do you mean by the new pythoncard stuff ? Pythoncard has been around for a long time. There seems also be a fork or at least a discussion about doing one. https://sourceforge.net/mailarchive/forum.php?thread_name=20081112123302.GA4443%40dedalo.nexlab.thcforum_name=pythoncard-users I've used it- and it's one of the reasons I now use wxPython directly, without any wrappers. (I didn't like Boa - but it's been a long time since I've tried it) Can only see a question about getting CVS on the Boa list from you (but then my archive might not have everything). Pity that at the time you tried it you did not comment to the Boa or wxPython list of what you did not like about Boa. I am sure Riaan would like to hear about dislikes as that is the only way they might get fixed/changed at some point in the future - unless one provides a patch which is even faster:). Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] py2exe bug with email.MIMEText
Hi Marcus, Marcus.CM wrote: There is a bug with py2exe when (at least under windows) when importing email # example testmime.py import email msg = email.MIMEText.MIMEText(dsafdafdasfA) print ok 1. Save the text above and setup as testmime.py 2. Run it and u can see ok 3. Create setup.py and run : python setup.py py2exe 4. Run the testmime.exe and u will get error Import error : No module name text # Example setup.py from distutils.core import setup import py2exe setup(console=['testmime.py']) Anyone knows the fix for this? I see that you did find a solution for your problem. An alternative solution is to force py2exe to include all of the email package. packages = ['matplotlib.numerix', 'pytz.zoneinfo.UTC', 'email', 'encodings', ... etc] Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] python 2.5
Tarun Kapoor wrote: I want to use python win32 extensions on python 2.5 but it seems like they were built for 2.3… the newer builds are on sourceforge, including ones for Python 2.5 and 2.6. https://sourceforge.net/project/platformdownload.php?group_id=78018 Werner ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32