From vye at vye.me Sat Mar 1 07:35:42 2014 From: vye at vye.me (Vye) Date: Fri, 28 Feb 2014 22:35:42 -0800 Subject: [python-win32] Need help creating a wheel of pywin32 Message-ID: Hi, I have some Python programs running on Windows that require pywin32 to be installed. I want to leverage our CI environment to automatically test and freeze them for me. Our CI uses tox so I need to be able to install pywin32 using pip. I've never built a python package before but after some reading it seems like wheel is the way to go, especially on Windows if you want to avoid compiling each time (and I do). Here's where I get stuck. The PUG relies heavily on being able to install something with pip in order to create your wheel. I've never been able to install pywin32 via pip (no idea why it isn't up there--even if I did need to compile it). Is there a way I can create a wheel by using the prebuilt binaries since they are just zip archives? I would prefer to do it this way. if not... I tried to compile pywin32 so I could build a wheel by running python setup3.py bdist_wheel. However, I can't seem to get 216-218 to compile. I'm using Python 3.3.5rc1 64-bit on W7. Attempt #1 (pywin32-218): 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" 2. python setup3.py build --plat-name=win-amd64 I got this error: win32\src\perfmon\perfmondata.cpp(11) : fatal error C1083: Cannot open include file: 'perfutil.h': No such file or directory error: command '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe"' failed with exit status 2 The entire output has been saved here: http://goo.gl/GqVs6h This seems to be exactly what this open ticket is about: http://sourceforge.net/p/pywin32/bugs/647/ and this user also reported it: http://code.activestate.com/lists/python-win32/12627/ Note: The only thing that looks suspect to me is v6.0A and v7.0A x86 SDK paths when it seems it should be using 7.1 per my MSSDK variable. But as far as I can tell perfutil.h is not part of those SDKs. I was only able to find it in previous releases (217) of pywin32. Attempt #2 (pywin32-217): 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" 2. python setup3.py build --plat-name=win-amd64 I got this error: Building pywin32 3.3.217.0 Traceback (most recent call last): File "setup3.py", line 16, in exec(str(got)) File "", line 2428, in File "", line 2224, in convert_data_files RuntimeError: No files match 'pythonwin\pywin\*.cfg' There are two .cfg files in pywin: default.cfg IDLE.cfg Attempt #3 (pywin32-216): same results as #2. While I am extremely thankful someone wrote pywin32, it is a monster to build. That, and my lack of package building experience doesn't help. I would appreciate some help building a wheel of pywin32 very much! -- -Vye From vye at vye.me Sun Mar 2 09:51:57 2014 From: vye at vye.me (Vye) Date: Sun, 2 Mar 2014 00:51:57 -0800 Subject: [python-win32] Fwd: Need help creating a wheel of pywin32 References: Message-ID: <62A63FC4-4E07-4B2C-BFBF-9B3BFB7DB394@vye.me> It doesn't look like my original email went through. If it did, I apologize for the noise. --Vye Begin forwarded message: > From: Vye > Date: February 28, 2014 at 10:35:42 PM PST > To: python-win32 at python.org > Subject: Need help creating a wheel of pywin32 > > Hi, > > I have some Python programs running on Windows that require pywin32 to > be installed. I want to leverage our CI environment to automatically > test and freeze them for me. Our CI uses tox so I need to be able to > install pywin32 using pip. I've never built a python package before > but after some reading it seems like wheel is the way to go, > especially on Windows if you want to avoid compiling each time (and I > do). > > Here's where I get stuck. The PUG relies heavily on being able to > install something with pip in order to create your wheel. I've never > been able to install pywin32 via pip (no idea why it isn't up > there--even if I did need to compile it). > > Is there a way I can create a wheel by using the prebuilt binaries > since they are just zip archives? I would prefer to do it this way. > > if not... > > I tried to compile pywin32 so I could build a wheel by running python > setup3.py bdist_wheel. However, I can't seem to get 216-218 to > compile. I'm using Python 3.3.5rc1 64-bit on W7. > > Attempt #1 (pywin32-218): > 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" > 2. python setup3.py build --plat-name=win-amd64 > > I got this error: win32\src\perfmon\perfmondata.cpp(11) : fatal error > C1083: Cannot open include file: 'perfutil.h': No such file or > directory > error: command '"c:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\BIN\amd64\cl.exe"' failed with exit status 2 > > The entire output has been saved here: http://goo.gl/GqVs6h > > This seems to be exactly what this open ticket is about: > http://sourceforge.net/p/pywin32/bugs/647/ and this user also reported > it: http://code.activestate.com/lists/python-win32/12627/ > > Note: The only thing that looks suspect to me is v6.0A and v7.0A x86 > SDK paths when it seems it should be using 7.1 per my MSSDK variable. > But as far as I can tell perfutil.h is not part of those SDKs. I was > only able to find it in previous releases (217) of pywin32. > > Attempt #2 (pywin32-217): > 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" > 2. python setup3.py build --plat-name=win-amd64 > > I got this error: Building pywin32 3.3.217.0 > Traceback (most recent call last): > File "setup3.py", line 16, in > exec(str(got)) > File "", line 2428, in > File "", line 2224, in convert_data_files > RuntimeError: No files match 'pythonwin\pywin\*.cfg' > > There are two .cfg files in pywin: default.cfg IDLE.cfg > > Attempt #3 (pywin32-216): > same results as #2. > > While I am extremely thankful someone wrote pywin32, it is a monster > to build. That, and my lack of package building experience doesn't > help. I would appreciate some help building a wheel of pywin32 very > much! > > -- > -Vye -------------- next part -------------- An HTML attachment was scrubbed... URL: From rupole at hotmail.com Sun Mar 2 21:17:45 2014 From: rupole at hotmail.com (Roger Upole) Date: Sun, 2 Mar 2014 15:17:45 -0500 Subject: [python-win32] Need help creating a wheel of pywin32 References: Message-ID: Can you try building from a Mercurial checkout ? Looks like some files aren't being included in the source dist download. Appears that our Manifest.in needs to be updated, as there are also a few other things missing. Roger "Vye" wrote in message news:CAByYAs+du_icYJFzET0dFk0t2HzwayHc_NdwkmLpwdMOH+1xMg at mail.gmail.com... > Hi, > > I have some Python programs running on Windows that require pywin32 to > be installed. I want to leverage our CI environment to automatically > test and freeze them for me. Our CI uses tox so I need to be able to > install pywin32 using pip. I've never built a python package before > but after some reading it seems like wheel is the way to go, > especially on Windows if you want to avoid compiling each time (and I > do). > > Here's where I get stuck. The PUG relies heavily on being able to > install something with pip in order to create your wheel. I've never > been able to install pywin32 via pip (no idea why it isn't up > there--even if I did need to compile it). > > Is there a way I can create a wheel by using the prebuilt binaries > since they are just zip archives? I would prefer to do it this way. > > if not... > > I tried to compile pywin32 so I could build a wheel by running python > setup3.py bdist_wheel. However, I can't seem to get 216-218 to > compile. I'm using Python 3.3.5rc1 64-bit on W7. > > Attempt #1 (pywin32-218): > 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" > 2. python setup3.py build --plat-name=win-amd64 > > I got this error: win32\src\perfmon\perfmondata.cpp(11) : fatal error > C1083: Cannot open include file: 'perfutil.h': No such file or > directory > error: command '"c:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\BIN\amd64\cl.exe"' failed with exit status 2 > > The entire output has been saved here: http://goo.gl/GqVs6h > > This seems to be exactly what this open ticket is about: > http://sourceforge.net/p/pywin32/bugs/647/ and this user also reported > it: http://code.activestate.com/lists/python-win32/12627/ > > Note: The only thing that looks suspect to me is v6.0A and v7.0A x86 > SDK paths when it seems it should be using 7.1 per my MSSDK variable. > But as far as I can tell perfutil.h is not part of those SDKs. I was > only able to find it in previous releases (217) of pywin32. > > Attempt #2 (pywin32-217): > 1. set MSSDK="C:\Program Files\Microsoft SDKs\Windows\v7.1" > 2. python setup3.py build --plat-name=win-amd64 > > I got this error: Building pywin32 3.3.217.0 > Traceback (most recent call last): > File "setup3.py", line 16, in > exec(str(got)) > File "", line 2428, in > File "", line 2224, in convert_data_files > RuntimeError: No files match 'pythonwin\pywin\*.cfg' > > There are two .cfg files in pywin: default.cfg IDLE.cfg > > Attempt #3 (pywin32-216): > same results as #2. > > While I am extremely thankful someone wrote pywin32, it is a monster > to build. That, and my lack of package building experience doesn't > help. I would appreciate some help building a wheel of pywin32 very > much! > > -- > -Vye From rupole at hotmail.com Sun Mar 2 21:33:59 2014 From: rupole at hotmail.com (Roger Upole) Date: Sun, 2 Mar 2014 15:33:59 -0500 Subject: [python-win32] win32api & win32gui help References: Message-ID: Where does the hardcoded 99999 come from in this line ? win32api.PostMessage(hwnd,message,1,99999) If I'm interpreting the docs correctly, that parm should be a handle to a top-level window you create yourself that receives messages from the app. Also, you'll need to be running a message loop to receive messages (see win32gui.PumpMessages). Roger "Joe Bennett" wrote in message news:CAD+1-4-_COysP3H1GFgeF4dH3rgVr3u4aVk4zqhiYeNU5ABOkQ at mail.gmail.com... > Hi, > > Looking for a good simple remedial course on getting my python script > to talk to a Windows program. The author of the windows program has > documented the api here: > > http://www.logger32.net/help/Logger32/Using%20the%20Logger32%20External%20Interface.htm > > > I'm struggling to understand how to implement the messages with > win32api/ gui... I've taken a stab at it here based on my searching > the web with my first goal being that I just want to 'register' with > the program and receive the response > from it. So far I'm still scratching my head over this... > > I get a response for 'hwnd' but have not been able to get any > confirmation that RegisterMessage, PostMessage and GetMessage are > working, configured properly or...what... > > Running this all in WIN7 with ActivePython 2.6.6... > > > import win32api > import win32gui > > hwnd = win32gui.FindWindowEx(0, 0, 0, "Logger32") > > > print "hwnd= ", hwnd > > message = win32api.RegisterWindowMessage("Logger32 3") > > > win32api.PostMessage(hwnd,message,1,99999) > > test = win32gui.GetMessage(hwnd,0,0) > > print "GetMessage: ", test > > > > Thanks!!!! > > > -Joe > KA3NAM From skippy.hammond at gmail.com Mon Mar 3 01:18:45 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 03 Mar 2014 11:18:45 +1100 Subject: [python-win32] Need help creating a wheel of pywin32 In-Reply-To: References: Message-ID: <5313CA65.8010608@gmail.com> On 1/03/2014 5:35 PM, Vye wrote: > Is there a way I can create a wheel by using the prebuilt binaries > since they are just zip archives? I would prefer to do it this way. For your purposes, just extracting (via zip) the files in the pre-built binaries should get you going. Depending on exactly what you are doing with pywin32, it might be necessary to run "pywin32_postinstall.py -install" as well. It shouldn't be too hard to automate this. HTH, Mark From timr at probo.com Mon Mar 3 20:37:43 2014 From: timr at probo.com (Tim Roberts) Date: Mon, 3 Mar 2014 11:37:43 -0800 Subject: [python-win32] win32api & win32gui help In-Reply-To: References: Message-ID: <5314DA07.9020409@probo.com> Joe Bennett wrote: > Looking for a good simple remedial course on getting my python script > to talk to a Windows program. The author of the windows program has > documented the api here: > > http://www.logger32.net/help/Logger32/Using%20the%20Logger32%20External%20Interface.htm To use this API, you have to BE a Windows application, with at least one window and a message loop. You cannot call this from a console application. > I get a response for 'hwnd' but have not been able to get any > confirmation that RegisterMessage, PostMessage and GetMessage are > working, configured properly or...what... > > Running this all in WIN7 with ActivePython 2.6.6... > > import win32api > import win32gui > > hwnd = win32gui.FindWindowEx(0, 0, 0, "Logger32") > print "hwnd= ", hwnd > > message = win32api.RegisterWindowMessage("Logger32 3") > win32api.PostMessage(hwnd,message,1,99999) That much is probably working just fine. You're registering a window message and getting a handle. But, as Roger pointed out, you need to tell it YOUR window handle to the logging application, so it can send information to you. You're passing a made-up number, which won't work. > test = win32gui.GetMessage(hwnd,0,0) > print "GetMessage: ", test This is not right. GetMessage is used to get messages that have been send to your OWN windows. In this case, you're giving it the handle of a window that belongs to another process. You can do this with a hidden window -- it doesn't have to be visible. Basically, you call RegisterClass and CreateWindow to create the window, then run a message loop with PumpWaitingMessages. In the PyWin32 distribution, go look for win32ui_devicenotify.py. That is a sample application that creates a hidden window in order to catch PnP notifications. You can yank out the most of the code and use the shell. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From A.Holtz at gmx.net Mon Mar 3 22:14:03 2014 From: A.Holtz at gmx.net (Andreas Holtz) Date: Mon, 03 Mar 2014 22:14:03 +0100 Subject: [python-win32] Printing PDFs without external tools Message-ID: <5314F09B.20105@gmx.net> Hi guys, I need want to print PDF files without the usage of tools like Adobe, Foxit, etc. THe printer does understand PDF files, but I have no idea how to do it. I played around with win32api.ShellExecute(0, "print", pdf, None, ".", 0) but I am missing the possibilities to change layout and paper size. I already checked out http://timgolden.me.uk/python/win32_how_do_i/print.html Is there really no way to print PDFs with Python setting whatever print settings I want? I thought Python can do anything... :'-( Thanks in advance Andreas From mc at mclaveau.com Mon Mar 3 23:32:30 2014 From: mc at mclaveau.com (mc@mclaveau) Date: Mon, 03 Mar 2014 23:32:30 +0100 Subject: [python-win32] Printing PDFs without external tools In-Reply-To: <5314F09B.20105@gmx.net> References: <5314F09B.20105@gmx.net> Message-ID: <531502FE.8080502@mclaveau.com> Hi! PDF files are text files. If you use the "print" command, you will print the source of PDF. If you want another aspect, you need a render (Adobe-reader, Sumatra-PDF, etc.) I suggest Sumatra-PDF : http://blog.kowalczyk.info/software/sumatrapdf/manual-fr.html (search for "*-print-to-default*" and next) @-salutations & *sorry for my bad english* -- Michel Claveau Le 03.03.14 22:14, Andreas Holtz a ?crit : > Hi guys, > > I need want to print PDF files without the usage of tools like Adobe, > Foxit, etc. > THe printer does understand PDF files, but I have no idea how to do it. > I played around with > > win32api.ShellExecute(0, "print", pdf, None, ".", 0) > > but I am missing the possibilities to change layout and paper size. > > I already checked out > http://timgolden.me.uk/python/win32_how_do_i/print.html > > Is there really no way to print PDFs with Python setting whatever > print settings I want? > I thought Python can do anything... :'-( > > Thanks in advance > > Andreas > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Mar 4 05:52:21 2014 From: timr at probo.com (Tim Roberts) Date: Mon, 3 Mar 2014 20:52:21 -0800 Subject: [python-win32] Printing PDFs without external tools In-Reply-To: <5314F09B.20105@gmx.net> References: <5314F09B.20105@gmx.net> Message-ID: <58B7443C-25B6-418D-9FFE-9E00274C5766@probo.com> On Mar 3, 2014, at 1:14 PM, Andreas Holtz wrote: > > I need want to print PDF files without the usage of tools like Adobe, Foxit, etc. > THe printer does understand PDF files, but I have no idea how to do it. I doubt that. PDFs contain PostScript, but there?s more to it than just PostScript. What printer, exactly are you talking about? > I played around with > win32api.ShellExecute(0, "print", pdf, None, ".", 0) > but I am missing the possibilities to change layout and paper size. That function will run whatever program is registered to render PDF files, which is usually the Acrobat Reader, and asks that it to print without presenting a dialog > Is there really no way to print PDFs with Python setting whatever print settings I want? > I thought Python can do anything... :?-( Python can do anything, but Python is not always the EASIEST way to do something. In this case, you have encountered limitations of the Win32 API, not of Python. The Acrobat Reader can be controlled via COM to set layout and paper size, but I want to find out what your printer is before going any deeper. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From A.Holtz at gmx.net Tue Mar 4 07:47:13 2014 From: A.Holtz at gmx.net (Andreas Holtz) Date: Tue, 04 Mar 2014 07:47:13 +0100 Subject: [python-win32] Printing PDFs without external tools In-Reply-To: <58B7443C-25B6-418D-9FFE-9E00274C5766@probo.com> References: <5314F09B.20105@gmx.net> <58B7443C-25B6-418D-9FFE-9E00274C5766@probo.com> Message-ID: <531576F1.10602@gmx.net> Hi Tim, the printer I want to use is a HP 5550DTN. The specifications can be found here: http://h20195.www2.hp.com/V2/GetPDF%2Easpx%2F5982%2D6714EEE%2Epdf On page 2 under printer languages "PDF 1.3" is written. Therefore I think I can print PDFs without the use of Adobe or any other 3rd party software (like Ghostscript). But I don't know how... Thanks Andreas schrieb Tim Roberts am 04.03.2014 05:52: > On Mar 3, 2014, at 1:14 PM, Andreas Holtz wrote: >> >> I need want to print PDF files without the usage of tools like Adobe, Foxit, etc. >> THe printer does understand PDF files, but I have no idea how to do it. > > I doubt that. PDFs contain PostScript, but there?s more to it than just PostScript. What printer, exactly are you talking about? > > >> I played around with >> win32api.ShellExecute(0, "print", pdf, None, ".", 0) >> but I am missing the possibilities to change layout and paper size. > > That function will run whatever program is registered to render PDF files, which is usually the Acrobat Reader, and asks that it to print without presenting a dialog > > >> Is there really no way to print PDFs with Python setting whatever print settings I want? >> I thought Python can do anything... :?-( > > Python can do anything, but Python is not always the EASIEST way to do something. In this case, you have encountered limitations of the Win32 API, not of Python. The Acrobat Reader can be controlled via COM to set layout and paper size, but I want to find out what your printer is before going any deeper. > From timr at probo.com Tue Mar 4 18:35:50 2014 From: timr at probo.com (Tim Roberts) Date: Tue, 4 Mar 2014 09:35:50 -0800 Subject: [python-win32] Printing PDFs without external tools In-Reply-To: <531576F1.10602@gmx.net> References: <5314F09B.20105@gmx.net> <58B7443C-25B6-418D-9FFE-9E00274C5766@probo.com> <531576F1.10602@gmx.net> Message-ID: <53160EF6.4030903@probo.com> Andreas Holtz wrote: > the printer I want to use is a HP 5550DTN. > The specifications can be found here: > http://h20195.www2.hp.com/V2/GetPDF%2Easpx%2F5982%2D6714EEE%2Epdf > On page 2 under printer languages "PDF 1.3" is written. I should not have doubted you. ;) > Therefore I think I can print PDFs without the use of Adobe or any other 3rd party software (like Ghostscript). > But I don't know how... To do this, you will not go through the normal printing services. You need to send the PDF files directly to the printer as if it were a file server. The printer serves HTTP and FTP, and that's how you'll get the PDF files in there. You won't get fancy options like layout and paper size. To get that level of control, you'll need to use a printer driver, and that means using PDF rendering software on the PC. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jacob at blindza.co.za Wed Mar 5 04:33:24 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 5 Mar 2014 05:33:24 +0200 Subject: [python-win32] Getting an app to run from/in the windows system tray Message-ID: <833C77479DCF454EBB8E13088016884A@JakePC> In other words, would like to be able to hide the main part of the interface, and display an icon in the windows system tray, which then either offers a context menu, or else just re-displays the main part of the interface when you double-click on the system tray icon? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Wed Mar 5 08:26:27 2014 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 05 Mar 2014 18:26:27 +1100 Subject: [python-win32] Getting an app to run from/in the windows system tray In-Reply-To: <833C77479DCF454EBB8E13088016884A@JakePC> References: <833C77479DCF454EBB8E13088016884A@JakePC> Message-ID: <5316D1A3.4060303@gmail.com> Check out win32\Demos\win32gui_taskbar.py - it shows how to do the taskbar thing. As far as "hiding the main part of the interface", you just close those windows after creating the taskbar icon. On 5/03/2014 2:33 PM, Jacob Kruger wrote: > In other words, would like to be able to hide the main part of the > interface, and display an icon in the windows system tray, which then > either offers a context menu, or else just re-displays the main part of > the interface when you double-click on the system tray icon? > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From jacob at blindza.co.za Wed Mar 5 09:59:35 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 5 Mar 2014 10:59:35 +0200 Subject: [python-win32] Getting an app to run from/in the windows system tray In-Reply-To: <5316D1A3.4060303@gmail.com> References: <833C77479DCF454EBB8E13088016884A@JakePC> <5316D1A3.4060303@gmail.com> Message-ID: Thanks - will check it out, and, it seems to pretty much do what I want if I just run it. Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: "Mark Hammond" To: "Jacob Kruger" ; Sent: Wednesday, 05 March, 2014 9:26 AM Subject: Re: [python-win32] Getting an app to run from/in the windows system tray > Check out win32\Demos\win32gui_taskbar.py - it shows how to do the taskbar > thing. As far as "hiding the main part of the interface", you just close > those windows after creating the taskbar icon. > > On 5/03/2014 2:33 PM, Jacob Kruger wrote: >> In other words, would like to be able to hide the main part of the >> interface, and display an icon in the windows system tray, which then >> either offers a context menu, or else just re-displays the main part of >> the interface when you double-click on the system tray icon? >> TIA >> >> Jacob Kruger >> Blind Biker >> Skype: BlindZA >> "Roger Wilco wants to welcome you...to the space janitor's closet..." >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > > From alan.gauld at btinternet.com Wed Mar 5 13:27:04 2014 From: alan.gauld at btinternet.com (Alan Gauld) Date: Wed, 05 Mar 2014 12:27:04 +0000 Subject: [python-win32] Windows automation basics Message-ID: After a long absence(~10 years!) I'm now back to programming in Windows. I need to automate some workflows using COM to various applications (mixture of in-house and commercial). I'm having problems finding out which apps even support COM access and figuring out what COM objects/methods exist. I seem to recall back in my Delphi days that there were explorer tools for discovering some of this (WindowsSpy was maybe one?) So the questions are: 1) How can I determine whether an application has a COM interface in the first place? 2) If it exists, how to I figure out what it supports? 3) Any recommended web sites for COM automation (not necessarily in Python but that would be ideal) And for interest only, where is COM in the world of .NET and Windows 8+ etc? Are there better options today? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos From rupole at hotmail.com Wed Mar 5 21:24:37 2014 From: rupole at hotmail.com (Roger Upole) Date: Wed, 5 Mar 2014 15:24:37 -0500 Subject: [python-win32] Printing PDFs without external tools References: <5314F09B.20105@gmx.net> Message-ID: You may be able to call win32print.SetPrinter to change the paper orientation and size before calling ShellExecute. Roger "Andreas Holtz" wrote in message news:5314F09B.20105 at gmx.net... > Hi guys, > > I need want to print PDF files without the usage of tools like Adobe, Foxit, etc. > THe printer does understand PDF files, but I have no idea how to do it. > I played around with > > win32api.ShellExecute(0, "print", pdf, None, ".", 0) > > but I am missing the possibilities to change layout and paper size. > > I already checked out > http://timgolden.me.uk/python/win32_how_do_i/print.html > > Is there really no way to print PDFs with Python setting whatever print settings I want? > I thought Python can do anything... :'-( > > Thanks in advance > > Andreas From A.Holtz at gmx.net Wed Mar 5 21:34:14 2014 From: A.Holtz at gmx.net (Andreas Holtz) Date: Wed, 05 Mar 2014 21:34:14 +0100 Subject: [python-win32] Windows automation basics In-Reply-To: References: Message-ID: <53178A46.9030500@gmx.net> Hi Alan, 1.) Try to get the documentation of the program. ;-) Or check the registry by searching for "YourApplication.Application" or just try it with win32com.client.Dispatch("YourApplication.Application") in Python with win32com installed. Checkout MakePy from PythonWin (installs with the win32com, I think) as described here: http://oreilly.com/catalog/pythonwin32/chapter/ch12.html Also you can use the VB-Editor from Office to determine available libraries. In Word/Excel press ALt+F11, then Extras/Links. And check if the program has a macro recorder. If the code looks like VB it is quite likely to have something, I asume. 2.) Read the documentation of the program *again* or see at 3.) 3.) Programming against COM in Python is quite straightforward. Look how it is done in VB then make it identical (but nicely) in Python. Sometimes there are some quirks (like when functions in VB work as setters foo.bar() = newValue), but win32com offers often solutions for this (in the example Python creates a setter, if I remember correctly) For Office checkout the Microsoft website. I have to admit its a pain in the ass to find something there, but I eventually got the Word reference as an example: http://msdn.microsoft.com/en-us/library/office/ff837519%28v=office.15%29.aspx Same works with other Microsoft products and probably for most commercial products with COM support. Your last questions I can't answer. Hope this helps. Andreas schrieb Alan Gauld am 05.03.2014 13:27: > After a long absence(~10 years!) I'm now back to programming > in Windows. I need to automate some workflows using COM to > various applications (mixture of in-house and commercial). > > I'm having problems finding out which apps even support > COM access and figuring out what COM objects/methods exist. > > I seem to recall back in my Delphi days that there were > explorer tools for discovering some of this (WindowsSpy > was maybe one?) > > So the questions are: > > 1) How can I determine whether an application has a COM > interface in the first place? > > 2) If it exists, how to I figure out what it supports? > > 3) Any recommended web sites for COM automation (not > necessarily in Python but that would be ideal) > > And for interest only, where is COM in the world > of .NET and Windows 8+ etc? Are there better options > today? > From A.Holtz at gmx.net Wed Mar 5 22:58:21 2014 From: A.Holtz at gmx.net (Andreas Holtz) Date: Wed, 05 Mar 2014 22:58:21 +0100 Subject: [python-win32] Printing PDFs without external tools In-Reply-To: <53160EF6.4030903@probo.com> References: <5314F09B.20105@gmx.net> <58B7443C-25B6-418D-9FFE-9E00274C5766@probo.com> <531576F1.10602@gmx.net> <53160EF6.4030903@probo.com> Message-ID: <53179DFD.5080204@gmx.net> schrieb Tim Roberts am 04.03.2014 18:35: > I should not have doubted you. ;) He be pardoned! :-D > To do this, you will not go through the normal printing services. You > need to send the PDF files directly to the printer as if it were a file > server. The printer serves HTTP and FTP, and that's how you'll get the > PDF files in there. Yay! > You won't get fancy options like layout and paper > size. To get that level of control, you'll need to use a printer > driver, and that means using PDF rendering software on the PC. Not "yay" anymore :-( Still I will follow this idea a little more. Thanks a lot :-) Andreas From greg.ewing at canterbury.ac.nz Thu Mar 6 00:23:19 2014 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Thu, 06 Mar 2014 12:23:19 +1300 Subject: [python-win32] Windows automation basics In-Reply-To: References: Message-ID: <5317B1E7.4010000@canterbury.ac.nz> Alan Gauld wrote: > And for interest only, where is COM in the world > of .NET and Windows 8+ etc? Are there better options > today? As far as I understand, not always. If the functionality you're after happens to exist in the form of a .NET library, and you're willing to use a .NET-compatible language, you can access it directly, but otherwise you still need to go through COM. As for discovering an app's COM interface, if any, I think the only way to find out in general is to read the app's documentation. It's possible for an app to make its COM interface introspectable, but not every app does that. -- Greg From habahut at gmail.com Tue Mar 11 04:35:17 2014 From: habahut at gmail.com (Trevor Haba) Date: Mon, 10 Mar 2014 20:35:17 -0700 Subject: [python-win32] Control Volume on Windows Message-ID: I'm looking for a way to use python to change the volume on windows. After some googling the best I could come up with was this script I got from a relatively ancient entry on this mailing list (I think it was from 2005 or something). I'm using windows 7, and I would like it to work on windows 8 if possible, though its not necessary. I don't need to support any previous versions of windows. Here is the code: #!/usr/bin/env python #Boa:PyApp:main modules = {} import ctypes mixerSetControlDetails = ( ctypes.windll.winmm.mixerSetControlDetails) mixerGetControlDetails = ( ctypes.windll.winmm.mixerGetControlDetailsA) # Some constants MIXER_OBJECTF_MIXER = 0 # mmsystem.h VOLUME_CONTROL_ID = 1 # Same on all machines? SPEAKER_LINE_FADER_ID = 1 # "Identifier in OID value does not resolve to a positive integer" MINIMUM_VOLUME = 0 # fader control (MSDN Library) MAXIMUM_VOLUME = 65535 # fader control (MSDN Library) class MIXERCONTROLDETAILS(ctypes.Structure): _pack_ = 1 _fields_ = [('cbStruct', ctypes.c_ulong), ('dwControlID', ctypes.c_ulong), ('cChannels', ctypes.c_ulong), ('cMultipleItems', ctypes.c_ulong), ('cbDetails', ctypes.c_ulong), ('paDetails', ctypes.POINTER(ctypes.c_ulong))] def setVolume(volume): """Set the speaker volume on the 'Volume Control' mixer""" if not (MINIMUM_VOLUME <= volume <= MAXIMUM_VOLUME): raise ValueError, "Volume out of range" cd = MIXERCONTROLDETAILS(ctypes.sizeof(MIXERCONTROLDETAILS), SPEAKER_LINE_FADER_ID, 1, 0, ctypes.sizeof(ctypes.c_ulong), ctypes.pointer(ctypes.c_ulong(volume))) ret = mixerSetControlDetails(VOLUME_CONTROL_ID, ctypes.byref(cd), MIXER_OBJECTF_MIXER) if ret != 0: print WindowsError, "Error %d while setting volume" % ret ret = mixerGetControlDetails(VOLUME_CONTROL_ID, ctypes.byref(cd), MIXER_OBJECTF_MIXER) if ret != 0: print WindowsError, "Error %d while setting volume" % ret else: print 'cbStruct', cd.cbStruct print 'dwControlID', cd.dwControlID print 'cChannels', cd.cChannels print 'cMultipleItems', cd.cMultipleItems print 'cbDetails', cd.cbDetails print 'paDetails', cd.paDetails.contents return #setVolume((2**16-1)/2) setVolume(0) ## added by me, neither value does anything If I run this, the ret value is 0 and it prints out all the data from the cd struct. But it doesn't change the volume at all. If I change the SPEAKER_LINE_FADER_ID to 0 the program crashes with: windows error 1025 - error setting the volume. I've tried googling that error, winmm, ctypes.windll, and a bunch of other things but I seem unable to find any resources with any information at all. The original poster of this script said the constants might need to be changed, and that finding the right constants could "take some work" but never elaborated on how to actually do it. I've looked at the relevant MSDN C++ docs that windows provides, and while they are somewhat informative I would really like to keep this project to python only. I have been unable to find much of any documentation on pywin32 itself. Is it hidden somewhere? Anyone have any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Mar 11 18:03:44 2014 From: timr at probo.com (Tim Roberts) Date: Tue, 11 Mar 2014 10:03:44 -0700 Subject: [python-win32] Control Volume on Windows In-Reply-To: References: Message-ID: <531F41F0.8060005@probo.com> Trevor Haba wrote: > I'm looking for a way to use python to change the volume on windows. > After some googling the best I could come up with was this script I > got from a relatively ancient entry on this mailing list (I think it > was from 2005 or something). I'm using windows 7, and I would like it > to work on windows 8 if possible, though its not necessary. I don't > need to support any previous versions of windows. Alas, the news is not good. The simple and easy-to-use winmm APIs are no longer supported. They still work in many cases, but the mapping from the winmm device numbering to the new audio API device numbering is mysterious, as you have learned, and there is no good recipe to find them that works on every system. The "blessed" method of adjusting the volume in the Vista-and-beyond audio world requires the use of COM. You fetch an IMMDeviceEnumerator interface, use that to fetch an IMMDevice for your device, then fetch an IAudioEndpoint interface and call SetMasterVolumeLevel to adjust the volume. That's not really very much code in C++ terms, BUT none of those interfaces have late-binding support, which means Python cannot use them. So, your only real choice is to write a Python extension in C++. Fortunately, using , that's not as hard as it used to be. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From wernerfbd at gmx.ch Tue Mar 11 18:17:39 2014 From: wernerfbd at gmx.ch (Werner) Date: Tue, 11 Mar 2014 18:17:39 +0100 Subject: [python-win32] win32api on Windows 8 Message-ID: <531F4533.4010800@gmx.ch> Hi, I sent this to "pywin32-bugs at 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 "", line 1, in 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 From vernondcole at gmail.com Tue Mar 11 19:43:23 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Tue, 11 Mar 2014 19:43:23 +0100 Subject: [python-win32] win32api on Windows 8 In-Reply-To: <531F4533.4010800@gmx.ch> References: <531F4533.4010800@gmx.ch> Message-ID: 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\vernon>py > 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? -- Vernon Cole On Tue, Mar 11, 2014 at 6:17 PM, Werner wrote: > Hi, > > I sent this to "pywin32-bugs at 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 "", line 1, in > 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 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andrew.MacIntyre at acma.gov.au Wed Mar 12 00:24:32 2014 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Tue, 11 Mar 2014 23:24:32 +0000 Subject: [python-win32] Control Volume on Windows [SEC=UNCLASSIFIED] Message-ID: >Trevor Haba wrote: >> I'm looking for a way to use python to change the volume on windows. >> After some googling the best I could come up with was this script I >> got from a relatively ancient entry on this mailing list (I think it >> was from 2005 or something). I'm using windows 7, and I would like it > >> to work on windows 8 if possible, though its not necessary. I don't >> need to support any previous versions of windows. To which Tim Roberts replied: > Alas, the news is not good. > > The simple and easy-to-use winmm APIs are no longer supported. They > still work in many cases, but the mapping from the winmm device > numbering to the new audio API device numbering is mysterious, as you > have learned, and there is no good recipe to find them that works on > every system. > > The "blessed" method of adjusting the volume in the Vista-and-beyond > audio world requires the use of COM. You fetch an IMMDeviceEnumerator > interface, use that to fetch an IMMDevice for your device, then fetch an > IAudioEndpoint interface and call SetMasterVolumeLevel to adjust the > volume. That's not really very much code in C++ terms, BUT none of those > interfaces have late-binding support, which means Python cannot use them. I think that comtypes (https://pypi.python.org/pypi/comtypes) can deal with early binding interfaces? -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre Operations and Services Branch tel: +61 2 6219 5356 Communications Infrastructure Division fax: +61 2 6219 5347 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au http://www.acma.gov.au/ NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. From wernerfbd at gmx.ch Wed Mar 12 08:25:17 2014 From: wernerfbd at gmx.ch (Werner) Date: Wed, 12 Mar 2014 08:25:17 +0100 Subject: [python-win32] win32api on Windows 8 In-Reply-To: References: <531F4533.4010800@gmx.ch> Message-ID: 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\vernon>py > 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 From wernerfbd at gmx.ch Wed Mar 12 11:14:09 2014 From: wernerfbd at gmx.ch (Werner) Date: Wed, 12 Mar 2014 11:14:09 +0100 Subject: [python-win32] win32api on Windows 8 In-Reply-To: References: <531F4533.4010800@gmx.ch> Message-ID: 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\vernon>py >> 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 From wernerfbd at gmx.ch Wed Mar 12 11:36:21 2014 From: wernerfbd at gmx.ch (Werner) Date: Wed, 12 Mar 2014 11:36:21 +0100 Subject: [python-win32] win32api on Windows 8 In-Reply-To: References: <531F4533.4010800@gmx.ch> Message-ID: 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 From timr at probo.com Wed Mar 12 19:07:38 2014 From: timr at probo.com (Tim Roberts) Date: Wed, 12 Mar 2014 11:07:38 -0700 Subject: [python-win32] Control Volume on Windows [SEC=UNCLASSIFIED] In-Reply-To: References: Message-ID: <5320A26A.6060701@probo.com> Andrew MacIntyre wrote: >> Trevor Haba wrote: >>> I'm looking for a way to use python to change the volume on windows. >>> After some googling the best I could come up with was this script I >>> got from a relatively ancient entry on this mailing list (I think it >>> was from 2005 or something). I'm using windows 7, and I would like it >>> to work on windows 8 if possible, though its not necessary. I don't >>> need to support any previous versions of windows. > To which Tim Roberts replied: >> Alas, the news is not good. > I think that comtypes (https://pypi.python.org/pypi/comtypes) can deal with early binding interfaces? You are quite right, and the attached script does it. NOTE! that I have not correctly defined all of the IMM interfaces for the general case; I've only created enough of them to make this particular example work. On my Win 7 machine, this is able to fetch the default endpoint, display the volume range (from -65.25 to 0 in steps of 0.75) and change the setting. I'm glad you brought this up. I've never played with comtypes before, and this was a revealing exercise. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- import win32com from comtypes import * import comtypes.client from ctypes import POINTER from ctypes.wintypes import DWORD, BOOL MMDeviceApiLib = \ GUID('{2FDAAFA3-7523-4F66-9957-9D5E7FE698F6}') IID_IMMDevice = \ GUID('{D666063F-1587-4E43-81F1-B948E807363F}') IID_IMMDeviceEnumerator = \ GUID('{A95664D2-9614-4F35-A746-DE8DB63617E6}') CLSID_MMDeviceEnumerator = \ GUID('{BCDE0395-E52F-467C-8E3D-C4579291692E}') IID_IMMDeviceCollection = \ GUID('{0BD7A1BE-7A1A-44DB-8397-CC5392387B5E}') IID_IAudioEndpointVolume = \ GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}') class IMMDeviceCollection(IUnknown): _iid_ = GUID('{0BD7A1BE-7A1A-44DB-8397-CC5392387B5E}') pass class IAudioEndpointVolume(IUnknown): _iid_ = GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}') _methods_ = [ STDMETHOD(HRESULT, 'RegisterControlChangeNotify', []), STDMETHOD(HRESULT, 'UnregisterControlChangeNotify', []), STDMETHOD(HRESULT, 'GetChannelCount', []), COMMETHOD([], HRESULT, 'SetMasterVolumeLevel', (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'SetMasterVolumeLevelScalar', (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'GetMasterVolumeLevel', (['out','retval'], POINTER(c_float), 'pfLevelDB') ), COMMETHOD([], HRESULT, 'GetMasterVolumeLevelScalar', (['out','retval'], POINTER(c_float), 'pfLevelDB') ), COMMETHOD([], HRESULT, 'SetChannelVolumeLevel', (['in'], DWORD, 'nChannel'), (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'SetChannelVolumeLevelScalar', (['in'], DWORD, 'nChannel'), (['in'], c_float, 'fLevelDB'), (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'GetChannelVolumeLevel', (['in'], DWORD, 'nChannel'), (['out','retval'], POINTER(c_float), 'pfLevelDB') ), COMMETHOD([], HRESULT, 'GetChannelVolumeLevelScalar', (['in'], DWORD, 'nChannel'), (['out','retval'], POINTER(c_float), 'pfLevelDB') ), COMMETHOD([], HRESULT, 'SetMute', (['in'], BOOL, 'bMute'), (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'GetMute', (['out','retval'], POINTER(BOOL), 'pbMute') ), COMMETHOD([], HRESULT, 'GetVolumeStepInfo', (['out','retval'], POINTER(c_float), 'pnStep'), (['out','retval'], POINTER(c_float), 'pnStepCount'), ), COMMETHOD([], HRESULT, 'VolumeStepUp', (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'VolumeStepDown', (['in'], POINTER(GUID), 'pguidEventContext') ), COMMETHOD([], HRESULT, 'QueryHardwareSupport', (['out','retval'], POINTER(DWORD), 'pdwHardwareSupportMask') ), COMMETHOD([], HRESULT, 'GetVolumeRange', (['out','retval'], POINTER(c_float), 'pfMin'), (['out','retval'], POINTER(c_float), 'pfMax'), (['out','retval'], POINTER(c_float), 'pfIncr') ), ] class IMMDevice(IUnknown): _iid_ = GUID('{D666063F-1587-4E43-81F1-B948E807363F}') _methods_ = [ COMMETHOD([], HRESULT, 'Activate', (['in'], POINTER(GUID), 'iid'), (['in'], DWORD, 'dwClsCtx'), (['in'], POINTER(DWORD), 'pActivationParans'), (['out','retval'], POINTER(POINTER(IAudioEndpointVolume)), 'ppInterface') ), STDMETHOD(HRESULT, 'OpenPropertyStore', []), STDMETHOD(HRESULT, 'GetId', []), STDMETHOD(HRESULT, 'GetState', []) ] pass class IMMDeviceEnumerator(comtypes.IUnknown): _iid_ = GUID('{A95664D2-9614-4F35-A746-DE8DB63617E6}') _methods_ = [ COMMETHOD([], HRESULT, 'EnumAudioEndpoints', (['in'], DWORD, 'dataFlow'), (['in'], DWORD, 'dwStateMask'), (['out','retval'], POINTER(POINTER(IMMDeviceCollection)), 'ppDevices') ), COMMETHOD([], HRESULT, 'GetDefaultAudioEndpoint', (['in'], DWORD, 'dataFlow'), (['in'], DWORD, 'role'), (['out','retval'], POINTER(POINTER(IMMDevice)), 'ppDevices') ) ] enumerator = comtypes.CoCreateInstance( CLSID_MMDeviceEnumerator, IMMDeviceEnumerator, comtypes.CLSCTX_INPROC_SERVER ) print enumerator endpoint = enumerator.GetDefaultAudioEndpoint( 0, 1 ) print endpoint volume = endpoint.Activate( IID_IAudioEndpointVolume, comtypes.CLSCTX_INPROC_SERVER, None ) print volume print volume.GetMasterVolumeLevel() print volume.GetVolumeRange() volume.SetMasterVolumeLevel(-20.0, None) From habahut at gmail.com Fri Mar 14 06:39:00 2014 From: habahut at gmail.com (Trevor Haba) Date: Thu, 13 Mar 2014 22:39:00 -0700 Subject: [python-win32] (no subject) Message-ID: Woah, awesome. Thanks Tim!. Since this is for a personal side project I would never have spent enough time to get that working. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Tue Mar 18 06:14:54 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Tue, 18 Mar 2014 07:14:54 +0200 Subject: [python-win32] Simple audio recording Message-ID: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> Am playing around with a bit of a personal assistant app, that includes letting people record smallish audio notes/sound clips, etc., and am currently using pyAudio to handle recording - relatively simple/easy, etc., but, one small issue seems to be that if I use something like winsound to beep just before start recording, to sort of notify user that recording is about to start, this seems to possibly cause input/output stream issues. In other words, possible to avoid/work around, but, just wondering what guys would recommend looking into for simple little bits of audio recording of sound clips, etc.? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Tue Mar 18 06:55:27 2014 From: mc at mclaveau.com (mc@mclaveau) Date: Tue, 18 Mar 2014 06:55:27 +0100 Subject: [python-win32] Simple audio recording In-Reply-To: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> Message-ID: <5327DFCF.5060800@mclaveau.com> Hi! The exampl below run OK on my Win.7 with Python 2.7 + pywin32. @+ -- ------------------------------------------------------------------------ # -*- coding: utf-8 -*- import time,os from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: # There was an error return errorcode, self.get_error(errorcode) else: # commande returned 0 return errorcode,buffer.value def get_error(self,error): """Given an error code, will return a description of the error.""" error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) def record(self): print"Record" self.directsend('open new type waveaudio alias toto') self.directsend('Set toto time format milliseconds') self.directsend('set toto bitspersample 8') # 8 bits ou 16 bits self.directsend('set toto samplespersec 11025') # 11025 low quality 22050 medium quality 44100 high quality (CD) self.directsend('set toto channels 1') # 1 mono 2 stereo self.directsend('record toto') time.sleep(0.1) def finrecord(self, nomfichier): self.directsend('stop toto') self.directsend('save toto '+nomfichier) self.directsend('close toto') #self.directsend('delete toto') def play(self, nomfichier): self.directsend('open "'+nomfichier+'" alias toto') self.directsend('set toto time format milliseconds') err,duree=self.directsend('status toto length ') self.directsend('play toto from 0 to '+str(duree)) time.sleep(float(duree)/1000.0) self.directsend('stop toto') self.directsend('close toto') if __name__=='__main__': message=mci() message.record() for i in xrange(4): time.sleep(1) print 4-i print "Fin" message.finrecord(os.getcwd()+"\\test.wav") ------------------------------------------------------------------------ Le 18.03.14 06:14, Jacob Kruger a ?crit : > Am playing around with a bit of a personal assistant app, that > includes letting people record smallish audio notes/sound clips, etc., > and am currently using pyAudio to handle recording - relatively > simple/easy, etc., but, one small issue seems to be that if I use > something like winsound to beep just before start recording, to sort > of notify user that recording is about to start, this seems to > possibly cause input/output stream issues. > In other words, possible to avoid/work around, but, just wondering > what guys would recommend looking into for simple little bits of audio > recording of sound clips, etc.? > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C:\art\wtst\signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From jacob at blindza.co.za Tue Mar 18 10:15:41 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Tue, 18 Mar 2014 11:15:41 +0200 Subject: [python-win32] Simple audio recording In-Reply-To: <5327DFCF.5060800@mclaveau.com> References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> <5327DFCF.5060800@mclaveau.com> Message-ID: Thanks - will try it out just now. Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: mc at mclaveau To: python-win32 at python.org Sent: Tuesday, 18 March, 2014 7:55 AM Subject: Re: [python-win32] Simple audio recording Hi! The exampl below run OK on my Win.7 with Python 2.7 + pywin32. @+ -- ------------------------------------------------------------------------------ # -*- coding: utf-8 -*- import time,os from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: # There was an error return errorcode, self.get_error(errorcode) else: # commande returned 0 return errorcode,buffer.value def get_error(self,error): """Given an error code, will return a description of the error.""" error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) def record(self): print"Record" self.directsend('open new type waveaudio alias toto') self.directsend('Set toto time format milliseconds') self.directsend('set toto bitspersample 8') # 8 bits ou 16 bits self.directsend('set toto samplespersec 11025') # 11025 low quality 22050 medium quality 44100 high quality (CD) self.directsend('set toto channels 1') # 1 mono 2 stereo self.directsend('record toto') time.sleep(0.1) def finrecord(self, nomfichier): self.directsend('stop toto') self.directsend('save toto '+nomfichier) self.directsend('close toto') #self.directsend('delete toto') def play(self, nomfichier): self.directsend('open "'+nomfichier+'" alias toto') self.directsend('set toto time format milliseconds') err,duree=self.directsend('status toto length ') self.directsend('play toto from 0 to '+str(duree)) time.sleep(float(duree)/1000.0) self.directsend('stop toto') self.directsend('close toto') if __name__=='__main__': message=mci() message.record() for i in xrange(4): time.sleep(1) print 4-i print "Fin" message.finrecord(os.getcwd()+"\\test.wav") ------------------------------------------------------------------------------ Le 18.03.14 06:14, Jacob Kruger a ?crit : Am playing around with a bit of a personal assistant app, that includes letting people record smallish audio notes/sound clips, etc., and am currently using pyAudio to handle recording - relatively simple/easy, etc., but, one small issue seems to be that if I use something like winsound to beep just before start recording, to sort of notify user that recording is about to start, this seems to possibly cause input/output stream issues. In other words, possible to avoid/work around, but, just wondering what guys would recommend looking into for simple little bits of audio recording of sound clips, etc.? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C:\art\wtst\signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From jacob at blindza.co.za Tue Mar 18 13:32:45 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Tue, 18 Mar 2014 14:32:45 +0200 Subject: [python-win32] Simple audio recording In-Reply-To: <5327DFCF.5060800@mclaveau.com> References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> <5327DFCF.5060800@mclaveau.com> Message-ID: OK, quick test, and, thanks! Just got it to start recording, while, using sound_lib loaded a prior recording into a FileStream, and let it play back while the new recording was taking place, then called finrecord(), loaded new recording clip into another stream, and you could hear the whole thing operating/cooperating, etc. etc. In other words, perfect! Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: mc at mclaveau To: python-win32 at python.org Sent: Tuesday, 18 March, 2014 7:55 AM Subject: Re: [python-win32] Simple audio recording Hi! The exampl below run OK on my Win.7 with Python 2.7 + pywin32. @+ -- ------------------------------------------------------------------------------ # -*- coding: utf-8 -*- import time,os from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: # There was an error return errorcode, self.get_error(errorcode) else: # commande returned 0 return errorcode,buffer.value def get_error(self,error): """Given an error code, will return a description of the error.""" error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) def record(self): print"Record" self.directsend('open new type waveaudio alias toto') self.directsend('Set toto time format milliseconds') self.directsend('set toto bitspersample 8') # 8 bits ou 16 bits self.directsend('set toto samplespersec 11025') # 11025 low quality 22050 medium quality 44100 high quality (CD) self.directsend('set toto channels 1') # 1 mono 2 stereo self.directsend('record toto') time.sleep(0.1) def finrecord(self, nomfichier): self.directsend('stop toto') self.directsend('save toto '+nomfichier) self.directsend('close toto') #self.directsend('delete toto') def play(self, nomfichier): self.directsend('open "'+nomfichier+'" alias toto') self.directsend('set toto time format milliseconds') err,duree=self.directsend('status toto length ') self.directsend('play toto from 0 to '+str(duree)) time.sleep(float(duree)/1000.0) self.directsend('stop toto') self.directsend('close toto') if __name__=='__main__': message=mci() message.record() for i in xrange(4): time.sleep(1) print 4-i print "Fin" message.finrecord(os.getcwd()+"\\test.wav") ------------------------------------------------------------------------------ Le 18.03.14 06:14, Jacob Kruger a ?crit : Am playing around with a bit of a personal assistant app, that includes letting people record smallish audio notes/sound clips, etc., and am currently using pyAudio to handle recording - relatively simple/easy, etc., but, one small issue seems to be that if I use something like winsound to beep just before start recording, to sort of notify user that recording is about to start, this seems to possibly cause input/output stream issues. In other words, possible to avoid/work around, but, just wondering what guys would recommend looking into for simple little bits of audio recording of sound clips, etc.? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C:\art\wtst\signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From mc at mclaveau.com Tue Mar 18 20:36:27 2014 From: mc at mclaveau.com (mc@mclaveau) Date: Tue, 18 Mar 2014 20:36:27 +0100 Subject: [python-win32] Simple audio recording In-Reply-To: References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> <5327DFCF.5060800@mclaveau.com> Message-ID: <5328A03B.3020006@mclaveau.com> Re! Thanks for your return. France ; Ard?che Le 18.03.14 13:32, Jacob Kruger a ?crit : > OK, quick test, and, thanks! > Just got it to start recording, while, using sound_lib loaded a prior > recording into a FileStream, and let it play back while the new > recording was taking place, then called finrecord(), loaded new > recording clip into another stream, and you could hear the whole thing > operating/cooperating, etc. etc. > In other words, perfect! > > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > ----- Original Message ----- > *From:* mc at mclaveau > *To:* python-win32 at python.org > *Sent:* Tuesday, 18 March, 2014 7:55 AM > *Subject:* Re: [python-win32] Simple audio recording > > Hi! > > The exampl below run OK on my Win.7 with Python 2.7 + pywin32. > > @+ > -- > > ------------------------------------------------------------------------ > # -*- coding: utf-8 -*- > > import time,os > from ctypes import windll, c_buffer > > class mci: > > def __init__(self): > self.w32mci = windll.winmm.mciSendStringA > self.w32mcierror = windll.winmm.mciGetErrorStringA > > def send(self,commande): > buffer = c_buffer(255) > errorcode = self.w32mci(str(commande),buffer,254,0) > > if errorcode: # There was an error > return errorcode, self.get_error(errorcode) > else: # commande returned 0 > return errorcode,buffer.value > > def get_error(self,error): > """Given an error code, will return a description of the > error.""" > error = int(error) > buffer = c_buffer(255) > self.w32mcierror(error,buffer,254) > return buffer.value > > def directsend(self, txt): > (err,buf)=self.send(txt) > if err != 0: > print'Erreur',str(err),'sur',txt,':',buf > return (err,buf) > > def record(self): > print"Record" > self.directsend('open new type waveaudio alias toto') > self.directsend('Set toto time format milliseconds') > self.directsend('set toto bitspersample 8') # 8 bits ou > 16 bits > self.directsend('set toto samplespersec 11025') # 11025 > low quality 22050 medium quality 44100 high quality (CD) > self.directsend('set toto channels 1') # 1 mono 2 stereo > > self.directsend('record toto') > time.sleep(0.1) > > def finrecord(self, nomfichier): > self.directsend('stop toto') > self.directsend('save toto '+nomfichier) > self.directsend('close toto') > #self.directsend('delete toto') > > def play(self, nomfichier): > self.directsend('open "'+nomfichier+'" alias toto') > self.directsend('set toto time format milliseconds') > err,duree=self.directsend('status toto length ') > self.directsend('play toto from 0 to '+str(duree)) > time.sleep(float(duree)/1000.0) > self.directsend('stop toto') > self.directsend('close toto') > > if __name__=='__main__': > message=mci() > message.record() > for i in xrange(4): > time.sleep(1) > print 4-i > print "Fin" > message.finrecord(os.getcwd()+"\\test.wav") > ------------------------------------------------------------------------ > > > > Le 18.03.14 06:14, Jacob Kruger a ?crit : >> Am playing around with a bit of a personal assistant app, that >> includes letting people record smallish audio notes/sound clips, >> etc., and am currently using pyAudio to handle recording - >> relatively simple/easy, etc., but, one small issue seems to be >> that if I use something like winsound to beep just before start >> recording, to sort of notify user that recording is about to >> start, this seems to possibly cause input/output stream issues. >> In other words, possible to avoid/work around, but, just >> wondering what guys would recommend looking into for simple >> little bits of audio recording of sound clips, etc.? >> TIA >> >> Jacob Kruger >> Blind Biker >> Skype: BlindZA >> "Roger Wilco wants to welcome you...to the space janitor's closet..." >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 > > ------------------------------------------------------------------------ > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -- -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 41683 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From vernondcole at gmail.com Tue Mar 18 22:53:13 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Tue, 18 Mar 2014 15:53:13 -0600 Subject: [python-win32] Simple audio recording In-Reply-To: <5327DFCF.5060800@mclaveau.com> References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> <5327DFCF.5060800@mclaveau.com> Message-ID: Just for fun (I know it works in console mode)... What happens if you try a "beep" the old fashioned way? print chr(7) On Mon, Mar 17, 2014 at 11:55 PM, mc at mclaveau wrote: > Hi! > > The exampl below run OK on my Win.7 with Python 2.7 + pywin32. > > @+ > -- > > ------------------------------ > # -*- coding: utf-8 -*- > > import time,os > from ctypes import windll, c_buffer > > class mci: > > def __init__(self): > self.w32mci = windll.winmm.mciSendStringA > self.w32mcierror = windll.winmm.mciGetErrorStringA > > def send(self,commande): > buffer = c_buffer(255) > errorcode = self.w32mci(str(commande),buffer,254,0) > > if errorcode: # There was an error > return errorcode, self.get_error(errorcode) > else: # commande returned 0 > return errorcode,buffer.value > > def get_error(self,error): > """Given an error code, will return a description of the error.""" > error = int(error) > buffer = c_buffer(255) > self.w32mcierror(error,buffer,254) > return buffer.value > > def directsend(self, txt): > (err,buf)=self.send(txt) > if err != 0: > print'Erreur',str(err),'sur',txt,':',buf > return (err,buf) > > def record(self): > print"Record" > self.directsend('open new type waveaudio alias toto') > self.directsend('Set toto time format milliseconds') > self.directsend('set toto bitspersample 8') # 8 bits ou 16 bits > self.directsend('set toto samplespersec 11025') # 11025 low > quality 22050 medium quality 44100 high quality (CD) > self.directsend('set toto channels 1') # 1 mono 2 stereo > > self.directsend('record toto') > time.sleep(0.1) > > def finrecord(self, nomfichier): > self.directsend('stop toto') > self.directsend('save toto '+nomfichier) > self.directsend('close toto') > #self.directsend('delete toto') > > def play(self, nomfichier): > self.directsend('open "'+nomfichier+'" alias toto') > self.directsend('set toto time format milliseconds') > err,duree=self.directsend('status toto length ') > self.directsend('play toto from 0 to '+str(duree)) > time.sleep(float(duree)/1000.0) > self.directsend('stop toto') > self.directsend('close toto') > > if __name__=='__main__': > message=mci() > message.record() > for i in xrange(4): > time.sleep(1) > print 4-i > print "Fin" > message.finrecord(os.getcwd()+"\\test.wav") > ------------------------------ > > > > Le 18.03.14 06:14, Jacob Kruger a ?crit : > > Am playing around with a bit of a personal assistant app, that includes > letting people record smallish audio notes/sound clips, etc., and am > currently using pyAudio to handle recording - relatively simple/easy, etc., > but, one small issue seems to be that if I use something like winsound to > beep just before start recording, to sort of notify user that recording is > about to start, this seems to possibly cause input/output stream issues. > > In other words, possible to avoid/work around, but, just wondering what > guys would recommend looking into for simple little bits of audio recording > of sound clips, etc.? > > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > > _______________________________________________ > python-win32 mailing listpython-win32 at python.orghttps://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C:\art\wtst\signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From jacob at blindza.co.za Wed Mar 19 00:41:52 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 19 Mar 2014 01:41:52 +0200 Subject: [python-win32] Simple audio recording In-Reply-To: References: <887F4F9C6A374B0D9004C5CFA7BD3779@JakePC> <5327DFCF.5060800@mclaveau.com> Message-ID: <9D9D011E7FEE427AAED910F558D557FA@JakePC> Works if am running code from/via interpreter, but, once I compile it to executable using cx, no longer beeps... Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: Vernon D. Cole To: mc at mclaveau Cc: python-win32 Sent: Tuesday, 18 March, 2014 11:53 PM Subject: Re: [python-win32] Simple audio recording Just for fun (I know it works in console mode)... What happens if you try a "beep" the old fashioned way? print chr(7) On Mon, Mar 17, 2014 at 11:55 PM, mc at mclaveau wrote: Hi! The exampl below run OK on my Win.7 with Python 2.7 + pywin32. @+ -- ---------------------------------------------------------------------------- # -*- coding: utf-8 -*- import time,os from ctypes import windll, c_buffer class mci: def __init__(self): self.w32mci = windll.winmm.mciSendStringA self.w32mcierror = windll.winmm.mciGetErrorStringA def send(self,commande): buffer = c_buffer(255) errorcode = self.w32mci(str(commande),buffer,254,0) if errorcode: # There was an error return errorcode, self.get_error(errorcode) else: # commande returned 0 return errorcode,buffer.value def get_error(self,error): """Given an error code, will return a description of the error.""" error = int(error) buffer = c_buffer(255) self.w32mcierror(error,buffer,254) return buffer.value def directsend(self, txt): (err,buf)=self.send(txt) if err != 0: print'Erreur',str(err),'sur',txt,':',buf return (err,buf) def record(self): print"Record" self.directsend('open new type waveaudio alias toto') self.directsend('Set toto time format milliseconds') self.directsend('set toto bitspersample 8') # 8 bits ou 16 bits self.directsend('set toto samplespersec 11025') # 11025 low quality 22050 medium quality 44100 high quality (CD) self.directsend('set toto channels 1') # 1 mono 2 stereo self.directsend('record toto') time.sleep(0.1) def finrecord(self, nomfichier): self.directsend('stop toto') self.directsend('save toto '+nomfichier) self.directsend('close toto') #self.directsend('delete toto') def play(self, nomfichier): self.directsend('open "'+nomfichier+'" alias toto') self.directsend('set toto time format milliseconds') err,duree=self.directsend('status toto length ') self.directsend('play toto from 0 to '+str(duree)) time.sleep(float(duree)/1000.0) self.directsend('stop toto') self.directsend('close toto') if __name__=='__main__': message=mci() message.record() for i in xrange(4): time.sleep(1) print 4-i print "Fin" message.finrecord(os.getcwd()+"\\test.wav") ---------------------------------------------------------------------------- Le 18.03.14 06:14, Jacob Kruger a ?crit : Am playing around with a bit of a personal assistant app, that includes letting people record smallish audio notes/sound clips, etc., and am currently using pyAudio to handle recording - relatively simple/easy, etc., but, one small issue seems to be that if I use something like winsound to beep just before start recording, to sort of notify user that recording is about to start, this seems to possibly cause input/output stream issues. In other words, possible to avoid/work around, but, just wondering what guys would recommend looking into for simple little bits of audio recording of sound clips, etc.? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C:\art\wtst\signature.gif Type: image/gif Size: 50388 bytes Desc: not available URL: From jacob at blindza.co.za Wed Mar 19 11:32:52 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 19 Mar 2014 12:32:52 +0200 Subject: [python-win32] Bringing an external initiated/called window to foreground/focus? Message-ID: <413EA599A57E4B718B60367DF6A3C301@JakePC> If, for example, I use something like following command line call/command to launch an instance of windows explorer, in a specific location, with a specific file highlighted/selected, the issue is that it seems to, possibly be hovering in background/not actually taking focus on my windows7 64 bit machine: explorer /select,c:\temp\testFile.txt Wondering if there's a relatively simple way to bring a specific, external window/application into foreground focus? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jim at JC-Bell.com Wed Mar 19 12:50:14 2014 From: Jim at JC-Bell.com (Jim Bell) Date: Wed, 19 Mar 2014 06:50:14 -0500 Subject: [python-win32] Bringing an external initiated/called window to foreground/focus? In-Reply-To: <413EA599A57E4B718B60367DF6A3C301@JakePC> References: <413EA599A57E4B718B60367DF6A3C301@JakePC> Message-ID: <53298476.8090701@JC-Bell.com> Find and activate it by matching its window title. import win32com.client shell = win32com.client.Dispatch('WScript.Shell') if shell.AppActivate('Explorer'): # put a better match here. print 'Did it.' On 2014-03-19 5:32 AM, Jacob Kruger wrote: > If, for example, I use something like following command line > call/command to launch an instance of windows explorer, in a specific > location, with a specific file highlighted/selected, the issue is that > it seems to, possibly be hovering in background/not actually taking > focus on my windows7 64 bit machine: > explorer /select,c:\temp\testFile.txt > Wondering if there's a relatively simple way to bring a specific, > external window/application into foreground focus? > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Wed Mar 19 16:31:19 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 19 Mar 2014 17:31:19 +0200 Subject: [python-win32] Bringing an external initiated/called window to foreground/focus? In-Reply-To: <53298476.8090701@JC-Bell.com> References: <413EA599A57E4B718B60367DF6A3C301@JakePC> <53298476.8090701@JC-Bell.com> Message-ID: Perfect! Only issue will be varying possibilities of titles for windows explorer window, but, can work around that. Thanks Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: Jim Bell To: Jacob Kruger ; python-win32 Sent: Wednesday, 19 March, 2014 1:50 PM Subject: Re: [python-win32] Bringing an external initiated/called window to foreground/focus? Find and activate it by matching its window title. import win32com.client shell = win32com.client.Dispatch('WScript.Shell') if shell.AppActivate('Explorer'): # put a better match here. print 'Did it.' On 2014-03-19 5:32 AM, Jacob Kruger wrote: If, for example, I use something like following command line call/command to launch an instance of windows explorer, in a specific location, with a specific file highlighted/selected, the issue is that it seems to, possibly be hovering in background/not actually taking focus on my windows7 64 bit machine: explorer /select,c:\temp\testFile.txt Wondering if there's a relatively simple way to bring a specific, external window/application into foreground focus? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Wed Mar 19 20:47:45 2014 From: mc at mclaveau.com (mc@mclaveau) Date: Wed, 19 Mar 2014 20:47:45 +0100 Subject: [python-win32] Bringing an external initiated/called window to foreground/focus? In-Reply-To: <413EA599A57E4B718B60367DF6A3C301@JakePC> References: <413EA599A57E4B718B60367DF6A3C301@JakePC> Message-ID: <5329F461.9000808@mclaveau.com> Hi! Below, a little code for set to foreground windows who have two sub-string in their title. @-salutations & sorry for my bad english. -- Michel Claveau ------------------------------------------------------------------------ # -*- coding: utf-8 -*- import win32gui def win_premierplan_h(hwin, r): st=win32gui.GetWindowText(hwin) if st.find(r[0])>-1 and st.find(r[1])>-1: if hwin!=0: try: win32gui.SetForegroundWindow(hwin) except: pass def win_premierplan(r1,r2): """ Met au premier plan les fen?tres dont le titre contient les deux cha?nes-rep?res r1 et r2 utiliser des chaines-rep?res en Unicode """ win32gui.EnumWindows(win_premierplan_h,(r1,r2)) win_premierplan("C:\\","") win_premierplan("My","Pic") ------------------------------------------------------------------------ Le 19.03.14 11:32, Jacob Kruger a ?crit : > If, for example, I use something like following command line > call/command to launch an instance of windows explorer, in a specific > location, with a specific file highlighted/selected, the issue is that > it seems to, possibly be hovering in background/not actually taking > focus on my windows7 64 bit machine: > explorer /select,c:\temp\testFile.txt > Wondering if there's a relatively simple way to bring a specific, > external window/application into foreground focus? > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nulla.epistola at web.de Thu Mar 20 18:05:45 2014 From: nulla.epistola at web.de (Sibylle Koczian) Date: Thu, 20 Mar 2014 18:05:45 +0100 Subject: [python-win32] Python 3.4: adodbapi.connect(..) crashes Message-ID: <532B1FE9.3020401@web.de> Hello, I just changed from Python 3.3 to 3.4, installed pywin32-218.win-amd64-py3.4.exe and tried to execute a script that definitely worked two weeks ago. No other changes, but now I get this exception: Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import adodbapi >>> cConnform = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};" >>> cAccName = r"D:\home\Sibylle\Dokumente\OOo_db\MedienEDV.mdb" >>> accessconnstr = cConnform.format(cAccName) >>> accessconnstr 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\home\\Sibylle\\Dokumente\\OOo_db\\MedienEDV.mdb;' >>> accessconn = adodbapi.connect(accessconnstr) Traceback (most recent call last): File "C:\Python34\lib\site-packages\adodbapi\adodbapi.py", line 295, in connect pythoncom.CoInitialize() #v2.1 Paj NameError: name 'pythoncom' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in accessconn = adodbapi.connect(accessconnstr) File "C:\Python34\lib\site-packages\adodbapi\adodbapi.py", line 298, in connect raise InterfaceError #Probably COM Error adodbapi.adodbapi.InterfaceError >>> Windows 7, 64bit, no MS Office on this machine, the provider is installed (and usable from a .NET application). To me this exception looks as if the import of pythoncom didn't happen, but I can't understand why not. Googling didn't get me anything - probably the problem is too new. What can I do? Thank you for help, Sibylle From vernondcole at gmail.com Fri Mar 21 09:35:55 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Fri, 21 Mar 2014 09:35:55 +0100 Subject: [python-win32] Python 3.4: adodbapi.connect(..) crashes In-Reply-To: <532B1FE9.3020401@web.de> References: <532B1FE9.3020401@web.de> Message-ID: Argh! I personally had not gotten around to trying Python 3.4 yet. The pythoncom package is widely used and I can't imagine that the lack of it got past our normal QA tests. I will check on this as soon as I get off work. In the meantime, you should be able to have many versions of python loaded in parallel on your machine (I have around 7, usually) so you can reload 3.3 and use the *Python Launcher for Windows* to switch between versions. Use... > py -3 myprogram.py # runs the highest numbered Python 3 > or... > py -3.3 myprogram.py # runs version 3.3 > On Thu, Mar 20, 2014 at 6:05 PM, Sibylle Koczian wrote: > Hello, > > I just changed from Python 3.3 to 3.4, installed > pywin32-218.win-amd64-py3.4.exe and tried to execute a script that > definitely worked two weeks ago. No other changes, but now I get this > exception: > > > Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 > bit (AMD64)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> import adodbapi > >>> cConnform = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};" > >>> cAccName = r"D:\home\Sibylle\Dokumente\OOo_db\MedienEDV.mdb" > >>> accessconnstr = cConnform.format(cAccName) > >>> accessconnstr > 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\home\\Sibylle\\ > Dokumente\\OOo_db\\MedienEDV.mdb;' > >>> accessconn = adodbapi.connect(accessconnstr) > Traceback (most recent call last): > File "C:\Python34\lib\site-packages\adodbapi\adodbapi.py", line 295, in > connect > pythoncom.CoInitialize() #v2.1 Paj > NameError: name 'pythoncom' is not defined > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "", line 1, in > accessconn = adodbapi.connect(accessconnstr) > File "C:\Python34\lib\site-packages\adodbapi\adodbapi.py", line 298, in > connect > raise InterfaceError #Probably COM Error > adodbapi.adodbapi.InterfaceError > >>> > > Windows 7, 64bit, no MS Office on this machine, the provider is installed > (and usable from a .NET application). > > To me this exception looks as if the import of pythoncom didn't happen, > but I can't understand why not. Googling didn't get me anything - probably > the problem is too new. What can I do? > > Thank you for help, > Sibylle > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From theller at ctypes.org Fri Mar 21 21:22:39 2014 From: theller at ctypes.org (Thomas Heller) Date: Fri, 21 Mar 2014 21:22:39 +0100 Subject: [python-win32] python 3.4 and pywin32 Message-ID: [this has also been sent to the python-dev mailing list] With python 3.4 and pywin32 version 218 it is only possible to import win32com or win32api when pywintypes has been imported before. I have no idea if this is a bug in pywin32 or in Python 3.4. Does anyone know more? Thanks, Thomas From jacob at blindza.co.za Sat Mar 22 00:03:07 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Sat, 22 Mar 2014 01:03:07 +0200 Subject: [python-win32] My bzPersonalAssistant code/project Message-ID: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> If of interest, here are two separate download links - the one for the current source code, and the other, larger one for currently compiled windows executable etc. - bzPersonalAssistant.exe. And, since this is sort of first time am really focusing on _trying_ to use wxPython frames, dialog's etc. a bit better/properly, I would also appreciate it if you can let me know if have messed up anything specific in terms of layout, general usage, etc. - BTW, blind biker in my email signature is a fact, and I can't look at GUI interface in the 'normal' way... - and, yes, there are still other pieces of using LBC module at times, etc., but, will eventually try clear those out as well, but, that's partly why want to find out if am doing much correctly in terms of how am trying to implement wxPython GUI building/rendition. Anyway, here's the source code - total of652Kb, and starting point is bzPersonalAssistant.py : http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantSource.zip Otherwise, here's the windows executable version - total of 8.35Mb, and was built using cx_Freeze - executable there is bzPersonalAssistant.exe: http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantExecutable.zip Now, this is meant to be sort of what the name says - a smallish piece of personal assistant type of software, and currently offers you typing in, categorising and searching for text notes, lets you define categories for, and then record .wav audio clips/audio notes, using windows standard audio input source - and have already figured out how to do something like invoke lame encoder via command line to switch over to sort of ending up offering .MP3 output, but haven't bothered with that yet, since at least part of that might relate to path/location compatibility if I actually let people do much more than test this applet, but, let's see. The other categories are a form of calendar, and categorised collections of web links, and contacts, and haven't finished off documentation of much as of yet, but, for example, since this is sort of targeting VI/blind users to a certain extent - wx is AFAIC the best GUI framework in terms of python generated acdcessibility - it can also tell you certain things using forms of TTS, and should notify you on the change of hour using small synthesized sound clips from the ./sounds directory as well, but anyway. I'm making use of python 2.7, wxPython 3.0, and other non-standard python modules are things like accessible_output, a small audio recording class in there - thanks for that one - etc. etc., along with a couple of win32 specific modules at moment, but anyway. Please let me know if you look at this at all, and what you think of end-result/output/code - know/am sure there are likely to still be some unresolved bugs/glitches in there - but am still busy playing around with this - and, yes, I generally use tab character for indentation - and have left it like that in source code for now. TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Sat Mar 22 00:38:54 2014 From: mc at mclaveau.com (mc@mclaveau) Date: Sat, 22 Mar 2014 00:38:54 +0100 Subject: [python-win32] My bzPersonalAssistant code/project In-Reply-To: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> References: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> Message-ID: <532CCD8E.8090202@mclaveau.com> Slt! Hmmm... I have downloaded the source-file. I try it, and... I found that wxPython is necessary. But, perso, I use my own GUI (based on PyWin32). I will try the exe version in a virtual computer, when I will found times. @+ -- MCi Le 22.03.14 00:03, Jacob Kruger a ?crit : > If of interest, here are two separate download links - the one for the > current source code, and the other, larger one for currently compiled > windows executable etc. - bzPersonalAssistant.exe. > And, since this is sort of first time am really focusing on _trying_ > to use wxPython frames, dialog's etc. a bit better/properly, I would > also appreciate it if you can let me know if have messed up anything > specific in terms of layout, general usage, etc. - BTW, blind biker in > my email signature is a fact, and I can't look at GUI interface in the > 'normal' way... - and, yes, there are still other pieces of > using LBC module at times, etc., but, will eventually try clear those > out as well, but, that's partly why want to find out if am doing much > correctly in terms of how am trying to implement wxPython GUI > building/rendition. > Anyway, here's the source code - total of652Kb, and starting point is > bzPersonalAssistant.py : > http://www.blindza.co.za/bzPersonalAssistant/_bzPersonalAssistantSource.zip_ > > Otherwise, here's the windows executable version - total of 8.35Mb, > and was built using cx_Freeze - executable there is > bzPersonalAssistant.exe: > http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantExecutable.zip > > Now, this is meant to be sort of what the name says - a smallish piece > of personal assistant type of software, and currently offers you > typing in, categorising and searching for text notes, lets you define > categories for, and then record .wav audio clips/audio notes, using > windows standard audio input source - and have already figured out how > to do something like invoke lame encoder via command line to switch > over to sort of ending up offering .MP3 output, but haven't bothered > with that yet, since at least part of that might relate to > path/location compatibility if I actually let people do much more than > test this applet, but, let's see. > The other categories are a form of calendar, and categorised > collections of web links, and contacts, and haven't finished off > documentation of much as of yet, but, for example, since this is sort > of targeting VI/blind users to a certain extent - wx is AFAIC the best > GUI framework in terms of python generated acdcessibility - it can > also tell you certain things using forms of TTS, and should notify you > on the change of hour using small synthesized sound clips from the > ./sounds directory as well, but anyway. > I'm making use of python 2.7, wxPython 3.0, and other non-standard > python modules are things like accessible_output, a small audio > recording class in there - thanks for that one - etc. etc., along with > a couple of win32 specific modules at moment, but anyway. > Please let me know if you look at this at all, and what you think of > end-result/output/code - know/am sure there are likely to still be > some unresolved bugs/glitches in there - but am still busy playing > around with this - and, yes, I generally use tab character for > indentation - and have left it like that in source code for now. > TIA > > Jacob Kruger > Blind Biker > Skype: BlindZA > "Roger Wilco wants to welcome you...to the space janitor's closet..." > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Sat Mar 22 08:21:35 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Sat, 22 Mar 2014 09:21:35 +0200 Subject: [python-win32] My bzPersonalAssistant code/project In-Reply-To: <532CCD8E.8090202@mclaveau.com> References: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> <532CCD8E.8090202@mclaveau.com> Message-ID: <5F65456B5F4F40EDA875DE4C5CB676FC@JakePC> Thanks. BTW, the other non-standard modules am making use of, aside from wxPython 3.0 - went over to that one for help with wx.lib.scrolledpanel - include accessible_output, and sound_lib - from: http://hg.q-continuum.net Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: mc at mclaveau To: python-win32 at python.org Sent: Saturday, 22 March, 2014 1:38 AM Subject: Re: [python-win32] My bzPersonalAssistant code/project Slt! Hmmm... I have downloaded the source-file. I try it, and... I found that wxPython is necessary. But, perso, I use my own GUI (based on PyWin32). I will try the exe version in a virtual computer, when I will found times. @+ -- MCi Le 22.03.14 00:03, Jacob Kruger a ?crit : If of interest, here are two separate download links - the one for the current source code, and the other, larger one for currently compiled windows executable etc. - bzPersonalAssistant.exe. And, since this is sort of first time am really focusing on _trying_ to use wxPython frames, dialog's etc. a bit better/properly, I would also appreciate it if you can let me know if have messed up anything specific in terms of layout, general usage, etc. - BTW, blind biker in my email signature is a fact, and I can't look at GUI interface in the 'normal' way... - and, yes, there are still other pieces of using LBC module at times, etc., but, will eventually try clear those out as well, but, that's partly why want to find out if am doing much correctly in terms of how am trying to implement wxPython GUI building/rendition. Anyway, here's the source code - total of652Kb, and starting point is bzPersonalAssistant.py : http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantSource.zip Otherwise, here's the windows executable version - total of 8.35Mb, and was built using cx_Freeze - executable there is bzPersonalAssistant.exe: http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantExecutable.zip Now, this is meant to be sort of what the name says - a smallish piece of personal assistant type of software, and currently offers you typing in, categorising and searching for text notes, lets you define categories for, and then record .wav audio clips/audio notes, using windows standard audio input source - and have already figured out how to do something like invoke lame encoder via command line to switch over to sort of ending up offering .MP3 output, but haven't bothered with that yet, since at least part of that might relate to path/location compatibility if I actually let people do much more than test this applet, but, let's see. The other categories are a form of calendar, and categorised collections of web links, and contacts, and haven't finished off documentation of much as of yet, but, for example, since this is sort of targeting VI/blind users to a certain extent - wx is AFAIC the best GUI framework in terms of python generated acdcessibility - it can also tell you certain things using forms of TTS, and should notify you on the change of hour using small synthesized sound clips from the ./sounds directory as well, but anyway. I'm making use of python 2.7, wxPython 3.0, and other non-standard python modules are things like accessible_output, a small audio recording class in there - thanks for that one - etc. etc., along with a couple of win32 specific modules at moment, but anyway. Please let me know if you look at this at all, and what you think of end-result/output/code - know/am sure there are likely to still be some unresolved bugs/glitches in there - but am still busy playing around with this - and, yes, I generally use tab character for indentation - and have left it like that in source code for now. TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nulla.epistola at web.de Sat Mar 22 10:35:10 2014 From: nulla.epistola at web.de (Sibylle Koczian) Date: Sat, 22 Mar 2014 10:35:10 +0100 Subject: [python-win32] Fwd: Re: Python 3.4: adodbapi.connect(..) crashes In-Reply-To: <532C957F.5080100@web.de> References: <532C957F.5080100@web.de> Message-ID: <532D594E.4050906@web.de> Sorry, this should have gone to the list! Sibylle -------- Original-Nachricht -------- Betreff: Re: [python-win32] Python 3.4: adodbapi.connect(..) crashes Datum: Fri, 21 Mar 2014 20:39:43 +0100 Von: Sibylle Koczian An: Vernon D. Cole Am 21.03.2014 09:35, schrieb Vernon D. Cole: > Argh! I personally had not gotten around to trying Python 3.4 yet. The > pythoncom package is widely used and I can't imagine that the lack of it > got past our normal QA tests. I will check on this as soon as I get off > work. > > In the meantime, you should be able to have many versions of python > loaded in parallel on your machine (I have around 7, usually) so you can > reload 3.3 and use the /Python Launcher for Windows/ to switch between > versions. Use... > > py -3 myprogram.py # runs the highest numbered Python 3 > > or... > > py -3.3 myprogram.py # runs version 3.3 > Did that, but now it gets crazy. I installed Python 3.3.5 and, first, pywin32-217.win-amd64-py3.3.exe (fresh from the download page), because that was the version I had before. First I got this message at the end of the installation: Traceback (most recent call last): File "", line 612, in File "", line 322, in install File "", line 160, in LoadSystemModule File "C:\Python33\lib\imp.py", line 186, in load_module return load_dynamic(name, filename, opened_file) ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. (The specified module could not be found.) I've used pywin32 for years and never got such a message. Using Python 3.3 I could import adodbapi in spite of this, but trying to connect to an Access database I got exactly the same exception as before with Python 3.4 and build 218. So this begins to look like something local to my PC, but what can it be? Last week this worked. Moreover I tried to install the windows extensions on another machine running Windows 8.1, Python 3.3.3, and got the same error message at installation. Sadly, using something reasonable in place of Access is no option in this case, it's not my database. Regards Sibylle From vernondcole at gmail.com Fri Mar 21 22:18:14 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Fri, 21 Mar 2014 15:18:14 -0600 Subject: [python-win32] python 3.4 and pywin32 In-Reply-To: References: Message-ID: Mark & Crew: We have a serious problem with the Python 3.4 64-bit release. This is not just a weird adodbapi bug. The IDE will not run, either. -- Vernon [image: Inline image 1] On Fri, Mar 21, 2014 at 2:22 PM, Thomas Heller wrote: > [this has also been sent to the python-dev mailing list] > > With python 3.4 and pywin32 version 218 it is only possible > to import win32com or win32api when pywintypes has been imported before. > > I have no idea if this is a bug in pywin32 or in Python 3.4. > Does anyone know more? > > Thanks, > Thomas > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Capture.PNG Type: image/png Size: 91542 bytes Desc: not available URL: From jacob at blindza.co.za Sat Mar 22 14:41:17 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Sat, 22 Mar 2014 15:41:17 +0200 Subject: [python-win32] [wxPython-users] My bzPersonalAssistant code/project In-Reply-To: <532D727E.6080607@jls-radio.com> References: <532D727E.6080607@jls-radio.com> Message-ID: <68511B4AE9CF48E18C279EC4BCD4FCAD@JakePC> Ok, will look into newer versions, in case, but, would those package directories be the same as generated when adding them to data_files when using py2exe? As in how do you include them for referral/reference when using cx_Freeze? Or do I just copy the directories generated by sound_lib.py2exe_datafiles(), etc. to the output folder of cx_Freeze as well..? TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: "James Scholes" To: Sent: Saturday, 22 March, 2014 1:22 PM Subject: Re: [wxPython-users] My bzPersonalAssistant code/project > Jacob Kruger wrote: >> Otherwise, here's the windows executable version - total of 8.35Mb, and >> was built using cx_Freeze - executable there is bzPersonalAssistant.exe: >> http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantExecutable.zip > > You haven't packaged the lib directories that come with sound_lib and > accessible_output, so your application fails to start from the > executable. I'd also recommend updating to accessible_output2 from: > http://hg.q-continuum.net/accessible_output2/ > -- > James Scholes > http://twitter.com/JamesScholes > From jacob at blindza.co.za Sat Mar 22 13:45:26 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Sat, 22 Mar 2014 14:45:26 +0200 Subject: [python-win32] My bzPersonalAssistant code/project In-Reply-To: <5F65456B5F4F40EDA875DE4C5CB676FC@JakePC> References: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> <532CCD8E.8090202@mclaveau.com> <5F65456B5F4F40EDA875DE4C5CB676FC@JakePC> Message-ID: <4334418477494F229D52F355EF2A9C51@JakePC> Ok, next question - partly since I have almost no experience with trying to create/redistribute windows executables, etc. Built this app with both cx_Freeze, and now also a version using py2exe, and the cx_Freeze version doesn't want to run at all inside my one windows XP VMWare instance, which I tried to test it on, and did also try installing both 9.0 and 10.0 versions of VCRT, in case, but, still just immediately renders an error message, but, can't find any details under event viewer log, so not exactly sure what's causing this, but although can't read error dialogue much, it seems to be mentioning something about CX wrapper/packaging, or something, and if I then also build a version using py2exe, which was avoiding, since this seems to have issues with wxPython, or something since won't even do everything on my development machine - runs, but, some buttons just don't handle events, etc., with no information coming up, but, if copy that executable over to test machine, then it at least runs somewhat, but, still generates an error when I try to, for example, invoke audio recording, but, am not sure if the MS error report means much - see attachment. Anyway, was wondering if there's a general/simple way to find/figure out what libraries/preinstallations you might need to notify an end user about, or provide copies of with something like this? All my real development work in past has been related to web development, where you don't have to worry about end user environment as much... TIA Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 1c4_appcompat.txt URL: From jacob at blindza.co.za Mon Mar 24 00:25:35 2014 From: jacob at blindza.co.za (Jacob Kruger) Date: Mon, 24 Mar 2014 01:25:35 +0200 Subject: [python-win32] My bzPersonalAssistant code/project In-Reply-To: <4334418477494F229D52F355EF2A9C51@JakePC> References: <3931CCB2414F4E1C8519E7DE54A49674@JakePC> <532CCD8E.8090202@mclaveau.com> <5F65456B5F4F40EDA875DE4C5CB676FC@JakePC> <4334418477494F229D52F355EF2A9C51@JakePC> Message-ID: <5FD88BFF656749389D394BFD13E48697@JakePC> Ok, next update - took sound_lib out of modules/use, and switched over to only using the code in recClass.py to handle both playback and recording of sound, and can now compile code on my dev machine, using cx_Freeze, into an executable that seems to handle pretty much alright on the VMWare windows XP 32 bit machine - except it doesn't want to handle actual sound recording, but, think that could be due to the sort of virtual sound card hardware, so will need to try test this on another machine that's relatively clean/free of all development tools, etc., but anyway. Anyway, if interested, here's the new/current version of source code - and, external/additional modules am making use of/implementing, aside from any included in this folder, are accessible_output, and wxPython 3.0 - don't think there are too many other, additional/external modules being made use of, but could have forgotten something - 656Kb: http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantSource.zip Only other issue there would be that it's going to look for user account app data folder, which would under windows7 fall under something like: c:\Users\\AppData\Roaming\bzPersonalAssistant\bzPersonalAssistant or, under windows XP, that would be more like: C:\Documents and Settings\\Application Data\bzPersonalAssistant\bzP ersonalAssistant> And, under that directory, it will look for the audioNotes folder, as well as storing bzPersonal.data - using pickle to store lists/dictionaries of data therein -, etc., as well as possibly sounds directory, since am at time switching operational path over to there. Here's the compiled/generated output that seems to work best/most reliably using cx_Freeze - py2exe doesn't want to work/launch .exe, and pyInstaller also seems 'unhappy' - 22.2Mb: http://www.blindza.co.za/bzPersonalAssistant/bzPersonalAssistantExecutable.zip And, here's an install package that also creates user account app data directory structure, and renders icons under start menu group - this was done using innoSetup - 16.9Mb: http://www.blindza.co.za/bzPersonalAssistant/setup.exe Either way, it seems to work/operate for now - just a quick test, except for throwing an error when I try to actually invoke sound recording, but, like said, that could be due to VMWare hardware imitation, or not... Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From theller at ctypes.org Mon Mar 24 08:42:07 2014 From: theller at ctypes.org (Thomas Heller) Date: Mon, 24 Mar 2014 08:42:07 +0100 Subject: [python-win32] python 3.4 and pywin32 In-Reply-To: References: Message-ID: Am 21.03.2014 22:18, schrieb Vernon D. Cole: > Mark & Crew: > We have a serious problem with the Python 3.4 64-bit release. This > is not just a weird adodbapi bug. The IDE will not run, either. I have created http://bugs.python.org/issue21050 in the python bug tracker. Thomas > -- > Vernon > Inline image 1 > > > On Fri, Mar 21, 2014 at 2:22 PM, Thomas Heller > wrote: > > [this has also been sent to the python-dev mailing list] > > With python 3.4 and pywin32 version 218 it is only possible > to import win32com or win32api when pywintypes has been imported before. > > I have no idea if this is a bug in pywin32 or in Python 3.4. > Does anyone know more? > > Thanks, > Thomas > > _________________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/__mailman/listinfo/python-win32 > > > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From theller at ctypes.org Mon Mar 24 17:38:32 2014 From: theller at ctypes.org (Thomas Heller) Date: Mon, 24 Mar 2014 17:38:32 +0100 Subject: [python-win32] python 3.4 and pywin32 In-Reply-To: References: Message-ID: Am 21.03.2014 21:22, schrieb Thomas Heller: > [this has also been sent to the python-dev mailing list] > > With python 3.4 and pywin32 version 218 it is only possible > to import win32com or win32api when pywintypes has been imported before. False alarm: after cleaning everything up and installing again this works now. Sorry for the noise. Thomas From vernondcole at gmail.com Mon Mar 24 21:25:56 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Mon, 24 Mar 2014 14:25:56 -0600 Subject: [python-win32] python 3.4 and pywin32 In-Reply-To: References: Message-ID: So why is _mine_ broken, too? What exactly did you clean up? On Mon, Mar 24, 2014 at 10:38 AM, Thomas Heller wrote: > Am 21.03.2014 21:22, schrieb Thomas Heller: > > [this has also been sent to the python-dev mailing list] >> >> With python 3.4 and pywin32 version 218 it is only possible >> to import win32com or win32api when pywintypes has been imported before. >> > > False alarm: after cleaning everything up and installing again this > works now. Sorry for the noise. > > > Thomas > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From theller at ctypes.org Tue Mar 25 09:17:31 2014 From: theller at ctypes.org (Thomas Heller) Date: Tue, 25 Mar 2014 09:17:31 +0100 Subject: [python-win32] python 3.4 and pywin32 In-Reply-To: References: Message-ID: <53313B9B.6090108@ctypes.org> Am 24.03.2014 21:25, schrieb Vernon D. Cole: > So why is _mine_ broken, too? No idea. > What exactly did you clean up? I ran the bdist_wininst uninstaller, then ran 'pip uninstall pywin32' and installed the bdist_wininst installer again then it worked. Previously I probably had a mess of installed versions, from the original bdist_wininst installer that I downloaded from sourceforge, plus a wheel package that I built myself with 'wheel convert pywin32-218.win32-py3.4.exe' and then installed with pip. It seems I cannot reproduce now the problem that I had then. Note: all this is with 32-bit python, on win7 64-bit. > > > On Mon, Mar 24, 2014 at 10:38 AM, Thomas Heller > wrote: > > Am 21.03.2014 21 :22, schrieb Thomas Heller: > > [this has also been sent to the python-dev mailing list] > > With python 3.4 and pywin32 version 218 it is only possible > to import win32com or win32api when pywintypes has been imported > before. > > > False alarm: after cleaning everything up and installing again this > works now. Sorry for the noise. > > > Thomas > > > _________________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/__mailman/listinfo/python-win32 > > > From bgailer at gmail.com Sat Mar 29 22:39:27 2014 From: bgailer at gmail.com (bob gailer) Date: Sat, 29 Mar 2014 17:39:27 -0400 Subject: [python-win32] Problem with Check: can't decode byte 0x90 Message-ID: <53373D8F.8050901@gmail.com> My program loads into an edit window and runs fine. Top line : # -*- coding: utf-8 -*- However when I invoke check (shift-ctl-c) I get: Traceback (most recent call last): File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 335, in OnFileCheck scriptutils.CheckFile() File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 467, in CheckFile code = f.read() + "\n" File "C:\Python33\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 19689: character maps to How do we fix this? From rupole at hotmail.com Sun Mar 30 16:31:30 2014 From: rupole at hotmail.com (Roger Upole) Date: Sun, 30 Mar 2014 10:31:30 -0400 Subject: [python-win32] Problem with Check: can't decode byte 0x90 References: <53373D8F.8050901@gmail.com> Message-ID: Should be able to open the file in binary mode (as RunScript above it does) and append the \n as bytes. Roger "bob gailer" wrote in message news:53373D8F.8050901 at gmail.com... > My program loads into an edit window and runs fine. > > Top line : # -*- coding: utf-8 -*- > > However when I invoke check (shift-ctl-c) I get: > Traceback (most recent call last): > File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 335, in OnFileCheck > scriptutils.CheckFile() > File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 467, in CheckFile > code = f.read() + "\n" > File "C:\Python33\lib\encodings\cp1252.py", line 23, in decode > return codecs.charmap_decode(input,self.errors,decoding_table)[0] > UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 19689: character maps to > > How do we fix this? From bgailer at gmail.com Mon Mar 31 04:06:07 2014 From: bgailer at gmail.com (bob gailer) Date: Sun, 30 Mar 2014 22:06:07 -0400 Subject: [python-win32] Problem with Check: can't decode byte 0x90 In-Reply-To: References: <53373D8F.8050901@gmail.com> Message-ID: <5338CD8F.70109@gmail.com> On 3/30/2014 10:31 AM, Roger Upole wrote: > Should be able to open the file in binary mode (as RunScript above it does) > and append the \n as bytes. Are you asking me to modify the code that is behind File->Check (Ctrl+Shift+C)? That is part of the pywin distribution! If I modify the read in that code I assume something else will break. I will file a bug report. > "bob gailer" wrote in message news:53373D8F.8050901 at gmail.com... >> My program loads into an edit window and runs fine. >> >> Top line : # -*- coding: utf-8 -*- >> >> However when I invoke check (shift-ctl-c) I get: >> Traceback (most recent call last): >> File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 335, in OnFileCheck >> scriptutils.CheckFile() >> File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 467, in CheckFile >> code = f.read() + "\n" >> File "C:\Python33\lib\encodings\cp1252.py", line 23, in decode >> return codecs.charmap_decode(input,self.errors,decoding_table)[0] >> UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 19689: character maps to From pfraser at spatialmedia.com Mon Mar 31 08:16:33 2014 From: pfraser at spatialmedia.com (Peter Fraser) Date: Mon, 31 Mar 2014 19:16:33 +1300 Subject: [python-win32] Pythonwin IDE hangs on tool menu edits -and workaround Message-ID: <53390841.8060902@spatialmedia.com> Hello Pywinonauts Pythonwin (pywin32 build218 python 2.7.6) is hanging after I edit the tools menu (or rather; whenever I go to the "Tools menu" tab of "PythonWin Options" and hit OK -I don't need to actually edit anything to provoke the problem) It seems that ToolMenuPropPage.OnOK gets into an endless loop -because it expects self.listControl.GetItemText(itemLook, 0) to raise win32ui.error when it runs out of items *but* GetItemText is happily returning zero length strings in this case. As a workaround I have added... if not self.listControl.GetItemText(itemLook, 0):break ..to toolmenu.py above the line... items.append( ( self.listControl.GetItemText(itemLook, 0), self.listControl.GetItemText(itemLook, 1) ) ) An older PythonWin (pywin32 build214 python 2.6.6) does not have the problem -but I wonder if the difference that makes a difference is particular to my machine. I tried deleting everything under under "HKEY_CURRENT_USER\Software\Python 2.7\Python for Win32\Tools Menu" but it made no difference. Is it just my machine (surely everyone else in the world can edit the tools menu ok)? Am I missing something about GetItemText perhaps? any wisdom appreciated pf