From skippy.hammond at gmail.com Tue Feb 1 00:44:19 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 01 Feb 2011 10:44:19 +1100 Subject: [python-win32] Problem with msvcr90.dll In-Reply-To: <1296474888.4858.21.camel@cacko> References: <1296474888.4858.21.camel@cacko> Message-ID: <4D474953.3010409@gmail.com> This stuff is painful and poorly documented. Is it possible the code which triggers the failing import is on a different thread than the one which loaded Python? If so, I suspect the magic done by Python in dl_nt.c may not be kicking in, which is supposed to ensure all python modules are loaded using the "activation context" defined by pythonxx.dll. HTH, Mark On 31/01/2011 10:54 PM, Tefnet Developers wrote: > Hi, > > I am developing a msgina replacement. > > I am at the point where I have the whole Gina API handled in python (a > dll written in C, calling methods of a python object). > > My problem is that somehow my program cannot import pywin32 modules: > > > Jan 31 12:12:41 p11 pygina: callproxy.caller: File"c:\teflogon\system_nt.py", line 4, in > Jan 31 12:12:41 p11 pygina: callproxy.caller: import pywintypes > Jan 31 12:12:41 p11 pygina: callproxy.caller: File"C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 124, in > Jan 31 12:12:41 p11 pygina: callproxy.caller: __import_pywin32_system_module__("pywintypes", globals()) > Jan 31 12:12:41 p11 pygina: callproxy.caller: File"C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__ > Jan 31 12:12:41 p11 pygina: callproxy.caller: import _win32sysloader > Jan 31 12:12:41 p11 pygina: callproxy.caller: ImportError: DLL load failed: The specified module could not be found > > > I did a check and replaced the failing method with execution of > python.exe running the same code: > > > if __name__ != '__main__': > subprocess.call( > [r'c:\python26\python.exe', r'c:\teflogon\tefgina.py', pMessage], > ) > > > And pywintypes gets imported fine there. > > My dll is built using mingw, like this: > i586-mingw32msvc-gcc -L./lib -shared -Wl,--kill-at pygina.o -o > pygina.dll -lpython26 > > I thought it had something to do with msvcr90.dll, so I've tried the > following: > > 1. Adding -lmsvcr90 at the end of the linking command > 2. Including a manifest in the dll: > > $ cat pygina.dll.manifest > > > > > > > > > > > > > > > $ grep manifest pygina.rc.in > 2 RT_MANIFEST pygina.dll.manifest > > $ > > > But it did not change a thing. > > So the question is - why can python.exe load pywin32 modules and my dll > cannot? > > I have been stuck with this for a couple of days now and any pointers > would be great :). > > > Thanks, > Filip Zyzniewski > Tefnet > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From amelie.lesser at googlemail.com Tue Feb 1 11:31:25 2011 From: amelie.lesser at googlemail.com (Amelie Lesser) Date: Tue, 1 Feb 2011 11:31:25 +0100 Subject: [python-win32] error importing win32com for Dispatch In-Reply-To: References: Message-ID: 2011/1/31 Vernon Cole > Don't use the ZIP file. It is a pain to install, and (as you see) sometimes > does not install correctly. Unfortunately, sourceforge sets it as the > default thing to do. What you want to do is push the "view all files" > button and select > the latest Windows installer for the version of Python you are running. > (also note that even if you are running a 64 bit version of Windows, you > should probably select a 32 bit version of Python.) > Ok, so I downloaded the pywin32-214.win32-py2.7.exe file (to go with the py verion 2.7.1). 2011/1/31 Tim Roberts timr at probo.com > That's not the right location. Did you get and run the pywin32 > installer? What command did you use to call "setup.py"? In a properly > installed system, win32com will live in > \Python27\lib\site-packages\win32com. I downloaded the exe file into C:\Python27 and am running it in the cmd or by double-clicking. When I hit 'execute' it asks me whcih user to execute as (I'm not the administrator, btu I read in the documentation that in this build I should be able to install though I'm not admin) and whether I want to protect the computer from unauthorised activities. If I check 'protect' it'll say 'Runtime Error: Invalid directory name. Could not create temporary file.' and 'Runtime error: Setup program invalid or damaged'. Elsif I uncheck protect it will take me back in a loop over 'execute' to 'check protect'. I did ask our amin for help, but he crammed with work and has never used python, so sadly gave up on it. 2011/1/31 Tim Roberts timr at probo.com > Are you running a 32-bit system or a 64-bit system? Did you install > 32-bit Python or 64-bit Python? I'm running a Windows XP pro 2002. I think it's 32bits (running 'winver' the product name doesn't list '64 bit'). I'm relatively sure that the python is 32-bit, too (our system admin installed it), but I'm not sure how to confirm that. It's Python 2.7.1 2011/1/31 Vernon Cole > Don't use the ZIP file. It is a pain to install, and (as you see) sometimes > does not install correctly. Unfortunately, sourceforge sets it as the > default thing to do. What you want to do is push the "view all files" > button and select > the latest Windows installer for the version of Python you are running. > (also note that even if you are running a 64 bit version of Windows, you > should probably select a 32 bit version of Python.) > -- > Vernon > > > On Mon, Jan 31, 2011 at 7:41 AM, Amelie Lesser < > amelie.lesser at googlemail.com> wrote: > >> Hello Group, >> >> I am struggling very hard with using the win32com.client to use Dispatch. >> I've been looking around quite a lot, but couldn't find any help that solved >> my problem. I only started working with python 2 months ago, so I am still >> quite the newbie. >> >> I'm working on a python script that is supposed to read a database into a >> list. It then should take certain information from each data entry, plug >> them into an excel file, let excel do a rather complex calculation using >> macros, and append the results from certain cells back to the list. >> I am working on Windows using the python IDLE shell and also tried it in >> gedit running the file on the cmd line. >> >> I downloaded the pywin32 extension from >> http://sourceforge.net/projects/pywin32/ and ran the setup.py file. >> The program starts with: >> >> *from win32com.client import Dispatch >> * >> For which I receive the following Error message: >> >> *Traceback (most recent call last): >> File "Z:\testpython\dbf_converter\testing.py", line 3, in >> from win32com.client import Dispatch >> ImportError: No module named win32com.client* >> >> >> - I read through the Installation Problems on >> http://starship.python.net/~skippy/win32/InstallationProblems.html. I >> found that I do have two versions of the python27.dll file, and deleted the >> one in the C:\Python27 directory, but everytime I start IDLE it re-creates >> that file. >> - I also tried setting the path using (separately) ...but no >> difference. >> - *sys.path.append('C:\\WINDOWS\\system32\\')* >> - *sys.path.append('C:\\Python27\\pywin32-214\\pywin32-214\\com')* >> - I tried deleting and reinstalling the extension >> >> >> I am completely lost and would really appreciate any help. >> >> Amelie >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From developers at tefnet.pl Tue Feb 1 15:10:51 2011 From: developers at tefnet.pl (Tefnet Developers) Date: Tue, 01 Feb 2011 15:10:51 +0100 Subject: [python-win32] Problem with msvcr90.dll In-Reply-To: <4D474953.3010409@gmail.com> References: <1296474888.4858.21.camel@cacko> <4D474953.3010409@gmail.com> Message-ID: <1296569451.7195.58.camel@cacko> Dnia 2011-02-01, wto o godzinie 10:44 +1100, Mark Hammond pisze: > This stuff is painful and poorly documented. Is it possible the code > which triggers the failing import is on a different thread than the one > which loaded Python? I have added a little thread id reporting function: static void logThread(const char *where) { FILE *log = fopen(LOGFILE, "a"); fprintf(log, "pygina thread id @ %s: %d\n", where, GetCurrentThreadId()); fclose(log); } I've put it before each method call and before Py_Initialize, and it all happens in one thread: pygina thread id @ WlxNegotiate: 612 pygina thread id @ Py_Initialize: 612 pygina thread id @ WlxInitialize: 612 pygina thread id @ WlxDisplayStatusMessage: 612 pygina thread id @ WlxRemoveStatusMessage: 612 pygina thread id @ WlxDisplaySASNotice: 612 pygina thread id @ WlxRemoveStatusMessage: 612 pygina thread id @ WlxLoggedOutSAS: 612 Should I need to do any linking against msvcr90 if python26.dll is already linked against it and I am linked to python26.dll? Thanks, Filip Zyzniewski Tefnet From developers at tefnet.pl Tue Feb 1 17:11:57 2011 From: developers at tefnet.pl (Tefnet Developers) Date: Tue, 01 Feb 2011 17:11:57 +0100 Subject: [python-win32] Problem with msvcr90.dll In-Reply-To: <4D474953.3010409@gmail.com> References: <1296474888.4858.21.camel@cacko> <4D474953.3010409@gmail.com> Message-ID: <1296576717.10017.75.camel@cacko> Dnia 2011-02-01, wto o godzinie 10:44 +1100, Mark Hammond pisze: > This stuff is painful and poorly documented. Is it possible the code > which triggers the failing import is on a different thread than the one > which loaded Python? If so, I suspect the magic done by Python in > dl_nt.c may not be kicking in, which is supposed to ensure all python > modules are loaded using the "activation context" defined by pythonxx.dll. The smallest piece of program that shows the problem: $ cat pytest.c #include int main(void) { Py_Initialize(); PyRun_SimpleString( "import traceback \n" "try:\n" " import pywintypes\n" "except:\n" " traceback.print_exc()\n" ); } $ make pytest.exe i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic -std=c99 -c -o pytest.o pytest.c i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26 rm pytest.o $ The output looks like this: C:\>pytest Traceback (most recent call last): File "", line 3, in File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 124, in __import_pywin32_system_module__("pywintypes", globals()) File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__ import _win32sysloader ImportError: DLL load failed: The specified module could not be found C:\> It loads fine if I add -lmsvcr90 to the linking flags, but I think it should not be necessary, right? bye, Filip Zyzniewski Tefnet From Tom.Hawkins at innospecinc.com Tue Feb 1 18:22:16 2011 From: Tom.Hawkins at innospecinc.com (Tom Hawkins) Date: Tue, 1 Feb 2011 17:22:16 -0000 Subject: [python-win32] How to specify parameters in a query using odbc Message-ID: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> Hi, I'm trying to get data out of a MS SQL Server 2005 database from a Python 2.5 script, using the odbc module - I can't easily get anything more up-to-date installed on this system. If I specify the query literally, like this: import dbi, odbc myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults ON (SampleTests.SampleCode = SampleResults.SampleCode AND SampleTests.AuditFlag = SampleResults.AuditFlag AND SampleTests.TestPosition = SampleResults.TestPosition) WHERE (SampleTests.SampleCode='foo' AND SampleTests.AuditFlag=0 AND SampleTests.TestCode='bar' AND SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') """ conn=odbc.odbc("DSN=mydatabase;UID=myusername;PWD=mypassword") cursor=conn.cursor() cursor.execute(myQuery) print cursor.fetchall() conn.close() ...it works OK, but if I try to parameterise the query: myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults ON (SampleTests.SampleCode = SampleResults.SampleCode AND SampleTests.AuditFlag = SampleResults.AuditFlag AND SampleTests.TestPosition = SampleResults.TestPosition) WHERE (SampleTests.SampleCode=%s AND SampleTests.AuditFlag=0 AND SampleTests.TestCode=%s AND SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') """ ... cursor.execute(myQuery, ('foo', 'bar')) ...I get: dbi.program-error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 's'. in EXEC Any idea what I'm doing wrong please? Apologies if I've missed something stupid. I get the same error if I only specify one of the parameters with %s and leave the other one literal, by the way. Thanks, Tom Tom Hawkins Principal Scientist Innospec Inc Tel: +44 (0)151 356 6197 Fax: +44 (0)151 356 6112 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 791 bytes Desc: image001.jpg URL: From timr at probo.com Tue Feb 1 19:14:24 2011 From: timr at probo.com (Tim Roberts) Date: Tue, 1 Feb 2011 10:14:24 -0800 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> Message-ID: <4D484D80.5070101@probo.com> Tom Hawkins wrote: > > > > I?m trying to get data out of a MS SQL Server 2005 database from a > Python 2.5 script, using the odbc module - I can?t easily get anything > more up-to-date installed on this system. > > ... > > ...it works OK, but if I try to parameterise the query:Any idea what > I?m doing wrong please? Apologies if I?ve missed something stupid. I > get the same error if I only specify one of the parameters with %s and > leave the other one literal, by the way. There are, for reasons that have never been clear to me, three different parameter substitution styles allowed by the Python dbapi specification. The Win32 odbc module uses ? characters instead of %s. A simple search-and-replace should solve your problem. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From paul_koning at dell.com Tue Feb 1 18:30:31 2011 From: paul_koning at dell.com (Paul Koning) Date: Tue, 1 Feb 2011 12:30:31 -0500 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> Message-ID: <8A9AC448-3C03-4E0C-83E6-3B990A331E7E@dell.com> My impression (but I admit the documentation could be better) is that parameters on the execute call only apply to data values of INSERT statements. For any other variable bits, format them into the command string (with the % operator and appropriate %s/%d/%x etc. elements in the string). So I'd get: myVarQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults ON (SampleTests.SampleCode = SampleResults.SampleCode AND SampleTests.AuditFlag = SampleResults.AuditFlag AND SampleTests.TestPosition = SampleResults.TestPosition) WHERE (SampleTests.SampleCode=%s AND SampleTests.AuditFlag=0 AND SampleTests.TestCode=%s AND SampleTests.TestStatus<900 AND SampleResults.ComponentName=?IntMethod?) ??? ... myQuery = myVarQuery % ('foo', 'bar') cursor.execute(myQuery) The syntax gets slightly messier if you want to have a variable INSERT statement that also takes data parameters. For example myVarInsert = "INSERT INTO myTable (%s) VALUES (%%s)" ... myInsert = myVarInsert % 'testvar' cursor.execute (myInsert, (value1, value2, value3)) Note the %%s in the VALUES clause, that becomes a %s in myInsert, and then gets the data values stuck into it by the execute. paul On Feb 1, 2011, at 12:22 PM, Tom Hawkins wrote: > Hi, > > I?m trying to get data out of a MS SQL Server 2005 database from a Python 2.5 script, using the odbc module - I can?t easily get anything more up-to-date installed on this system. > > If I specify the query literally, like this: > > import dbi, odbc > > myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults > ON (SampleTests.SampleCode = SampleResults.SampleCode AND > SampleTests.AuditFlag = SampleResults.AuditFlag AND > SampleTests.TestPosition = SampleResults.TestPosition) > WHERE (SampleTests.SampleCode=?foo? AND SampleTests.AuditFlag=0 AND SampleTests.TestCode='bar' AND > SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') > """ > > conn=odbc.odbc("DSN=mydatabase;UID=myusername;PWD=mypassword") > cursor=conn.cursor() > cursor.execute(myQuery) > > print cursor.fetchall() > > conn.close() > > > ...it works OK, but if I try to parameterise the query: > > myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults > ON (SampleTests.SampleCode = SampleResults.SampleCode AND > SampleTests.AuditFlag = SampleResults.AuditFlag AND > SampleTests.TestPosition = SampleResults.TestPosition) > WHERE (SampleTests.SampleCode=%s AND SampleTests.AuditFlag=0 AND SampleTests.TestCode=%s AND > SampleTests.TestStatus<900 AND SampleResults.ComponentName=?IntMethod?) > ??? > ... > cursor.execute(myQuery, (?foo?, ?bar?)) > > > ...I get: > > dbi.program-error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 's'. in EXEC > > > Any idea what I?m doing wrong please? Apologies if I?ve missed something stupid. I get the same error if I only specify one of the parameters with %s and leave the other one literal, by the way. > > Thanks, > Tom > > Tom Hawkins > Principal Scientist > Innospec Inc > Tel: +44 (0)151 356 6197 > Fax: +44 (0)151 356 6112 > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Feb 1 20:26:02 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 1 Feb 2011 12:26:02 -0700 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <4D484D80.5070101@probo.com> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> <4D484D80.5070101@probo.com> Message-ID: Tim's answer is correct. A db api connection object supplies a .paramstyle method which specifies which of _five_ different parameter substitution methods is used by the underlying query engine. odbc uses 'qmark', meaning that you put ? where you want parameters to appear. You may have something "more up-to-date" available to you that you are not aware of. Versions of pywin32 since 2.1.1 have also included adodbapi, which is fully db api 2.0 compliant. ADO runs in odbc mode by default, so you should be able to use all of the same drivers, connection strings, etc. You could also use ADO providers if you wish, by using other connection strings. www.connectionstrings.com is a good source. Adodbapi also uses 'qmark' paramstyle. If you were to get one of the latest versions of adodbapi (which will be in the NEXT release of pywin32) it would also allow you to _change_ the paramstyle, so that you could specify that you want to use 'format' paramstyle, which is what you were trying to use. (This is needed for django, for example.) Lacking that you are stuck with 'qmark' so use: myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults ON (SampleTests.SampleCode = SampleResults.SampleCode AND SampleTests.AuditFlag = SampleResults.AuditFlag AND SampleTests.TestPosition = SampleResults.TestPosition) WHERE (SampleTests.SampleCode=? AND SampleTests.AuditFlag=0 AND SampleTests.TestCode=? AND SampleTests.TestStatus<900 AND SampleResults.ComponentName=?IntMethod?) ??? Paul's impression that parameter substitution only works in INSERT statements is incorrect. (The documentation IS awfully lightweight.) You can also use them in SELECT as in your example. -- Vernon Cole On Tue, Feb 1, 2011 at 11:14 AM, Tim Roberts wrote: > Tom Hawkins wrote: > > > > > > > > I?m trying to get data out of a MS SQL Server 2005 database from a > > Python 2.5 script, using the odbc module - I can?t easily get anything > > more up-to-date installed on this system. > > > > ... > > > > ...it works OK, but if I try to parameterise the query:Any idea what > > I?m doing wrong please? Apologies if I?ve missed something stupid. I > > get the same error if I only specify one of the parameters with %s and > > leave the other one literal, by the way. > > There are, for reasons that have never been clear to me, three different > parameter substitution styles allowed by the Python dbapi > specification. The Win32 odbc module uses ? characters instead of %s. > > A simple search-and-replace should solve your problem. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andrew.MacIntyre at acma.gov.au Tue Feb 1 23:28:40 2011 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Wed, 2 Feb 2011 09:28:40 +1100 Subject: [python-win32] How to specify parameters in a query using odbc [SEC=PERSONAL] In-Reply-To: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> Message-ID: The odbc module in Pythonwin uses qmark parameter style I believe, so use ? instead of %s for parameter substitution. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre Operations Branch tel: +61 2 6219 5356 Communications Infrastructure Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au http://www.acma.gov.au/ Tom Hawkins wrote I'm trying to get data out of a MS SQL Server 2005 database from a Python 2.5 script, using the odbc module - I can't easily get anything more up-to-date installed on this system. {...} ...it works OK, but if I try to parameterise the query: myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults ON (SampleTests.SampleCode = SampleResults.SampleCode AND SampleTests.AuditFlag = SampleResults.AuditFlag AND SampleTests.TestPosition = SampleResults.TestPosition) WHERE (SampleTests.SampleCode=%s AND SampleTests.AuditFlag=0 AND SampleTests.TestCode=%s AND SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') """ ... cursor.execute(myQuery, ('foo', 'bar')) ...I get: dbi.program-error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 's'. in EXEC Any idea what I'm doing wrong please? Apologies if I've missed something stupid. I get the same error if I only specify one of the parameters with %s and leave the other one literal, by the way. 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From reckoner at gmail.com Tue Feb 1 23:55:06 2011 From: reckoner at gmail.com (Reckoner) Date: Tue, 1 Feb 2011 14:55:06 -0800 Subject: [python-win32] Find containing window given a control handle Message-ID: Hi, Given the handle of a text field or button embedded in some window, how can I find the parent window that contains the handle? Right now, I'm exhaustively going through every visible window and matching every child handle. Perhaps there is a better way? Thanks! From greg.ewing at canterbury.ac.nz Wed Feb 2 00:22:25 2011 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Wed, 02 Feb 2011 12:22:25 +1300 Subject: [python-win32] Find containing window given a control handle In-Reply-To: References: Message-ID: <4D4895B1.40900@canterbury.ac.nz> Reckoner wrote: > Given the handle of a text field or button embedded in some window, > how can I find the parent window that contains the handle? Use the win32gui.GetParent() function? -- Greg From lc4468 at gmail.com Wed Feb 2 04:33:15 2011 From: lc4468 at gmail.com (Lance Case) Date: Tue, 1 Feb 2011 22:33:15 -0500 Subject: [python-win32] PyWin32 has stopped working/mfc90.dll error Message-ID: I?ve installed the standard ?pywin32-212? app that comes with ESRI?s ArcGIS 10. Pythonwin.exe ran fine for me for a while, but I?ve somehow managed to break it. I?m getting ?PyWin32 has stopped working?. When I check the Event Application log, the error says ?Faulting module path: C:\Windows\WinSxS\ x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90.dll?. I?ve confirmed that the file is there, but it won?t allow me to replace it. I then noticed that C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin contains the same DLL and that there is a ?manifest? file. Does anyone have any suggestions for fixing this error? I?ve tried reinstalling Pywin32 a few times with the same results. -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Wed Feb 2 04:57:04 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 02 Feb 2011 14:57:04 +1100 Subject: [python-win32] PyWin32 has stopped working/mfc90.dll error In-Reply-To: References: Message-ID: <4D48D610.8040303@gmail.com> The best I can think of is that somehow the toolbar states or other preferences are causing the problem - try deleting the registry key HKEY_CURRENT_USER\Software\Python 2.6\Python for Win32 and see if that helps. Mark On 2/02/2011 2:33 PM, Lance Case wrote: > I?ve installed the standard ?pywin32-212? app that comes with ESRI?s > ArcGIS 10. Pythonwin.exe ran fine for me for a while, but I?ve somehow > managed to break it. I?m getting ?PyWin32 has stopped working?. When I > check the Event Application log, the error says ?Faulting module path: > C:\Windows\WinSxS\ > x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90.dll?. > > I?ve confirmed that the file is there, but it won?t allow me to replace > it. I then noticed that > C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin contains the same DLL > and that there is a ?manifest? file. > > Does anyone have any suggestions for fixing this error? I?ve tried > reinstalling Pywin32 a few times with the same results. > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From matteo.boscolo at boscolini.eu Wed Feb 2 09:26:56 2011 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Wed, 02 Feb 2011 09:26:56 +0100 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> Message-ID: <4D491550.5070402@boscolini.eu> try: myQuery ="""your sql code """%(('foo', 'bar')) and then cursor.execute(myQuery) regards, Matteo Il 01/02/2011 18:22, Tom Hawkins ha scritto: > > Hi, > > I'm trying to get data out of a MS SQL Server 2005 database from a > Python 2.5 script, using the odbc module - I can't easily get anything > more up-to-date installed on this system. > > If I specify the query literally, like this: > > import dbi, odbc > > myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults > > ON (SampleTests.SampleCode = SampleResults.SampleCode AND > > SampleTests.AuditFlag = SampleResults.AuditFlag AND > > SampleTests.TestPosition = SampleResults.TestPosition) > > WHERE (SampleTests.SampleCode='foo' AND SampleTests.AuditFlag=0 AND > SampleTests.TestCode='bar' AND > > SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') > > """ > > conn=odbc.odbc("DSN=mydatabase;UID=myusername;PWD=mypassword") > > cursor=conn.cursor() > > cursor.execute(myQuery) > > print cursor.fetchall() > > conn.close() > > ...it works OK, but if I try to parameterise the query: > > myQuery = """SELECT EnteredValue FROM SampleTests INNER JOIN SampleResults > > ON (SampleTests.SampleCode = SampleResults.SampleCode AND > > SampleTests.AuditFlag = SampleResults.AuditFlag AND > > SampleTests.TestPosition = SampleResults.TestPosition) > > WHERE (SampleTests.SampleCode=%s AND SampleTests.AuditFlag=0 AND > SampleTests.TestCode=%s AND > > SampleTests.TestStatus<900 AND SampleResults.ComponentName='IntMethod') > > """ > > ... > > cursor.execute(myQuery, ('foo', 'bar')) > > ...I get: > > dbi.program-error: [Microsoft][ODBC SQL Server Driver][SQL > Server]Incorrect syntax near 's'. in EXEC > > Any idea what I'm doing wrong please? Apologies if I've missed > something stupid. I get the same error if I only specify one of the > parameters with %s and leave the other one literal, by the way. > > Thanks, > > Tom > > *Tom Hawkins* > > Principal Scientist > > Innospec Inc > > Tel: +44 (0)151 356 6197 > > Fax: +44 (0)151 356 6112 > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > Nessun virus nel messaggio. > Controllato da AVG - www.avg.com > Versione: 10.0.1204 / Database dei virus: 1435/3416 - Data di > rilascio: 01/02/2011 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 791 bytes Desc: not available URL: From Tom.Hawkins at innospecinc.com Wed Feb 2 11:06:30 2011 From: Tom.Hawkins at innospecinc.com (Tom Hawkins) Date: Wed, 2 Feb 2011 10:06:30 -0000 Subject: [python-win32] How to specify parameters in a query using odbc Message-ID: <80EF6E679A466046BA07D071932847B323232A@UKEPX101.innospec.itnet.octel> Thanks for all the replies - it's now working fine with ? (after some delay caused by testing with a single parameter query but forgetting that the parameter has to be supplied as a single-member list)... Tom Tom Hawkins Principal Scientist Innospec Inc Tel: +44 (0)151 356 6197 Fax: +44 (0)151 356 6112 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 791 bytes Desc: image001.jpg URL: From lc4468 at gmail.com Wed Feb 2 13:58:04 2011 From: lc4468 at gmail.com (Lance Case) Date: Wed, 2 Feb 2011 07:58:04 -0500 Subject: [python-win32] PyWin32 has stopped working/mfc90.dll error In-Reply-To: <4D48D610.8040303@gmail.com> References: <4D48D610.8040303@gmail.com> Message-ID: Wow! Glad I joined this list. That fixed the problem. Thanks! On Tue, Feb 1, 2011 at 10:57 PM, Mark Hammond wrote: > The best I can think of is that somehow the toolbar states or other > preferences are causing the problem - try deleting the registry key > HKEY_CURRENT_USER\Software\Python 2.6\Python for Win32 and see if that > helps. > > Mark > > > On 2/02/2011 2:33 PM, Lance Case wrote: > >> I?ve installed the standard ?pywin32-212? app that comes with ESRI?s >> ArcGIS 10. Pythonwin.exe ran fine for me for a while, but I?ve somehow >> managed to break it. I?m getting ?PyWin32 has stopped working?. When I >> check the Event Application log, the error says ?Faulting module path: >> C:\Windows\WinSxS\ >> >> x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90.dll?. >> >> I?ve confirmed that the file is there, but it won?t allow me to replace >> it. I then noticed that >> C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin contains the same DLL >> and that there is a ?manifest? file. >> >> Does anyone have any suggestions for fixing this error? I?ve tried >> reinstalling Pywin32 a few times with the same results. >> >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdriscoll at co.marshall.ia.us Wed Feb 2 17:42:09 2011 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 02 Feb 2011 10:42:09 -0600 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <80EF6E679A466046BA07D071932847B323232A@UKEPX101.innospec.itnet.octel> References: <80EF6E679A466046BA07D071932847B323232A@UKEPX101.innospec.itnet.octel> Message-ID: <4D498961.3020404@co.marshall.ia.us> On 1:59 PM, Tom Hawkins wrote: > > Thanks for all the replies - it's now working fine with ? (after some > delay caused by testing with a single parameter query but forgetting > that the parameter has to be supplied as a single-member list)... > > Tom > > *Tom Hawkins* > > Principal Scientist > > Innospec Inc > > Tel: +44 (0)151 356 6197 > > Fax: +44 (0)151 356 6112 > Personally, I use SqlAlchemy for almost all my database work. It takes a little longer to learn, but I find it easier to use in the long run. -- Mike Driscoll Applications Specialist -------------- next part -------------- An HTML attachment was scrubbed... URL: From planders at gmail.com Wed Feb 2 18:00:33 2011 From: planders at gmail.com (Preston Landers) Date: Wed, 2 Feb 2011 11:00:33 -0600 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <4D498961.3020404@co.marshall.ia.us> References: <80EF6E679A466046BA07D071932847B323232A@UKEPX101.innospec.itnet.octel> <4D498961.3020404@co.marshall.ia.us> Message-ID: On Wed, Feb 2, 2011 at 10:42 AM, Mike Driscoll wrote: > > Personally, I use SqlAlchemy for almost all my database work. It takes a > little longer to learn, but I find it easier to use in the long run. > > Yeah I agree with this. And if you feel the need to work with ODBC directly, consider the PyODBC project which is different than the one included in PyWin32. http://code.google.com/p/pyodbc/ -Preston -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Feb 2 19:03:35 2011 From: timr at probo.com (Tim Roberts) Date: Wed, 2 Feb 2011 10:03:35 -0800 Subject: [python-win32] How to specify parameters in a query using odbc In-Reply-To: <4D491550.5070402@boscolini.eu> References: <80EF6E679A466046BA07D071932847B3232327@UKEPX101.innospec.itnet.octel> <4D491550.5070402@boscolini.eu> Message-ID: <4D499C77.9080103@probo.com> Matteo Boscolo wrote: > try: > myQuery ="""your sql code """%((?foo?, ?bar?)) > and then > cursor.execute(myQuery) No, no, no! Don't EVER do that. The whole reason these parameter substitution schemes exist is because it prevents code like this, which is open to SQL injection attacks. The only time you should be using Python's % substitution with SQL is when you need to supply table or field names, and even then you need to be careful if the names came from user input. Any time you are supplying a data value, you should ALWAYS use the API's substitution scheme. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Wed Feb 2 20:14:47 2011 From: timr at probo.com (Tim Roberts) Date: Wed, 2 Feb 2011 11:14:47 -0800 Subject: [python-win32] PyWin32 has stopped working/mfc90.dll error In-Reply-To: References: Message-ID: <4D49AD27.4020503@probo.com> Lance Case wrote: > I?ve installed the standard ?pywin32-212? app that comes with ESRI?s > ArcGIS 10. Pythonwin.exe ran fine for me for a while, but I?ve somehow > managed to break it. I?m getting ?PyWin32 has stopped working?. When I > check the Event Application log, the error says ?Faulting module path: > C:\Windows\WinSxS\ > x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_b81d038aaf540e86\mfc90.dll?. > > I?ve confirmed that the file is there, but it won?t allow me to > replace it. I then noticed that > C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin contains the same > DLL and that there is a ?manifest? file. > > Does anyone have any suggestions for fixing this error? I?ve tried > reinstalling Pywin32 a few times with the same results. Replacing the file isn't going to help. What that error means is that your application crashed inside somewhere inside MFC, which is Microsoft's GUI framework. What are you doing when it crashes? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From dardoschuster at hotmail.com Thu Feb 3 12:24:24 2011 From: dardoschuster at hotmail.com (Dardo Schuster Glez) Date: Thu, 3 Feb 2011 11:24:24 +0000 Subject: [python-win32] FW: python-win32 image fields problem In-Reply-To: References: Message-ID: Dear Sir How can y show a jpg that is in a SQL Server image field in a Qlabel object ??? and how to change and save it in the image field ??? Thanks Dardo Schuster Tenerife - Canary Islands - Spain PD: How can i send my questions to the python-win32 mailing list ??? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Thu Feb 3 14:51:48 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 3 Feb 2011 06:51:48 -0700 Subject: [python-win32] FW: python-win32 image fields problem In-Reply-To: References: Message-ID: Your question came to the correct place. I think you may be fighting a known SQL bug. What is the SQL data type of the column which contains your jpg image? How large is the image? Can you send me a SQL backup file containing a test image? (Only two or three rows email directly to me, not to the list.) Vernon Cole (sent from my 'droid phone) On Feb 3, 2011 4:24 AM, "Dardo Schuster Glez" wrote: > > > > > Dear Sir > > How can y show a jpg that is in a SQL Server image field in a Qlabel object ??? and how to change and save it in the image field ??? > > Thanks > Dardo Schuster > Tenerife - Canary Islands - Spain > > PD: How can i send my questions to the python-win32 mailing list ??? > Thanks > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.frost at mp2kmag.com Thu Feb 3 19:14:01 2011 From: eric.frost at mp2kmag.com (Eric Frost) Date: Thu, 3 Feb 2011 12:14:01 -0600 Subject: [python-win32] New article on Automating MapPoint via COM to render worldwide cities from Geonames on base map Message-ID: Add City Coverage to MapPoint using the GeoNames Database by Richard Marsden http://www.mapforums.com/add-city-coverage-mappoint-using-geonames-database-15244.html -- m: 312-399-1586 http://www.MapForums.com http://www.MP2Kmag.com From tony at tcapp.com Thu Feb 3 21:52:18 2011 From: tony at tcapp.com (Tony Cappellini) Date: Thu, 3 Feb 2011 12:52:18 -0800 Subject: [python-win32] Using os.startfile() for automation Message-ID: On Windows XP, I'm able to launch the application associated with file1.xxx. os.startfile("file1.xxx") I want to start more instances of the application, so that I can process several files at the same time. calling os.startfile("file2.xxx") causes the instance of the application to also open file2.xxx. The problem with this is- I have to wait until file1 has finished processing, before I can start file2. If, after opening the first instance for file1, I can use the Start Menu, Program Files, open another instance of the application, I can then start processing file2 at the same time as file1, but using a separate instance. Is there any other way to invoke startfile() or other function- to force a new instance of the application to open? How would I close the application from Python, that was started with os.startfile()? Once the application is open, I just want to use File Save As Text, to get the data into a text file. Python's app-automation capabilities are kinda weak and not well documented, so I may resort to AutoIt3. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Feb 3 22:18:40 2011 From: timr at probo.com (Tim Roberts) Date: Thu, 3 Feb 2011 13:18:40 -0800 Subject: [python-win32] Using os.startfile() for automation In-Reply-To: References: Message-ID: <4D4B1BB0.8070407@probo.com> Tony Cappellini wrote: > > On Windows XP, I'm able to launch the application associated with > file1.xxx. > > os.startfile("file1.xxx") > > I want to start more instances of the application, so that I can > process several files at the same time. > > calling os.startfile("file2.xxx") causes the instance of the > application to also open file2.xxx. > > The problem with this is- I have to wait until file1 has finished > processing, before I can start file2. Ah, so you're saying you CAN execute the second os.startfile, but the application opens them both in the same instance? It's really up to the application to decide how to handle this. os.startfile is exactly like double-clicking the file icons in Explorer. Is this a public application? There may be a smarter way to handle this. os.startfile is a bit "brute force". > If, after opening the first instance for file1, I can use the Start > Menu, Program Files, open another instance of the application, I can > then start > processing file2 at the same time as file1, but using a separate instance. > > Is there any other way to invoke startfile() or other function- to > force a new instance of the application to open? Not through os.startfile, but you can go look up the application's executable on your own, and then start the process yourself. For example, instead of mydoc.doc you can say: "C:\Program Files\Microsoft Office\Office10\winword.exe" mydoc.doc However, it's still up to the application to decide whether it will handle that in one instance or two. > How would I close the application from Python, that was started with > os.startfile()? Well, you could go searching for the window by name, since you know the file name, and send it a WM_CLOSE. However, it would probably be smarter to see if the application can be automated through COM. That way, you're in complete control of the operation. Alternatively, you can use CreateProcess through the API to launch the application. That way, you get a process handle that you can control. os.startfile is a shortcut. For that convenience, you give up some flexibility. > Once the application is open, I just want to use File Save As Text, to > get the data into a text file. > Python's app-automation capabilities are kinda weak and not well > documented, so I may resort to AutoIt3. That's a ridiculous complaint. Languages do not have "app automation capabilities". If the application you're controlling has the ability to be automated through COM, you can use pywin32's amply documented COM facilities to do it. If it doesn't, then you'll have to inject keystrokes using the API, exactly like you would if you were writing this in C. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Andrew.MacIntyre at acma.gov.au Fri Feb 4 00:42:37 2011 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Fri, 4 Feb 2011 10:42:37 +1100 Subject: [python-win32] Using os.startfile() for automation [SEC=UNCLASSIFIED] In-Reply-To: References: Message-ID: [apologies for top post] All there is to know about os.startfile() is in Python's docs. The only way to achieve the effect you desire is to do what the "Start Menu..." action does - explicitly open an instance of the application (and not all applications will open new instances; some will always open an existing instance if one exists). You don't state what version of Python you're using. Assuming it is at least 2.6, you may wish to investigate the subprocess module and possibly the multiprocessing module. You will have to explicitly identify the application required to open the file, as you would with os.system(). If the application you wish to run supports COM (such as MS Word/Excel etc do), you could try PythonWin or comtypes, either of which will give much more control such as saving the file and exiting cleanly. Other than COM, application automation on Windows requires Windows API programming to send the necessary messages to application windows - this is what AutoIt does. I believe that people have written Python code to do this; googling "python application automation" might give you some ideas. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre Operations Branch tel: +61 2 6219 5356 Communications Infrastructure Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au http://www.acma.gov.au/ From: python-win32-bounces+andrew.macintyre=acma.gov.au at python.org [mailto:python-win32-bounces+andrew.macintyre=acma.gov.au at python.org] On Behalf Of Tony Cappellini Sent: Friday, 4 February 2011 7:52 AM To: python-win32 at python.org Subject: [python-win32] Using os.startfile() for automation On Windows XP, I'm able to launch the application associated with file1.xxx. os.startfile("file1.xxx") I want to start more instances of the application, so that I can process several files at the same time. calling os.startfile("file2.xxx") causes the instance of the application to also open file2.xxx. The problem with this is- I have to wait until file1 has finished processing, before I can start file2. If, after opening the first instance for file1, I can use the Start Menu, Program Files, open another instance of the application, I can then start processing file2 at the same time as file1, but using a separate instance. Is there any other way to invoke startfile() or other function- to force a new instance of the application to open? How would I close the application from Python, that was started with os.startfile()? Once the application is open, I just want to use File Save As Text, to get the data into a text file. Python's app-automation capabilities are kinda weak and not well documented, so I may resort to AutoIt3. Thanks 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony at tcapp.com Fri Feb 4 01:46:00 2011 From: tony at tcapp.com (Tony Cappellini) Date: Thu, 3 Feb 2011 16:46:00 -0800 Subject: [python-win32] Using os.startfile() for automation Message-ID: Message: 5 Date: Thu, 3 Feb 2011 13:18:40 -0800 From: Tim Roberts To: Python-Win32 List Subject: Re: [python-win32] Using os.startfile() for automation Message-ID: <4D4B1BB0.8070407 at probo.com> Content-Type: text/plain; charset="ISO-8859-1" >>Ah, so you're saying you CAN execute the second os.startfile, but the >>application opens them both in the same instance? Yes. >>However, it's still up to the application to decide whether it will >>handle that in one instance or two. When I use launch the app from Start -> All Program -> Program Folder -> ProgramName.exe another instance opens. I guess I can just iterate over the list of files to open, then launch a new instance for each file (within limits), as opposed to using os.startfile() >>owever, it would probably be smarter to see if the application can be automated through COM. I've tried using PyWin32's COM Browser but will only use COM as a last resort. This app doesn't appear to be registered as a COM server. I've had COM servers hang on me in the past, and since the app is written by a 3rd party who wants $$ for support, I'll stay far away from COM. >>That way, you're in complete control of the operation. Only if the COM server is solid. Older versions of Excel can easily be crashed via COM, although my app isn't Excel in this case. >>Alternatively, you can use CreateProcess through the API to launch the >>application. That way, you get a process handle that you can control. This only helps me launch the app, I still need a way to manipulate the menus, to start the File -> Save As ... step > Once the application is open, I just want to use File Save As Text, to > get the data into a text file. > Python's app-automation capabilities are kinda weak and not well > documented, so I may resort to AutoIt3. >>That's a ridiculous complaint. Languages do not have "app automation >>capabilities". Scuze me. I should have said "The python automation packages" (pywinauto, watsup, pywingui, etc) ... One could argue whether AutoIt3 is a language or a framework, but its existence is for automating other applications. I'd much rather use python, but the api in pywinauto is maddening. >>keystrokes using the API, exactly like you would if you were writing this in C. Well, I still wouldn't know how to do this in C, which is why I looked into the python automation packages. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony at tcapp.com Fri Feb 4 01:59:15 2011 From: tony at tcapp.com (Tony Cappellini) Date: Thu, 3 Feb 2011 16:59:15 -0800 Subject: [python-win32] Using os.startfile() for automation In-Reply-To: References: Message-ID: Date: Fri, 4 Feb 2011 10:42:37 +1100 From: "Andrew MacIntyre" To: python-win32 at python.org Subject: Re: [python-win32] Using os.startfile() for automation [SEC=UNCLASSIFIED] Message-ID: >>Other than COM, application automation on Windows requires Windows API >>programming to send the necessary messages to application windows - this >>is what AutoIt does. I believe that people have written Python code to do this; googling "python application automation" might give you some ideas. Autoit3 exposes some of it's API's via COM, but I'd rather avoid COM. http://code.google.com/p/robotframework-autoitlibrary/ Python + AutoIt via COM just seems like too many layers, just to invoke the File Save As menu. This looks like its the most mature Python package and is the one I'm trying to use, but with no success at the moment. At least there have been updates recently. http://code.google.com/p/pywinauto/ but the API is bad and the docs are confusing. This is next inline, and .... http://www.tizmoi.net/watsup/intro.html There was one other, but googling isn't finding it at the moment, however it is the project which started the others. -------------- next part -------------- An HTML attachment was scrubbed... URL: From prologic at shortcircuit.net.au Mon Feb 7 07:09:26 2011 From: prologic at shortcircuit.net.au (James Mills) Date: Mon, 7 Feb 2011 16:09:26 +1000 Subject: [python-win32] InstallService TypeError: exceptions must be classes or instances not str Message-ID: Hello all, I've been trying to build a simple prototype Windows Services but am running into a problem when trying to install it. Running: $ test_service.exe install Produces the following error: ERROR: exceptions must be classes or instances, not str Traceback (most recent call last): File "service.pyc", line 71, in install_service File "win32serviceutil.pyc", line 295, in InstallService File "win32serviceutil.pyc", line 83, in LocatePythonServiceExe TypeError: exceptions must be classes or instances, not str Now. We are using the latest version of pywin32 (214) for Python 2.6.x We tried deleting the *.pyc files in C:\Python26\Lib\ to no avail.. The code is here: https://bitbucket.org/prologic/circuits/src/5e17015df110/tmp/win32_service/ I'd appreciate any insight into this as my own research into this problem has yielded nothing positive so far. Thanks, cheers James -- -- James Mills -- -- "Problems are solved by method" From d_vineet at yahoo.com Mon Feb 7 15:31:20 2011 From: d_vineet at yahoo.com (Vineet Deodhar) Date: Mon, 7 Feb 2011 06:31:20 -0800 (PST) Subject: [python-win32] Turbogears 2.1 with mako Message-ID: <89342.78991.qm@web32005.mail.mud.yahoo.com> Hi All ! For web-based solutions, I have started learning TG 2.1 By and large, the documentation on TG 2.1 official site is a work-in-process. As regards to the templates (out of MVC), it tells how to go about Genshi. I wish to go with mako. Gone through the docs of mako (they are good). But still, it would be better if I can get a tutorial explaining how to use TG 2.1 with mako. (TG 2.0 has a topic on using TG 2.0 with Genshi) (It will save me from re-inventing the wheel, if somebody has written docs on these lines). Can anybody please point to any such tutorial? (I googled, but couldn't locate any convincing result.) Thanks, Vineet. Best regards, Vineet Deodhar 0 9270012422 (Sales) 0 9420 6767 41 (Service) 0233-2300136 (Residence) -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Mon Feb 7 17:00:05 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 7 Feb 2011 09:00:05 -0700 Subject: [python-win32] InstallService TypeError: exceptions must be classes or instances not str In-Reply-To: References: Message-ID: James: It appears that more information is needed to help with your problem. At the present moment, the best I can say is "works for me." [note: I have a file named "python.bat" on my search path which contains the single line: c:\python26\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 so that I can keep my many versions of Python straight.] I downloaded your code using hg and installed on Vista Home Basic using: C:\hg\circuits>python setup.py install and received an error message (which I am unable to duplicate, sorry) followed by what appeared to be a good installation. I attempted to run: C:\hg\circuits\tmp\win32_service>python test_service.py install and received an privilege violation. I started a new Command Prompt using "Run as Administrator" and got: C:\hg\circuits\tmp\win32_service>python test_service.py install C:\hg\circuits\tmp\win32_service>c:\python26\python.exe test_service.py install Service installed Service started which I think is what you intended. The service is indeed installed on my system. --- So... What version of Windows are you running? Where did "test_service.exe" come from? (I don't see it in your hg tree.) -- Vernon Cole On Sun, Feb 6, 2011 at 11:09 PM, James Mills wrote: > Hello all, > > I've been trying to build a simple prototype Windows Services > but am running into a problem when trying to install it. > > Running: > > $ test_service.exe install > > Produces the following error: > > ERROR: exceptions must be classes or instances, not str > Traceback (most recent call last): > File "service.pyc", line 71, in install_service > File "win32serviceutil.pyc", line 295, in InstallService > File "win32serviceutil.pyc", line 83, in LocatePythonServiceExe > TypeError: exceptions must be classes or instances, not str > > Now. We are using the latest version of pywin32 (214) > for Python 2.6.x > > We tried deleting the *.pyc files in C:\Python26\Lib\ to no avail.. > > The code is here: > https://bitbucket.org/prologic/circuits/src/5e17015df110/tmp/win32_service/ > > I'd appreciate any insight into this as my own research > into this problem has yielded nothing positive so far. > > Thanks, > > cheers > James > > -- > -- James Mills > -- > -- "Problems are solved by method" > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Mon Feb 7 23:54:21 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Feb 2011 09:54:21 +1100 Subject: [python-win32] DVCS options for pywin32 Message-ID: <4D50781D.6010309@skippinet.com.au> I've been quite a laggard with source control for pywin32 - we are still on CVS and I've been waiting for a sign from above about which dvcs to move to - and with the current CVS outage at sourceforge and their plan to end-of-life CVS services, I really need to bite the bullet. For a while hg was the only option, then bzr and git joined the crowd. With Python still targeting a move to hg from svn, that seems like the obvious choice - but I've been a bit unhappy with my hg experiences and with some of the discussions about how Python's workflow needs to change to accommodate it. I initially struggled to get my head around git, but now that I am becoming more familiar with it I like it alot. Windows support for both is currently fairly reasonable - especially if you don't care too much about "tortoise" style shell integration - which I don't. Both hg and git finally seem to have workable options to support Windows line-endings in files. Does anyone else in pywin32-land have any opinions about this? Does anyone feel strongly one way or another? Thanks, Mark From prologic at shortcircuit.net.au Mon Feb 7 23:46:25 2011 From: prologic at shortcircuit.net.au (James Mills) Date: Tue, 8 Feb 2011 08:46:25 +1000 Subject: [python-win32] InstallService TypeError: exceptions must be classes or instances not str In-Reply-To: References: Message-ID: On Tue, Feb 8, 2011 at 2:00 AM, Vernon Cole wrote: > Service installed > Service started > NB: We don't get this far. We get the TypeError exception instead. > What version of Windows are you running? Windows XP (SP3) Python 2.6.4 pywin32-214 py2exe 0.6.9 > Where did "test_service.exe" come from? (I don't see it in your hg tree.) python setup.py py2exe Builds the test_service.exe executable. cheers James -- -- James Mills -- -- "Problems are solved by method" From timr at probo.com Tue Feb 8 00:18:38 2011 From: timr at probo.com (Tim Roberts) Date: Mon, 7 Feb 2011 15:18:38 -0800 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D50781D.6010309@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> Message-ID: <4D507DCE.6050603@probo.com> Mark Hammond wrote: > For a while hg was the only option, then bzr and git joined the crowd. > With Python still targeting a move to hg from svn, that seems like the > obvious choice - but I've been a bit unhappy with my hg experiences and > with some of the discussions about how Python's workflow needs to change > to accommodate it. I initially struggled to get my head around git, but > now that I am becoming more familiar with it I like it alot. Windows > support for both is currently fairly reasonable - especially if you > don't care too much about "tortoise" style shell integration - which I > don't. Both hg and git finally seem to have workable options to support > Windows line-endings in files. > > Does anyone else in pywin32-land have any opinions about this? Does > anyone feel strongly one way or another? I had been resisting the urge to move away from CVS for our internal source control, but at the urging of someone (on this list, as I recall), I checked out three of the "modern" source code control systems, and found that I liked Mercurial (hg) quite a lot. I've now converted to hg for all of my personal work. I use only the command-line tools -- I haven't installed the tortoise stuff either. "git" just seemed to be too much of a lifestyle commitment. You're really working with a lot of details that seemed unnecessary to me. I haven't had any line-ending hassles yet. That has certainly been an issue with CVS over the years. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From python at bdurham.com Tue Feb 8 00:57:20 2011 From: python at bdurham.com (python at bdurham.com) Date: Mon, 07 Feb 2011 18:57:20 -0500 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D50781D.6010309@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> Message-ID: <1297123040.645.1419469863@webmail.messagingengine.com> Mark, I've heard very good things about github which provides free (open source) and paid hosting plans for your projects. https://github.com/ We're considering moving our proprietary code base to the paid version of this service. Cheers, Malcolm From mhammond at skippinet.com.au Tue Feb 8 02:02:03 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Feb 2011 12:02:03 +1100 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <1297123040.645.1419469863@webmail.messagingengine.com> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> Message-ID: <4D50960B.3050600@skippinet.com.au> On 8/02/2011 10:57 AM, python at bdurham.com wrote: > Mark, > > I've heard very good things about github which provides free (open > source) and paid hosting plans for your projects. > https://github.com/ github is a fine service, but the question is more about the source control system to use rather than the service which hosts it. github supports only git, while sourceforge gives you the option. Even if we went for git, I'd probably keep everything at sourceforge for a number of reasons. That said, given Tim's response, Python's decision and assuming no message from Roger Upole expressing he has developed a strong preference for git since I last asked, I'll go with hg. Thanks, Mark From skippy.hammond at gmail.com Tue Feb 8 02:03:42 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 08 Feb 2011 12:03:42 +1100 Subject: [python-win32] Turbogears 2.1 with mako In-Reply-To: <89342.78991.qm@web32005.mail.mud.yahoo.com> References: <89342.78991.qm@web32005.mail.mud.yahoo.com> Message-ID: <4D50966E.2020605@gmail.com> On 8/02/2011 1:31 AM, Vineet Deodhar wrote: > Hi All ! > For web-based solutions, I have started learning TG 2.1 > By and large, the documentation on TG 2.1 official site is a > work-in-process. > As regards to the templates (out of MVC), it tells how to go about Genshi. > I wish to go with mako. > Gone through the docs of mako (they are good). > But still, it would be better if I can get a tutorial explaining how to > use TG 2.1 with mako. > (TG 2.0 has a topic on using TG 2.0 with Genshi) > (It will save me from re-inventing the wheel, if somebody has written > docs on these lines). > Can anybody please point to any such tutorial? > (I googled, but couldn't locate any convincing result.) I think you would be best of asking on a Turbogears or mako specific list rather than a windows specific one... Cheers, Mark From vernondcole at gmail.com Tue Feb 8 02:17:04 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 7 Feb 2011 18:17:04 -0700 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D50960B.3050600@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> Message-ID: My personal stuff is on bzr and I have put my open source stuff on hg, partly because you said you were switching to it. A 3rd dvcs is one too many IMHO. I moved the stand-alone (IronPython) copy of adodbapi to hg on sourceforge and it was painless. I'ld encourage hg. Vernon Cole (sent from my 'droid phone) On Feb 7, 2011 6:06 PM, "Mark Hammond" wrote: > On 8/02/2011 10:57 AM, python at bdurham.com wrote: >> Mark, >> >> I've heard very good things about github which provides free (open >> source) and paid hosting plans for your projects. >> https://github.com/ > > github is a fine service, but the question is more about the source > control system to use rather than the service which hosts it. github > supports only git, while sourceforge gives you the option. Even if we > went for git, I'd probably keep everything at sourceforge for a number > of reasons. > > That said, given Tim's response, Python's decision and assuming no > message from Roger Upole expressing he has developed a strong preference > for git since I last asked, I'll go with hg. > > Thanks, > > Mark > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Tue Feb 8 02:29:07 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Feb 2011 12:29:07 +1100 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> Message-ID: <4D509C63.1030902@skippinet.com.au> On 8/02/2011 12:17 PM, Vernon Cole wrote: > My personal stuff is on bzr and I have put my open source stuff on hg, > partly because you said you were switching to it. A 3rd dvcs is one too > many IMHO. Yeah - back in April 2009 I stated I would move to hg. But given the time that passed, a few personal experiences and the various discussions on python-dev about some if the pain it is facing, I was looking if anyone's experience over the last couple of years could sway me away from it. Apparently not - which I *think* is good :) Cheers, Mark From cournape at gmail.com Tue Feb 8 04:21:54 2011 From: cournape at gmail.com (David Cournapeau) Date: Tue, 8 Feb 2011 12:21:54 +0900 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D509C63.1030902@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> Message-ID: On Tue, Feb 8, 2011 at 10:29 AM, Mark Hammond wrote: > On 8/02/2011 12:17 PM, Vernon Cole wrote: >> >> My personal stuff is on bzr and I have put my open source stuff on hg, >> partly because you said you were switching to it. A 3rd dvcs is one too >> many IMHO. > > Yeah - back in April 2009 I stated I would move to hg. ?But given the time > that passed, a few personal experiences and the various discussions on > python-dev about some if the pain it is facing, I was looking if anyone's > experience over the last couple of years could sway me away from it. > ?Apparently not - which I *think* is good :) To be fair, I think any VCS would have caused numerous issues for python-dev. The crowd just is conservative (which is a good thing may I say for something like python). Although I have never contributed much to pywin32, I can give you my experience with git/bzr/hg and what happened with numpy, where we moved from svn to git. I think the so-called easiness of hg vs git is superficial. It is true that git command line UI is inconsistent, and a lot of doc too detailed. But its concepts are as simple as hg if not simpler. As for an example: hg still does not know how to deal with branches IMO, in the sense that you have several branch concepts (named branches vs bookmarks vs clones), all with different UI and different level of support from the tools. As soon as you want to share work based on branches, you all have to agree on which process to use. It is then not that much simpler, especially since bookmarks and named branches have quite a few WTF (for example you can have multiple named branches with the same name). The argument that hg can do everything git can is kind of true (module the index, which is unique to git AFAIK), but you certainly have to dig into things which are not even in the hg book to do things which are routine in git. What I can do with ~15 commands in git, I need mercurial queues and numerous extensions in hg (which I have to use at work). Hg does have objective advantages over git: it is in python, and it is easier to use for a significant crows on windows. This was not a big issue for numpy, but may be for pywin32 given its purpose. cheers, David From roberto.c.aguilar at gmail.com Tue Feb 8 04:30:48 2011 From: roberto.c.aguilar at gmail.com (Roberto Aguilar) Date: Mon, 7 Feb 2011 19:30:48 -0800 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D509C63.1030902@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> Message-ID: <8220CD38-4307-467B-9E23-CF2BAD81E021@gmail.com> On Feb 7, 2011, at 5:29 PM, Mark Hammond wrote: > On 8/02/2011 12:17 PM, Vernon Cole wrote: >> My personal stuff is on bzr and I have put my open source stuff on hg, >> partly because you said you were switching to it. A 3rd dvcs is one too >> many IMHO. > > Yeah - back in April 2009 I stated I would move to hg. But given the time that passed, a few personal experiences and the various discussions on python-dev about some if the pain it is facing, I was looking if anyone's experience over the last couple of years could sway me away from it. Apparently not - which I *think* is good :) I have not used hg seriously, so I can't really give it a fair opinion. But, what I've heard about it has been good. I have used bzr and it was really frustrating. I have been using Git seriously for about three years and must say the only reason I would use any other vcs is because a particular project is using it. I'm not really sure what part of Git Tim's lifestyle commitment comment pertains to, but I'll say it likely holds true for any system one adopts. Take Mark's comment, "[...] discussions about how Python's workflow needs to change to accommodate it." Sounds like a lifestyle commitment. For the basic edit-commit-update cycle, git is not all that different from any other system. It's beyond that where it gets interesting and where, I think, Git shines. Git extremely fast, flexible, usually stays out of your way, and lets you do what you want/need. You can use its flexibility to your advantage or shoot yourself in the foot. So far I have not shot myself bad enough to lose data, it provides some safety nets in order to bail you out in case you make a mistake. The control it gives you over your code is well worth the learning curve. I would give Git a serious look, and if you have dismissed it, take another peek. The system has matured in the past few years. There are some great resources available, for example: http://progit.org/ http://git-scm.com/ I can try to answer any questions you have, feel free to send them my way. Regards, -Roberto. From mail at timgolden.me.uk Tue Feb 8 10:21:20 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 08 Feb 2011 09:21:20 +0000 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D50781D.6010309@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> Message-ID: <4D510B10.9090600@timgolden.me.uk> On 07/02/2011 22:54, Mark Hammond wrote: > I've been quite a laggard with source control for pywin32 - we are still > on CVS and I've been waiting for a sign from above about which dvcs to > move to - and with the current CVS outage at sourceforge and their plan > to end-of-life CVS services, I really need to bite the bullet. > > For a while hg was the only option, then bzr and git joined the crowd. > With Python still targeting a move to hg from svn, that seems like the > obvious choice - but I've been a bit unhappy with my hg experiences and > with some of the discussions about how Python's workflow needs to change > to accommodate it. I initially struggled to get my head around git, but > now that I am becoming more familiar with it I like it alot. Windows > support for both is currently fairly reasonable - especially if you > don't care too much about "tortoise" style shell integration - which I > don't. Both hg and git finally seem to have workable options to support > Windows line-endings in files. > > Does anyone else in pywin32-land have any opinions about this? Does > anyone feel strongly one way or another? I have no strong feelings: I've toyed with Hg (basically because Python and pywin32 had both announced plans to move that way). I've used git recently because I wanted to pull some stuff from github. I've never used bzr, but would if someone advertised a bzr-based project I was interested in using. We continue to use svn at work and I continue to host my personal projects via svn. Something which I think makes a difference but which hasn't been mentioned is the needs of a particular project when making this choice -- as opposed to the intrinsic merits and established userbase of any one of of the contenders. pywin32 has a very small developer community and a very simple development process. The nature of the code makes that unlikely to change. It doesn't have, therefore, the same issues that the Python codebase is facing: quite a few developers, each applying long-established workflows which don't quite map on to the Hg worldview. There is a certain symmetry in that the hg codebase itself uses pywin32... so pywin32 might as well use hg. On the other hand, that might be a cause of problems as the two trip over each other's feet :) I say: go for Hg as it is broadly acceptable by many people and aligns, current wrangling notwithstanding, with the choice made by the Python development community. TJG From mail at timgolden.me.uk Tue Feb 8 10:23:47 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 08 Feb 2011 09:23:47 +0000 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D510B10.9090600@timgolden.me.uk> References: <4D50781D.6010309@skippinet.com.au> <4D510B10.9090600@timgolden.me.uk> Message-ID: <4D510BA3.2080309@timgolden.me.uk> On 08/02/2011 09:21, Tim Golden wrote: > Something which I think makes a difference but which hasn't been > mentioned is the needs of a particular project when making this > choice [...] .... and the conclusion I failed to state here was that I think that it matter less whether this or that DVCS offers better branching / merging / rebasing / whatever since there just isn't that much complexity to the development process. TJG From mc at mclaveau.com Wed Feb 9 15:36:19 2011 From: mc at mclaveau.com (Michel Claveau) Date: Wed, 9 Feb 2011 15:36:19 +0100 Subject: [python-win32] IE (ocx) OK, but python never close In-Reply-To: <4D509C63.1030902@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> Message-ID: <7B1CBBB62D9A4E6996450D3048C1B1C0@MCI1330> Hi! Starting of a super-exemple from the great Mark Hammond, I made a window with IE (ocx) embbed. It run OK. Thanks to Pywin32's authors. But... When my script terminate, Python never close. My code is huge, but I made a mini-version with the same problem. This script is below. Any idea for a solution? Thanks in advance. Michel Claveau ======================================================= # -*- coding: utf-8 -*- import time,sys,ctypes import win32ui, win32gui, win32con, win32api, win32uiole, win32com.client # fenetre (window) w_hinst = win32gui.dllhandle wc = win32gui.WNDCLASS() wc.lpszClassName = "Mini_win - {Echap} pour fermer. " wc.style = win32con.CS_GLOBALCLASS| win32con.CS_VREDRAW | win32con.CS_HREDRAW wc.hbrBackground = ctypes.windll.gdi32.GetStockObject(ctypes.c_int(win32con.LTGRAY_BRUSH)) wc.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW) class_atom = win32gui.RegisterClass(wc) style = win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU w_hwnd = win32gui.CreateWindowEx(0, class_atom,"mini_WIN", style, 40,10, 800,480, 0, 0, w_hinst, None) w_pyw = win32ui.CreateWindowFromHandle(w_hwnd) # IE COM/cx WebBrowserModule = win32com.client.gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) if WebBrowserModule is None: raise ImportError("IE non trouv?") class MyWebBrowser(WebBrowserModule.WebBrowser): def __init__(self): self.__dict__["_dispobj_"] = None def CreateControl(self, windowTitle, style, rect, parent, id, lic_string=None): self.hwnd = win32ui.CreateControl(str(self.CLSID), windowTitle, style, rect, parent, id, None, False, lic_string) self.__dict__["_obj_"] = self.hwnd self.dispobj = self.default_interface(win32uiole.GetIDispatchForWindow(self._obj_)) self.__dict__["_dispobj_"] = self.dispobj win32ui.EnableControlContainer() ocx = MyWebBrowser() ieocx = ocx.CreateControl("Web Browser", win32con.WS_TABSTOP | win32con.WS_VISIBLE, (0,20,800,480), w_pyw, 3456) ocx.Navigate("http://google.fr") # waiting close/escape while True: if win32gui.GetActiveWindow() != w_hwnd: break if (win32api.GetKeyState(win32con.VK_ESCAPE) & 0x8000): break time.sleep(0.01) win32gui.PumpWaitingMessages() # close win try: win32gui.DestroyWindow(w_hwnd) except: pass time.sleep(0.250) #quit python print 62 print sys.exit() print 64 ======================================================= From vernondcole at gmail.com Wed Feb 9 16:11:50 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 9 Feb 2011 08:11:50 -0700 Subject: [python-win32] IE (ocx) OK, but python never close In-Reply-To: <7B1CBBB62D9A4E6996450D3048C1B1C0@MCI1330> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> <7B1CBBB62D9A4E6996450D3048C1B1C0@MCI1330> Message-ID: Michel: Without actually analyzing you script, I see one thing immediately... You expect Windows and Internet Explorer to actually respond quickly. Your timeout for the shutdown is 1/4 second. When last I tried to automate Windows functions, I gave up on using fixed timers, because sometimes it would take a minute or more for my target window, or Windows itself, to respond. My ugly work-around was (in the Python script) to watch for the target window to change size, so I knew it reacted to the first input before sending the next. Without adaptive timing, my delays had to be ridiculously long, because usually response _was_ timely. (I finally ended up displaying a new window which was a cartoon of a skeleton looking at a computer screen which displayed "PLEASE WAIT". It made the correct impression on the users, and they kept their hands off the mouse.) Of course, that may not be the problem at all, and your long script may already allow for a slow system. -- Vernon -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Wed Feb 9 17:28:08 2011 From: mc at mclaveau.com (Michel Claveau) Date: Wed, 9 Feb 2011 17:28:08 +0100 Subject: [python-win32] IE (ocx) OK, but python never close In-Reply-To: References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> <7B1CBBB62D9A4E6996450D3048C1B1C0@MCI1330> Message-ID: <7C1177E4EA124984BF686F36B9182F3F@MCI1330> Re ! > You expect Windows and Internet Explorer to actually respond quickly. Yes. It is the case for my computers. IE start in 4 s (1st launch, then 2 s) in my slowest machine. On fast CPU: 2 s (1st) & then immediatly. > I gave up on using fixed timers, because sometimes it would take a minute > or more for my target window, or Windows itself, to respond. Aarrrgggghhhhh!!!!!! In a similar case, I defer to the abacus... > Of course, that may not be the problem at all Before ask help in this list, I tried dozens of differents things (but not THE good...) The problem disappears when I use a local URL (ex.: file:///C:/test.html ). It come back if I "Navigate()" on web's URL. After close the windows with the ocx, later in scripts, Python run OK: I can open others windows, call functions, scripts, etc. All run OK... until the end. And, here, Python do not close... If I comment these 2 lines: #ieocx = ocx.CreateControl("Web Browser", win32con.WS_TABSTOP | win32con.WS_VISIBLE, (0,20,800,480), w_pyw, 3456) #ocx.Navigate("http://google.fr") all my scripts/tests run OK. Good day! And sorry for my poor english... -- Michel Claveau From mc at mclaveau.com Wed Feb 9 18:33:10 2011 From: mc at mclaveau.com (Michel Claveau) Date: Wed, 9 Feb 2011 18:33:10 +0100 Subject: [python-win32] IE (ocx) OK, but python never close In-Reply-To: <7C1177E4EA124984BF686F36B9182F3F@MCI1330> References: <4D50781D.6010309@skippinet.com.au><1297123040.645.1419469863@webmail.messagingengine.com><4D50960B.3050600@skippinet.com.au><4D509C63.1030902@skippinet.com.au><7B1CBBB62D9A4E6996450D3048C1B1C0@MCI1330> <7C1177E4EA124984BF686F36B9182F3F@MCI1330> Message-ID: Re! News: - no problem on XP - no problem on Vista - but, on win 7, I try with 6 computers. One no have the problem. Five have... (32 and 64 bits) I do not know why... @+ -- MCi From bburan at cns.nyu.edu Thu Feb 10 23:33:28 2011 From: bburan at cns.nyu.edu (Brad Buran) Date: Thu, 10 Feb 2011 17:33:28 -0500 Subject: [python-win32] speed of win32com versus comtypes In-Reply-To: <4D40D6C1.7030504@gmail.com> References: <4D40D6C1.7030504@gmail.com> Message-ID: Hi Mark: I finally had a chance to sit down and test your suggestion. It worked beautifully. The speed is now on-par with that of comtypes. Since I'm not really sure what _get_good_object_ does, anything I should need to watch out for since I've bypassed _get_good_object_? Brad On Wed, Jan 26, 2011 at 9:21 PM, Mark Hammond wrote: > On 26/01/2011 3:38 PM, Brad Buran wrote: >> >> I've been using win32com.client for the past year or so. ?Recently, I >> noticed that there was a bottleneck in my code, and I tracked this >> down to _get_good_single_object (line 478). ?When using comtypes >> instead of win32com.client, calling the ReadTagVEX method on my COM >> object is 4.8 times faster so the slowdown appears to be in >> _get_good_object_. ?The COM function in question, ReadTagVEX, is >> supposed to return an Array of VARIANT. ?These arrays are quite large >> (on the order of 100,000 or 200,000 samples) on each read. >> >> I'd much rather stick with win32com.client if possible. ?Are there any >> suggestions for speeding up this function? ?I already know that the >> array returned will be an array of float32. > > You could just call InvokeTypes directly using a copy-paste of the generated > makepy code - somewhat ugly, but probably effective. > > (There is probably an optimization opportunity to avoid the call to > _get_good_object completely when the result of the function is other than a > generic "object" (ie, VT_DISPATCH) or array of such objects - but in this > case, the function declares it does return a generic VT_DISPATCH, so the > optimization wouldn't be able to be used in this particular case...) > > Mark > From mhammond at skippinet.com.au Fri Feb 11 00:30:52 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 11 Feb 2011 10:30:52 +1100 Subject: [python-win32] speed of win32com versus comtypes In-Reply-To: References: <4D40D6C1.7030504@gmail.com> Message-ID: <4D54752C.3040101@skippinet.com.au> On 11/02/2011 9:33 AM, Brad Buran wrote: > Hi Mark: > > I finally had a chance to sit down and test your suggestion. It > worked beautifully. The speed is now on-par with that of comtypes. > Since I'm not really sure what _get_good_object_ does, anything I > should need to watch out for since I've bypassed _get_good_object_? If the function ever returned a COM object instead of a "simple" type, you would get back a "low-level" COM object that doesn't quite work as you expect (but even then, it would be trivial to manually "wrap" it like _get_good_object_ does. Cheers, Mark. > > Brad > > On Wed, Jan 26, 2011 at 9:21 PM, Mark Hammond wrote: >> On 26/01/2011 3:38 PM, Brad Buran wrote: >>> >>> I've been using win32com.client for the past year or so. Recently, I >>> noticed that there was a bottleneck in my code, and I tracked this >>> down to _get_good_single_object (line 478). When using comtypes >>> instead of win32com.client, calling the ReadTagVEX method on my COM >>> object is 4.8 times faster so the slowdown appears to be in >>> _get_good_object_. The COM function in question, ReadTagVEX, is >>> supposed to return an Array of VARIANT. These arrays are quite large >>> (on the order of 100,000 or 200,000 samples) on each read. >>> >>> I'd much rather stick with win32com.client if possible. Are there any >>> suggestions for speeding up this function? I already know that the >>> array returned will be an array of float32. >> >> You could just call InvokeTypes directly using a copy-paste of the generated >> makepy code - somewhat ugly, but probably effective. >> >> (There is probably an optimization opportunity to avoid the call to >> _get_good_object completely when the result of the function is other than a >> generic "object" (ie, VT_DISPATCH) or array of such objects - but in this >> case, the function declares it does return a generic VT_DISPATCH, so the >> optimization wouldn't be able to be used in this particular case...) >> >> Mark >> From rsyring at inteli-com.com Tue Feb 15 06:58:03 2011 From: rsyring at inteli-com.com (Randy Syring) Date: Tue, 15 Feb 2011 00:58:03 -0500 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: <4D509C63.1030902@skippinet.com.au> References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> Message-ID: <4D5A15EB.3040709@inteli-com.com> FWIW, I started out with Git and even read through the Pro Git book (which was very good and very helpful): http://progit.org/ I used it for several months, but I ended up abandoning it because of what seemed to be second class support on Windows and, secondarily, my own difficulty in just getting used to it. I tried HG next and have *never* looked back. The only thing that ever made me miss git was github, but since Atlassian has taken over bitbucket I am extremely pleased with the HG/BB combination and I convert everything from SVN at my first opportunity. The only thing that irritates me is that I can't use SSH repo URLs on windows without using TortoiseHG, at least, I haven't taken the time to get it working with the hg command line version (which is likely a platform issue, not HG's fault). Anyway, it seems no one had any strong objections to HG. Mark, does that mean you will be moving to HG? -------------------------------------- Randy Syring Intelicom Direct: 502-276-0459 Office: 502-212-9913 For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord (Rom 6:23) On 02/07/2011 08:29 PM, Mark Hammond wrote: > On 8/02/2011 12:17 PM, Vernon Cole wrote: >> My personal stuff is on bzr and I have put my open source stuff on hg, >> partly because you said you were switching to it. A 3rd dvcs is one too >> many IMHO. > > Yeah - back in April 2009 I stated I would move to hg. But given the > time that passed, a few personal experiences and the various > discussions on python-dev about some if the pain it is facing, I was > looking if anyone's experience over the last couple of years could > sway me away from it. Apparently not - which I *think* is good :) > > Cheers, > > Mark > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From news3 at mystrobl.de Tue Feb 15 08:31:27 2011 From: news3 at mystrobl.de (Wolfgang Strobl) Date: Tue, 15 Feb 2011 08:31:27 +0100 Subject: [python-win32] DVCS options for pywin32 References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> <4D5A15EB.3040709@inteli-com.com> Message-ID: Randy Syring : >The only thing that irritates me is that I can't use SSH repo URLs on >windows without using TortoiseHG, at least, I haven't taken the time to >get it working with the hg command line version (which is likely a >platform issue, not HG's fault). I'm not quite sure what you mean by "without using TortoiseHG". I use TortoiseHG, which comes with hg.exe, so I don't see a point in installing a separate command line compilation of a bare Mercurial, so I don't know (or usually care) whether it works without having TortoiseHG installed. Anyway, the command line version (hg.exe) works like a charm, here, when using ssh repos on Windows XP (32) and 7 (both 32 and 64). I'm using pageant from PuTTY, btw. -- Thank you for observing all safety precautions From kobben at itc.nl Tue Feb 15 11:47:39 2011 From: kobben at itc.nl (B Kobben) Date: Tue, 15 Feb 2011 10:47:39 +0000 (UTC) Subject: [python-win32] Python and ASP - failure on 2nd and subsequent page loads References: <32AA3A83235A25458AB5387177B883F8110C528AEE@MAIL.ith.local> <4AD6B37F.4030108@gmail.com> <32AA3A83235A25458AB5387177B883F8110F499D5B@MAIL.ith.local> <31d943390910161222l419f5482t3056cc56d5cb5a89@mail.gmail.com> <4AD8F725.9040903@skippinet.com.au> <31d943390910190934k745669c1s1afab70f7cffd413@mail.gmail.com> <31d943390910191139i3c72078cn612dfc63f97019af@mail.gmail.com> Message-ID: Mark, in the beginning of this thread you said: > I will check that into cvs > so the next pywin32 version will have that fixed. But after installing Python 2.7 the problem did return and your solution worked again, so it looks like still not solved in the codebase...? yours, -- Barend K?bben ITC - University of Twente, Faculty of Geo-Information Science and Earth Observation PO Box 217, 7500AE Enschede (The Netherlands) From rsyring at inteli-com.com Tue Feb 15 19:10:08 2011 From: rsyring at inteli-com.com (Randy Syring) Date: Tue, 15 Feb 2011 13:10:08 -0500 Subject: [python-win32] DVCS options for pywin32 In-Reply-To: References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> <4D5A15EB.3040709@inteli-com.com> Message-ID: <4D5AC180.2020503@inteli-com.com> On 02/15/2011 02:31 AM, Wolfgang Strobl wrote: > Randy Syring: > >> The only thing that irritates me is that I can't use SSH repo URLs on >> windows without using TortoiseHG, at least, I haven't taken the time to >> get it working with the hg command line version (which is likely a >> platform issue, not HG's fault). > I'm not quite sure what you mean by "without using TortoiseHG". I use > TortoiseHG, which comes with hg.exe, so I don't see a point in > installing a separate command line compilation of a bare Mercurial, so I > don't know (or usually care) whether it works without having TortoiseHG > installed. Anyway, the command line version (hg.exe) works like a > charm, here, when using ssh repos on Windows XP (32) and 7 (both 32 and > 64). I'm using pageant from PuTTY, btw. > > I was referring to the inability I was having to do an 'hg clone ssh://... myproj'. However, after posting that last night, I did a little research, and it looks like I just need to do some configuring: http://mercurial.selenic.com/wiki/AccessingSshRepositoriesFromWindows Sorry for the bad info. -------------------------------------- Randy Syring Intelicom Direct: 502-276-0459 Office: 502-212-9913 For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord (Rom 6:23) From news3 at mystrobl.de Tue Feb 15 20:10:46 2011 From: news3 at mystrobl.de (Wolfgang Strobl) Date: Tue, 15 Feb 2011 20:10:46 +0100 Subject: [python-win32] DVCS options for pywin32 References: <4D50781D.6010309@skippinet.com.au> <1297123040.645.1419469863@webmail.messagingengine.com> <4D50960B.3050600@skippinet.com.au> <4D509C63.1030902@skippinet.com.au> <4D5A15EB.3040709@inteli-com.com> <4D5AC180.2020503@inteli-com.com> Message-ID: <9rill6t6v9kaj2t57pcto64436o986ohe3@4ax.com> Randy Syring : >On 02/15/2011 02:31 AM, Wolfgang Strobl wrote: >> Randy Syring: >> >>> The only thing that irritates me is that I can't use SSH repo URLs on >>> windows without using TortoiseHG, at least, I haven't taken the time to >>> get it working with the hg command line version (which is likely a >>> platform issue, not HG's fault). >> I'm not quite sure what you mean by "without using TortoiseHG". I use >> TortoiseHG, which comes with hg.exe, so I don't see a point in >> installing a separate command line compilation of a bare Mercurial, so I >> don't know (or usually care) whether it works without having TortoiseHG >> installed. Anyway, the command line version (hg.exe) works like a >> charm, here, when using ssh repos on Windows XP (32) and 7 (both 32 and >> 64). I'm using pageant from PuTTY, btw. >> >> >I was referring to the inability I was having to do an 'hg clone >ssh://... myproj'. Well, so was I. >However, after posting that last night, I did a >little research, and it looks like I just need to do some configuring: >http://mercurial.selenic.com/wiki/AccessingSshRepositoriesFromWindows Right. As I said above, I'm usually using pageant from the putty distribution for managing my private keys. Sometimes, when I've haven't loaded a necessary key into the pageant key list yet, TortoisePlink steps into the breach by asking for a password. Usually, I cancel the operation, adds the necessary key to pageant and repeat the action, -- Thank you for observing all safety precautions From abhi.forall at gmail.com Wed Feb 16 04:54:39 2011 From: abhi.forall at gmail.com (abhijeet mahagaonkar) Date: Wed, 16 Feb 2011 09:24:39 +0530 Subject: [python-win32] Python for Outlook Message-ID: Dear Pythoners, I'm working on creating an application which will continuously monitor my outlook inbox and wait for a new incoming mail. It will scan To and cc fields and forward the email to another address appropriately. I want a few pointers on how best I will be able to achieve this. Thanks in advance. Abhijeet -------------- next part -------------- An HTML attachment was scrubbed... URL: From abhi.forall at gmail.com Wed Feb 16 06:04:36 2011 From: abhi.forall at gmail.com (abhijeet mahagaonkar) Date: Wed, 16 Feb 2011 10:34:36 +0530 Subject: [python-win32] Python for Outlook In-Reply-To: <20110216043007.GB11597@testhost.hutman.net> References: <20110216043007.GB11597@testhost.hutman.net> Message-ID: Hi Kelly, I'm using IMAP. Could you please let me know the which modules i can use? Warm Regards, Abhijeet. On Wed, Feb 16, 2011 at 10:00 AM, Kelly Black wrote: > > Abhijeet, > > Can you use POP3 or IMAP? There are some modules in Python to handle > mail using IMAP and POP3 - (along with the SMTP module, you could have > something in no time). > > Kelly > > On Wed, Feb 16, 2011 at 09:24:39AM +0530, abhijeet mahagaonkar wrote: > > Dear Pythoners, > > > > I'm working on creating an application which will continuously monitor my > > outlook inbox and wait for a new incoming mail. > > It will scan To and cc fields and forward the email to another address > > appropriately. > > > > I want a few pointers on how best I will be able to achieve this. > > > > Thanks in advance. > > > > Abhijeet > > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kelly at hutman.net Wed Feb 16 05:30:07 2011 From: kelly at hutman.net (Kelly Black) Date: Tue, 15 Feb 2011 22:30:07 -0600 Subject: [python-win32] Python for Outlook References: Message-ID: <20110216043007.GB11597@testhost.hutman.net> Abhijeet, Can you use POP3 or IMAP? There are some modules in Python to handle mail using IMAP and POP3 - (along with the SMTP module, you could have something in no time). Kelly On Wed, Feb 16, 2011 at 09:24:39AM +0530, abhijeet mahagaonkar wrote: > Dear Pythoners, > > I'm working on creating an application which will continuously monitor my > outlook inbox and wait for a new incoming mail. > It will scan To and cc fields and forward the email to another address > appropriately. > > I want a few pointers on how best I will be able to achieve this. > > Thanks in advance. > > Abhijeet > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From matteo.boscolo at boscolini.eu Thu Feb 17 17:30:25 2011 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Thu, 17 Feb 2011 17:30:25 +0100 Subject: [python-win32] How to create a empty com object Message-ID: <4D5D4D21.5020002@boscolini.eu> Hi all, I have a property that need an empty comobject |C++ definition: HRESULT activeComponent( [out, retval] ITDComponent** pVal) HRESULT activeComponent([in] ITDComponent* pVal)| how can I do it with python ?? In vb6 i use the following code: pComponent.Document.activeComponent = Nothing Thanks, Matteo -------------- next part -------------- An HTML attachment was scrubbed... URL: From dot_masr at yahoo.com Fri Feb 18 10:29:02 2011 From: dot_masr at yahoo.com (Pwanani Pwanani) Date: Fri, 18 Feb 2011 01:29:02 -0800 (PST) Subject: [python-win32] regmon realtime Message-ID: <523831.16205.qm@web120307.mail.ne1.yahoo.com> Dear All, im trying to write a realtime registry monitor is it possible to do that with win32api ? and if so do you have a sample recipe i can have a look at ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Fri Feb 18 11:04:49 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 18 Feb 2011 03:04:49 -0700 Subject: [python-win32] FW: python-win32 image fields problem In-Reply-To: References: Message-ID: Dardo: Thanks for the data base you sent me. It allowed me to do a good test of large binary data, and the scenery in the images is beautiful. I assume they are images from the Canary Islands. Also thanks for the VB sample program. Why does anyone use Visual Basic? Python is so much simpler, as you will see from the examples I am attaching. I am attaching three Python programs, each is a simple example of inserting, updating, or selecting a .jpg image. The database, image file names, and the record to update are hard coded in two of them, you can figure out how you want to specify them. The showpix.py program accepts a single command line argument, the record number (Codigo) of the image you want to see. It uses your computer's default image viewer to display the image. I've tested them on several versions of Python, 2.6 to 3.1, and they work as intended. BUT -- you MUST get a copy of the latest adodbapi from http://sourceforge.net/projects/adodbapi/ . There is a bug reading large binary fields in the older versions. -- Vernon On Feb 3, 2011 4:24 AM, "Dardo Schuster Glez" > wrote: > > > > > > > > > > Dear Sir > > > > How can y show a jpg that is in a SQL Server image field in a Qlabel > object ??? and how to change and save it in the image field ??? > > > > Thanks > > Dardo Schuster > > Tenerife - Canary Islands - Spain > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: showpix.py Type: application/octet-stream Size: 1622 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: modifypix.py Type: application/octet-stream Size: 1329 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: storepix.py Type: application/octet-stream Size: 1334 bytes Desc: not available URL: From reckoner at gmail.com Fri Feb 18 21:32:28 2011 From: reckoner at gmail.com (reckoner) Date: Fri, 18 Feb 2011 12:32:28 -0800 Subject: [python-win32] Automation triggered based on image in window? Message-ID: <4D5ED75C.4030104@gmail.com> I'm trying to do some automation using Python and pywin. Is there a way to trigger when a particular image is shown? In other words, I am trying to get the functionality that is described here: http://www.vtaskstudio.com/images/screenshot_recognition.png and likewise here: http://www.autohotkey.com/docs/commands/ImageSearch.htm using Python tools. Anybody know anything like this? From mhammond at skippinet.com.au Sat Feb 19 01:03:28 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 19 Feb 2011 11:03:28 +1100 Subject: [python-win32] How to create a empty com object In-Reply-To: References: Message-ID: <4D5F08D0.3010903@skippinet.com.au> [Re-added the python-win32 list - please keep replies on list] On 19/02/2011 12:51 AM, matteo.boscolo at boscolini.eu wrote: > with None It dose not work .. In what way doesn't it work? AFAIK, None is the closest thing Python has to Nothing - although you could try setting it to pythoncon.Empty See the docs for nothing at http://msdn.microsoft.com/en-us/library/0x9tb07z.aspx > I need to create an empty ITDComponent I think .. There isn't really any such thing... Cheers, Mark > > regards, > Matteo > > From: "Mark Hammond" skippy.hammond at gmail.com > To: "Matteo Boscolo" matteo.boscolo at boscolini.eu > Cc: > Date: Fri, 18 Feb 2011 17:09:50 +1100 > Subject: Re: [python-win32] How to create a empty com object > > > On 18/02/2011 3:30 AM, Matteo Boscolo wrote: > > > Hi all, > > > I have a property that need an empty comobject > > > > > > |C++ definition: > > > HRESULT activeComponent( > > > [out, retval] ITDComponent** pVal) > > > HRESULT activeComponent([in] ITDComponent* pVal)| > > > > > > how can I do it with python ?? > > > In vb6 i use the following code: > > > pComponent.Document.activeComponent = Nothing > > > > You might find setting it to None works... > > > > HTH, > > > > Mark From cappy2112 at gmail.com Sat Feb 19 18:45:20 2011 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sat, 19 Feb 2011 09:45:20 -0800 Subject: [python-win32] Automation triggered based on image in window? Message-ID: > > > Date: Fri, 18 Feb 2011 12:32:28 -0800 > From: reckoner > To: Python-Win32 List > Subject: [python-win32] Automation triggered based on image in window? > Message-ID: <4D5ED75C.4030104 at gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > I'm trying to do some automation using Python and pywin. Is there a way > to trigger when a particular image is shown? > > In other words, I am trying to get the functionality that is described > here: > > http://www.vtaskstudio.com/images/screenshot_recognition.png > > and likewise here: > > http://www.autohotkey.com/docs/commands/ImageSearch.htm > > using Python tools. > > Anybody know anything like this? > > > Take a look at Sikuli. http://groups.csail.mit.edu/uid/sikuli/download.shtml It's not pure python it requires the JVM, and is still in its early stages. But it does provide image recognition based events. It's quite an ambitious project, but I think it still is a bit cumbersome to use. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matteo.boscolo at boscolini.eu Sun Feb 20 21:42:45 2011 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Sun, 20 Feb 2011 21:42:45 +0100 Subject: [python-win32] How to create a empty com object In-Reply-To: <4D5F08D0.3010903@skippinet.com.au> References: <4D5F08D0.3010903@skippinet.com.au> Message-ID: <4D617CC5.4050509@boscolini.eu> I did some other search I try to pass a object() to the activeComponent but the active component need a COM VARIANT.. there is any way to create a null COM VARIANT ? or to pass a c++ NULL equivalent object ? regards, Matteo Il 19/02/2011 01:03, Mark Hammond ha scritto: > [Re-added the python-win32 list - please keep replies on list] > > On 19/02/2011 12:51 AM, matteo.boscolo at boscolini.eu wrote: >> with None It dose not work .. > > In what way doesn't it work? AFAIK, None is the closest thing Python > has to Nothing - although you could try setting it to pythoncon.Empty > > See the docs for nothing at > http://msdn.microsoft.com/en-us/library/0x9tb07z.aspx > >> I need to create an empty ITDComponent I think .. > > There isn't really any such thing... > > Cheers, > > Mark >> >> regards, >> Matteo >> >> From: "Mark Hammond" skippy.hammond at gmail.com >> To: "Matteo Boscolo" matteo.boscolo at boscolini.eu >> Cc: >> Date: Fri, 18 Feb 2011 17:09:50 +1100 >> Subject: Re: [python-win32] How to create a empty com object >> >> > On 18/02/2011 3:30 AM, Matteo Boscolo wrote: >> > > Hi all, >> > > I have a property that need an empty comobject >> > > >> > > |C++ definition: >> > > HRESULT activeComponent( >> > > [out, retval] ITDComponent** pVal) >> > > HRESULT activeComponent([in] ITDComponent* pVal)| >> > > >> > > how can I do it with python ?? >> > > In vb6 i use the following code: >> > > pComponent.Document.activeComponent = Nothing >> > >> > You might find setting it to None works... >> > >> > HTH, >> > >> > Mark > > > > > ----- > Nessun virus nel messaggio. > Controllato da AVG - www.avg.com > Versione: 10.0.1204 / Database dei virus: 1435/3451 - Data di > rilascio: 18/02/2011 > > From mhammond at skippinet.com.au Sun Feb 20 23:24:05 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 21 Feb 2011 09:24:05 +1100 Subject: [python-win32] How to create a empty com object In-Reply-To: <4D617CC5.4050509@boscolini.eu> References: <4D5F08D0.3010903@skippinet.com.au> <4D617CC5.4050509@boscolini.eu> Message-ID: <4D619485.609@skippinet.com.au> On 21/02/2011 7:42 AM, Matteo Boscolo wrote: > > I did some other search I try to pass a object() to the activeComponent > but the active component need a COM VARIANT.. > > there is any way to create a null COM VARIANT ? > or to pass a c++ NULL equivalent object ? win32com automatically creates a variant - if you pass None, it will create a variant with VT_NULL, and if you pass pythoncom.Empty, it will pass a variant with VT_EMPTY. If Empty also doesn't work, I'm afraid I'm out of ideas... Cheers, Mark. From mhammond at skippinet.com.au Mon Feb 21 01:40:52 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 21 Feb 2011 11:40:52 +1100 Subject: [python-win32] [ANN] pywin32 build 215 released. Message-ID: <4D61B494.6090202@skippinet.com.au> Hi all, I'm happy to announce the release of pywin32 build 215. This release has relatively few changes since build 214, although a number of bugs have been addressed - the notable changes are: * The build process no longer includes a "manifest" in python 2.6 and later versions - this should hopefully avoid failure to load the modules in some environments (specifically, it should avoid "module not found" type errors thrown by Windows.) * Pythonwin should have much better support for non-US keyboards - eg, calltips should now be displayed regardless of where the '(' key happens to be located on your keyboard. * Updated adodbapi. * Support for Python 3.2 and 2.7. As always, thanks to everyone who contributed (both code and issues) to this release! Get it now via: https://sourceforge.net/projects/pywin32/files/pywin32/Build%20215/ Cheers, Mark. From skippy.hammond at gmail.com Mon Feb 21 01:52:48 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 21 Feb 2011 11:52:48 +1100 Subject: [python-win32] Python and ASP - failure on 2nd and subsequent page loads In-Reply-To: References: <32AA3A83235A25458AB5387177B883F8110C528AEE@MAIL.ith.local> <4AD6B37F.4030108@gmail.com> <32AA3A83235A25458AB5387177B883F8110F499D5B@MAIL.ith.local> <31d943390910161222l419f5482t3056cc56d5cb5a89@mail.gmail.com> <4AD8F725.9040903@skippinet.com.au> <31d943390910190934k745669c1s1afab70f7cffd413@mail.gmail.com> <31d943390910191139i3c72078cn612dfc63f97019af@mail.gmail.com> Message-ID: <4D61B760.6070509@gmail.com> On 15/02/2011 9:47 PM, B Kobben wrote: > Mark, in the beginning of this thread you said: > >> I will check that into cvs >> so the next pywin32 version will have that fixed. > > But after installing Python 2.7 the problem did return and your solution worked > again, so it looks like still not solved in the codebase...? It was checked into CVS, but no new binary release of pywin32 had been made. You should find it fixed in the newly released build 215. Cheers, Mark From vernondcole at gmail.com Mon Feb 21 05:37:55 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Sun, 20 Feb 2011 21:37:55 -0700 Subject: [python-win32] [ANN] pywin32 build 215 released. In-Reply-To: <4D61B494.6090202@skippinet.com.au> References: <4D61B494.6090202@skippinet.com.au> Message-ID: Mark: Trouble! in build 215, the Python 3 versions of adodbapi are broken. It seems that when 2to3 is run on adodbapi.py, the "raise" filter is missing, so that two syntax errors are left in the module. -- Vernon On Sun, Feb 20, 2011 at 5:40 PM, Mark Hammond wrote: > Hi all, > I'm happy to announce the release of pywin32 build 215. > > This release has relatively few changes since build 214, although a number > of bugs have been addressed - the notable changes are: > > * The build process no longer includes a "manifest" in python 2.6 and later > versions - this should hopefully avoid failure to load the modules in some > environments (specifically, it should avoid "module not found" type errors > thrown by Windows.) > > * Pythonwin should have much better support for non-US keyboards - eg, > calltips should now be displayed regardless of where the '(' key happens > to be located on your keyboard. > > * Updated adodbapi. > > * Support for Python 3.2 and 2.7. > > As always, thanks to everyone who contributed (both code and issues) to > this release! > > Get it now via: > https://sourceforge.net/projects/pywin32/files/pywin32/Build%20215/ > > Cheers, > > Mark. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Mon Feb 21 05:47:28 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 21 Feb 2011 15:47:28 +1100 Subject: [python-win32] [ANN] pywin32 build 215 released. In-Reply-To: References: <4D61B494.6090202@skippinet.com.au> Message-ID: <4D61EE60.6060803@skippinet.com.au> On 21/02/2011 3:37 PM, Vernon Cole wrote: > Mark: > Trouble! > in build 215, the Python 3 versions of adodbapi are broken. > It seems that when 2to3 is run on adodbapi.py, the "raise" filter is > missing, so that two syntax errors are left in the module. Ouch! I'll look into this in the next day or so and if no other serious problems are reported, I'll probably just release the 3.x versions as a build 215.1. If you have any time, helping to work out exactly what changes to setup.py are needed would help me alot :) Thanks, Mark From mc at mclaveau.com Mon Feb 21 07:36:17 2011 From: mc at mclaveau.com (Michel Claveau) Date: Mon, 21 Feb 2011 07:36:17 +0100 Subject: [python-win32] [ANN] pywin32 build 215 released. In-Reply-To: <4D61B494.6090202@skippinet.com.au> References: <4D61B494.6090202@skippinet.com.au> Message-ID: <97282607A8E04B83AB54EE11A4A3F490@MCI1330> Hi! Download Uninstall 214 Install 215 for Py 2.6 (under Windows 7 ultimate 32 bits) And... this message: --------------------------- AutoIt v3: PonxTest101.exe - Erreur syst?me --------------------------- Impossible de d?marrer le programme car il manque MSVCR90.dll sur votre ordinateur. Essayez de r?installer le programme pour corriger ce probl?me. OK, I know how to... but the back of this old problem gives a bad reputation. Then, no other problem. @-salutations -- Michel Claveau From mc at mclaveau.com Mon Feb 21 08:33:38 2011 From: mc at mclaveau.com (Michel Claveau) Date: Mon, 21 Feb 2011 08:33:38 +0100 Subject: [python-win32] [ANN] pywin32 build 215 released. In-Reply-To: <97282607A8E04B83AB54EE11A4A3F490@MCI1330> References: <4D61B494.6090202@skippinet.com.au> <97282607A8E04B83AB54EE11A4A3F490@MCI1330> Message-ID: Re ! ...and aaarrrggghhh!!! After install msvcr90.dll, Pywin32/215 is OK. But no. Several softwares, who call my COM servers (written with python/pywin32) give this message: --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: D:\Dev\python\xxx.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. Curiously, no problem with python's scripts. Uninstall 215 and reinstall 214 delete the problem. Others infos: Python 2.6.5 ; Win7-32bits ; UAC disable ; user is admin @-salutations -- Michel Claveau From maubriga at gmail.com Mon Feb 21 10:52:34 2011 From: maubriga at gmail.com (Mauro) Date: Mon, 21 Feb 2011 09:52:34 +0000 Subject: [python-win32] [ANN] pywin32 build 215 released. In-Reply-To: References: <4D61B494.6090202@skippinet.com.au> <97282607A8E04B83AB54EE11A4A3F490@MCI1330> Message-ID: Michel, I saw this error in two occasions: - When I had an older version of numpy (updated numpy and it worked) - When I import scikits timeseries. This package contains some pyd files, and the error was related to importing those. Unfortunately I was never able to solve this problem. (See http://mail.python.org/pipermail/python-win32/2011-January/011124.html Mauro On Mon, Feb 21, 2011 at 7:33 AM, Michel Claveau wrote: > Re ! > > ...and aaarrrggghhh!!! > > After install msvcr90.dll, Pywin32/215 is OK. > But no. > Several softwares, who call my COM servers (written with python/pywin32) > give this message: > ?--------------------------- > ?Microsoft Visual C++ Runtime Library > ?--------------------------- > ?Runtime Error! > > ?Program: D:\Dev\python\xxx.exe > > ?R6034 > > ?An application has made an attempt to load the C runtime library > incorrectly. > ?Please contact the application's support team for more information. > > Curiously, no problem with python's scripts. > Uninstall 215 and reinstall 214 ?delete the problem. > Others infos: ?Python 2.6.5 ; Win7-32bits ; UAC disable ; user is admin > > @-salutations > -- > Michel Claveau > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From timr at probo.com Mon Feb 21 22:48:44 2011 From: timr at probo.com (Tim Roberts) Date: Mon, 21 Feb 2011 13:48:44 -0800 Subject: [python-win32] regmon realtime In-Reply-To: <523831.16205.qm@web120307.mail.ne1.yahoo.com> References: <523831.16205.qm@web120307.mail.ne1.yahoo.com> Message-ID: <4D62DDBC.4060407@probo.com> Pwanani Pwanani wrote: > > im trying to write a realtime > registry monitor is it possible to do that with win32api ? and if so do > you have a sample recipe i can have a look at ? > > If you are looking to monitor only a single registry key, you can use the RegNotifyChangeKeyValue API, and you should even be able to do this from Python. If you set fAsynchronous to false, it blocks until something in the key changes, then returns to you. If you are hoping to monitor the entire registry, that requires the assistance of a kernel driver. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jkrets at gmail.com Tue Feb 22 07:11:48 2011 From: jkrets at gmail.com (Jesse Kretschmer) Date: Mon, 21 Feb 2011 22:11:48 -0800 Subject: [python-win32] comObject set Null/None Message-ID: i wish to unset a com object value. Specifically in active directory. I have been using Tim Golden's active_directory module to connect to a user object. I have tried setting the value to '', None, and even chr(0). I am at a loss. example: import active_directory as AD userObj=AD.find_user("testuser") userObj.set('telephoneNumber'='') Traceback (most recent call last): File "C:\test.py", line 3, in userObj.set(telephoneNumber='') File "C:\Python26\lib\site-packages\active_directory.py", line 514 in set self.com_object.SetInfo() File "", line 2, in SetInfo pywintypes.com_error: (-2147352567, 'Exception occured.', (0, u'Active Directory', u'The attribute syntax specified to the directory service is invalid.\r\n', None, 0, -2147016693), None) How do I delete the attribute value of an active directory user? Thanks, jesse -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Feb 22 10:20:25 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 22 Feb 2011 09:20:25 +0000 Subject: [python-win32] comObject set Null/None In-Reply-To: References: Message-ID: <4D637FD9.1090202@timgolden.me.uk> On 22/02/2011 06:11, Jesse Kretschmer wrote: > i wish to unset a com object value. Specifically in active directory. > I have been using Tim Golden's active_directory module to connect to a > user object. > > I have tried setting the value to '', None, and even chr(0). I am at a > loss. [For those following at home, the code's basically a thin wrapper around a pair of .Put / .SetInfo calls handing all the complexity off to the pywin32 COM mechanism.] Well I'm not quite sure why setting it to None / "" doesn't work, but hopefully the following can provide a workaround: import active_directory as ad me = ad.find_user () me.PutEx (1, "telephoneNumber", "IRRELEVANT") This should clear the telephoneNumber field; the first param to PutEx is one of: Clear, Update, Append, Delete; the second param is the field name; the third is usually the value, but is irrelevant here. (I'd usually pass None but I thought it might cloud the issue in this case) Incidentally, it wasn't clear from your code fragment whether you realised, but you can usually set AD fields directly by referring to them as attributes: me.telephoneNumber = "504" Passing None etc. doesn't work here either, hence the workaround above. TJG From kobben at itc.nl Tue Feb 22 11:02:31 2011 From: kobben at itc.nl (=?iso-8859-1?Q?Barend_K=F6bben?=) Date: Tue, 22 Feb 2011 11:02:31 +0100 Subject: [python-win32] Python and ASP - failure on 2nd and subsequent page loads In-Reply-To: <4D61B760.6070509@gmail.com> Message-ID: My mistake, I did not check... Thanks for the quick fix, Cheers, B. On 21-02-11 01:52, "Mark Hammond" wrote: >On 15/02/2011 9:47 PM, B Kobben wrote: >> Mark, in the beginning of this thread you said: >> >>> I will check that into cvs >>> so the next pywin32 version will have that fixed. >> >> But after installing Python 2.7 the problem did return and your >>solution worked >> again, so it looks like still not solved in the codebase...? > >It was checked into CVS, but no new binary release of pywin32 had been >made. You should find it fixed in the newly released build 215. > >Cheers, > >Mark Faculty of Geo-Information Science and Earth Observation (ITC) University of Twente Chamber of Commerce: 501305360000 E-mail disclaimer The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission. From jkrets at gmail.com Tue Feb 22 18:07:52 2011 From: jkrets at gmail.com (Jesse Kretschmer) Date: Tue, 22 Feb 2011 09:07:52 -0800 Subject: [python-win32] comObject set Null/None In-Reply-To: <4D637FD9.1090202@timgolden.me.uk> References: <4D637FD9.1090202@timgolden.me.uk> Message-ID: > > > import active_directory as ad > > me = ad.find_user () > me.PutEx (1, "telephoneNumber", "IRRELEVANT") > > > > This should clear the telephoneNumber field; the first > param to PutEx is one of: Clear, Update, Append, Delete; > the second param is the field name; the third is usually > the value > This is exactly what I was looking for. I did a bit of searching and found the typical values for the first parameter: ADS_PROPERTY_CLEAR = 1 ADS_PROPERTY_UPDATE = 2 ADS_PROPERTY_APPEND = 3 ADS_PROPERTY_DELETE = 4 from: http://www.winvistatips.com/changing-ad-profile-paths-t750970.html Incidentally, it wasn't clear from your code fragment whether > you realised, but you can usually set AD fields directly by > referring to them as attributes: > > me.telephoneNumber = "504" > > I had noticed that in your module, but In my instance, I will actually pass a dictionary. me.set(**details) Tim, thanks for the help and the quick response. I frequently see helpful responses made by you scattered around the web. I am fairly certain that I would be stuck in VBScript if you were not around to help the community. Cheers, jesse -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Feb 22 21:03:53 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 22 Feb 2011 20:03:53 +0000 Subject: [python-win32] comObject set Null/None In-Reply-To: References: <4D637FD9.1090202@timgolden.me.uk> Message-ID: <4D6416A9.6070607@timgolden.me.uk> On 22/02/2011 5:07 PM, Jesse Kretschmer wrote: > This is exactly what I was looking for. I did a bit of searching and found > the typical values for the first parameter: > ADS_PROPERTY_CLEAR = 1 > ADS_PROPERTY_UPDATE = 2 > ADS_PROPERTY_APPEND = 3 > ADS_PROPERTY_DELETE = 4 > from: http://www.winvistatips.com/changing-ad-profile-paths-t750970.html Ah. I should have posted the canonical links: http://msdn.microsoft.com/en-us/library/aa746353%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa772282%28v=vs.85%29.aspx > Tim, thanks for the help and the quick response. I frequently see helpful > responses made by you scattered around the web. I am fairly certain that I > would be stuck in VBScript if you were not around to help the community. Glad to have been of service :) TJG From william at whpiv.net Thu Feb 24 01:25:00 2011 From: william at whpiv.net (Bill Purcell) Date: Wed, 23 Feb 2011 18:25:00 -0600 Subject: [python-win32] com, CreateObject, and py2exe Message-ID: <20110224002500.GA3251@lloyd> I am trying to expose a couple Numpy functions to excel. Namley Numpy.linalg.inv and Numpy.array.dot. I have successfully accessed the following com server from within excel with CreateObject ======================================================================== test_com.py ======================================================================== from numpy.linalg import inv from numpy import asarray from win32com.client import Dispatch class NevcoModule: _public_methods_ = [ 'MInverse', 'MMult', "TestInstall" ] _reg_progid_ = "Nevco.Modules" _reg_clsid_ = "{79D06C97-331A-4BF8-824A-8DA3B618F8DB}" def TestInstall(self): return "Yes" def MInverse(self,arg): myarg = asarray(arg) i = inv(myarg) return i def MMult(self,M1,M2): mM1 = asarray(M1) mM2 = asarray(M2) x = mM1.dot(mM2) return x if __name__=='__main__': import win32com.server.register win32com.server.register.RegisterClasses(NevcoModule) interp = Dispatch("Nevco.Modules") raw_input("Leave running and then press enter to exit.") win32com.server.register.UnregisterClasses(NevcoModule) ======================================================================== I then have a function in VBA inside excel which accesses this server with Obj = CreateObject("Nevco.Modules"). I would like to share this code with a couple coworkers who are not interested in learning python, so I would like to create an executable to start the server for them. My py2exe setup.py look like ======================================================================== setup.py ======================================================================== from distutils.core import setup import py2exe setup( name="Nevco Excel", version="0.1", description='Functions to use inside excel.', author='Bill Purcell', author_email='bpurcell at nevco.com', com_server=["win32com.servers.interp"], options = {'py2exe': {'includes': 'numpy'}}, ) ======================================================================== Unfortunately when I run the test_com.exe generated from python setup.py py2exe, I get a "Cannot Create Object" error. I can't remember the exact error but that is pretty close. When I run the function excel just hangs and a console displays with the text about installing the "Nevco.Modules" object. What is the right approach to exposing com servers to be accessible via py2exe to VBA? Also, I would like to eventually move towards maybe writing an Add-in. Does anyone have any "Hello World" excell Add-in tutorials for Python? I know these topics are slightly redundant in the list but I couldn't find any good answers. Regards, Bill From skippy.hammond at gmail.com Thu Feb 24 02:29:13 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 24 Feb 2011 12:29:13 +1100 Subject: [python-win32] com, CreateObject, and py2exe In-Reply-To: <20110224002500.GA3251@lloyd> References: <20110224002500.GA3251@lloyd> Message-ID: <4D65B469.6080800@gmail.com> On 24/02/2011 11:25 AM, Bill Purcell wrote: ... > I then have a function in VBA inside excel which accesses this server > with Obj = CreateObject("Nevco.Modules"). I would like to share this > code with a couple coworkers who are not interested in learning > python, so I would like to create an executable to start the server > for them. I think there might be a misconception here - the if name=='__main__' block is *only* doing registration and unregistration - the COM object is not running in that process. Excel will be loading the COM object in-process and manage its lifetime itself. There really isn't a need to have your main block like that - you can just register it once and leave it registered until explicitly unregistered. > setup( > name="Nevco Excel", > version="0.1", > description='Functions to use inside excel.', > author='Bill Purcell', > author_email='bpurcell at nevco.com', > com_server=["win32com.servers.interp"], > options = {'py2exe': {'includes': 'numpy'}}, You want the com_server element to refer to your COM module - as specified, your object will expose the 'python.interpreter' sample object for use. What should happen is that py2exe will create a DLL (and possibly a .exe) for you - but similarly to as mentioned above, this DLL is loaded by excel automatically - you just register it once (probably via regsvr32.exe) and Excel can then use it as necessary. Note however that the registration will need to be done by an elevated administrator account on Windows 7 - but once registered a regular user can use it. The most common approach is to use an installer like Wise or nsis to perform the installation and registration after prompting for elevation. > Also, I would like to eventually move towards maybe writing an > Add-in. Does anyone have any "Hello World" excell Add-in tutorials > for Python? Check out the win32com\Demos directory - but AFAIK, the excel samples there haven't been tested with recent versions of excel. HTH, Mark From william at whpiv.net Thu Feb 24 03:05:33 2011 From: william at whpiv.net (Bill Purcell) Date: Wed, 23 Feb 2011 20:05:33 -0600 Subject: [python-win32] com, CreateObject, and py2exe In-Reply-To: <4D65B469.6080800@gmail.com> References: <20110224002500.GA3251@lloyd> <4D65B469.6080800@gmail.com> Message-ID: <20110224020533.GA4523@lloyd> On 240211-12:29, Mark Hammond wrote: > I think there might be a misconception here - the if > name=='__main__' block is *only* doing registration and > unregistration - the COM object is not running in that process. > Excel will be loading the COM object in-process and manage its > lifetime itself. There really isn't a need to have your main block > like that - you can just register it once and leave it registered > until explicitly unregistered. Yes. I guess I didn't realize that the process isn't tied to that terminal/console instance. I am use to doing something like 'myprogram &' in a bash terminal, and the myprogram process is dependent on the console process. > What should happen is that py2exe will create a DLL (and possibly a > .exe) for you - but similarly to as mentioned above, this DLL is > loaded by excel automatically - you just register it once (probably > via regsvr32.exe) and Excel can then use it as necessary. If I can get out of my own way and get through the learning curve maybe I can get these results... :) > Check out the win32com\Demos directory - but AFAIK, the excel > samples there haven't been tested with recent versions of excel. I will try this tomorrow on my work PC and see if things don't go better. By the way, I look forward to reading your book. It should be here this week. Regards, Bill From mhammond at skippinet.com.au Thu Feb 24 03:43:34 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 24 Feb 2011 13:43:34 +1100 Subject: [python-win32] com, CreateObject, and py2exe In-Reply-To: <20110224023257.GA5523@lloyd> References: <20110224002500.GA3251@lloyd> <4D65B469.6080800@gmail.com> <20110224020533.GA4523@lloyd> <20110224023257.GA5523@lloyd> Message-ID: <4D65C5D6.40306@skippinet.com.au> On 24/02/2011 1:32 PM, Bill Purcell wrote: > On 230211-20:05, Bill Purcell wrote: >> On 240211-12:29, Mark Hammond wrote: >>> Check out the win32com\Demos directory - but AFAIK, the excel >>> samples there haven't been tested with recent versions of excel. > > I am looking at excelAddin.py. I am wondering if it would be possible > to register functions directly without messing with CreateObject in > VBA? I see self.appHostApp.CommandBars.Add() and am hoping I can do > something like self.appHostApp.WorksheetFunction.Add()? Is it > possible to register/add functions when registering an addin in > excelAddin.py? I'm afraid I have no idea - hopefully someone else on this list will have more knowledge of Excel than I. Cheers, Mark From william at whpiv.net Thu Feb 24 03:32:57 2011 From: william at whpiv.net (Bill Purcell) Date: Wed, 23 Feb 2011 20:32:57 -0600 Subject: [python-win32] com, CreateObject, and py2exe In-Reply-To: <20110224020533.GA4523@lloyd> References: <20110224002500.GA3251@lloyd> <4D65B469.6080800@gmail.com> <20110224020533.GA4523@lloyd> Message-ID: <20110224023257.GA5523@lloyd> On 230211-20:05, Bill Purcell wrote: > On 240211-12:29, Mark Hammond wrote: > > Check out the win32com\Demos directory - but AFAIK, the excel > > samples there haven't been tested with recent versions of excel. I am looking at excelAddin.py. I am wondering if it would be possible to register functions directly without messing with CreateObject in VBA? I see self.appHostApp.CommandBars.Add() and am hoping I can do something like self.appHostApp.WorksheetFunction.Add()? Is it possible to register/add functions when registering an addin in excelAddin.py? Bill From tdarugar at yahoo.com Fri Feb 25 19:23:23 2011 From: tdarugar at yahoo.com (Parand Tony Darugar) Date: Fri, 25 Feb 2011 10:23:23 -0800 (PST) Subject: [python-win32] Missing methods from result of Dispatch or EnsureDispatch Message-ID: <411095.83772.qm@web31804.mail.mud.yahoo.com> Hello, I'm attempting to use COM to connect with Microsoft Dynamics GP via eConnect. I have a working VB program, and I also have a working IronPython program. However, I can't seem to get it to work with win32com. The main assembly I'm trying to get at is Microsoft.Dynamics.GP.eConnect.eConnectMethods. In VB this looks like: Dim eConCall As Microsoft.Dynamics.GP.eConnect.eConnectMethods And in IronPython I'm able to: clr.AddReference("Microsoft.Dynamics.GP.eConnect") from Microsoft.Dynamics.GP.eConnect import eConnectMethods connect = eConnectMethods() connect.eConnect_EntryPoint(...) In cPython 2.6 with win32com I'm able to do the Dispatch or EnsureDispatch, but the resulting handle has no usable methods: >>> em = win32com.client.gencache.EnsureDispatch("Microsoft.Dynamics.GP.eConnect.eConnectMethods") >>> dir(em) # only public methods are CLSID and coclass_clsid >>> instance = em() AttributeError: _eConnectMethods instance has no __call__ method >> em.eConnect_EntryPoint(...) AttributeError: '' object has no attribute 'eConnect_EntryPoint' Any ideas? Words of wisdom would be most appreciated. Thanks, Parand From timr at probo.com Fri Feb 25 20:02:01 2011 From: timr at probo.com (Tim Roberts) Date: Fri, 25 Feb 2011 11:02:01 -0800 Subject: [python-win32] Missing methods from result of Dispatch or EnsureDispatch In-Reply-To: <411095.83772.qm@web31804.mail.mud.yahoo.com> References: <411095.83772.qm@web31804.mail.mud.yahoo.com> Message-ID: <4D67FCA9.1060301@probo.com> Parand Tony Darugar wrote: > I'm attempting to use COM to connect with Microsoft Dynamics GP via eConnect. I have a working VB program, and I also have a working IronPython program. However, I can't seem to get it to work with win32com. > > The main assembly I'm trying to get at is Microsoft.Dynamics.GP.eConnect.eConnectMethods. In VB this looks like: > > Dim eConCall As Microsoft.Dynamics.GP.eConnect.eConnectMethods > > And in IronPython I'm able to: > > clr.AddReference("Microsoft.Dynamics.GP.eConnect") > from Microsoft.Dynamics.GP.eConnect import eConnectMethods > connect = eConnectMethods() > connect.eConnect_EntryPoint(...) Perhaps I'm missing something, but in both cases there, you are creating a .NET object from a .NET assembly, not a COM object. It's possible Microsoft has a parallel interface available for COM apps, but there's not necessarily any relationship between their object models. Do you have an example that shows Dynamics being used from a non-managed COM application? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From tdarugar at yahoo.com Fri Feb 25 20:14:34 2011 From: tdarugar at yahoo.com (Parand Tony Darugar) Date: Fri, 25 Feb 2011 11:14:34 -0800 (PST) Subject: [python-win32] Missing methods from result of Dispatch or EnsureDispatch Message-ID: <104026.15122.qm@web31803.mail.mud.yahoo.com> Hi Tim, Thank you for the clarification. You're not missing anything, I'm entirely new to the world of COM and .Net and didn't understand the difference. I'll look for a non-managed COM example. In the meanwhile: - Outside of Ironpython, is there a reasonable way to interaction with .Net objects/assemblies in Python? - Does the fact that Dispatch is able to bring in that object mean anything? I'm looking for clues on where to look for the COM interfaces, was hoping there was something to these COM handles I'm able to dispatch. Best, Parand ----- Original Message ----- From:Tim Roberts To:"python-win32 at python.org" Cc: Sent:Friday, February 25, 2011 11:02 AM Subject:Re: [python-win32] Missing methods from result of Dispatch or EnsureDispatch Parand Tony Darugar wrote: > I'm attempting to use COM to connect with Microsoft Dynamics GP via eConnect. I have a working VB program, and I also have a working IronPython program. However, I can't seem to get it to work with win32com. > > The main assembly I'm trying to get at is Microsoft.Dynamics.GP.eConnect.eConnectMethods. In VB this looks like: > > Dim eConCall As Microsoft.Dynamics.GP.eConnect.eConnectMethods > > And in IronPython I'm able to: > > clr.AddReference("Microsoft.Dynamics.GP.eConnect") > from Microsoft.Dynamics.GP.eConnect import eConnectMethods > connect = eConnectMethods() > connect.eConnect_EntryPoint(...) Perhaps I'm missing something, but in both cases there, you are creating a .NET object from a .NET assembly, not a COM object. It's possible Microsoft has a parallel interface available for COM apps, but there's not necessarily any relationship between their object models. Do you have an example that shows Dynamics being used from a non-managed COM application? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From planders at gmail.com Fri Feb 25 20:31:25 2011 From: planders at gmail.com (Preston Landers) Date: Fri, 25 Feb 2011 13:31:25 -0600 Subject: [python-win32] Missing methods from result of Dispatch or EnsureDispatch In-Reply-To: <104026.15122.qm@web31803.mail.mud.yahoo.com> References: <104026.15122.qm@web31803.mail.mud.yahoo.com> Message-ID: On Fri, Feb 25, 2011 at 1:14 PM, Parand Tony Darugar wrote: > > - Outside of Ironpython, is there a reasonable way to interaction with .Net > objects/assemblies in Python? > > I haven't worked with it myself, but it looks like this is an option: http://pythonnet.sourceforge.net/ thanks, Preston -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Feb 25 20:59:28 2011 From: timr at probo.com (Tim Roberts) Date: Fri, 25 Feb 2011 11:59:28 -0800 Subject: [python-win32] Missing methods from result of Dispatch or EnsureDispatch In-Reply-To: <104026.15122.qm@web31803.mail.mud.yahoo.com> References: <104026.15122.qm@web31803.mail.mud.yahoo.com> Message-ID: <4D680A20.8010006@probo.com> Parand Tony Darugar wrote: > Thank you for the clarification. You're not missing anything, I'm entirely new to the world of COM and .Net and didn't understand the difference. > > I'll look for a non-managed COM example. In the meanwhile: > > - Outside of Ironpython, is there a reasonable way to interaction with .Net objects/assemblies in Python? Not really. Only .NET apps can use .NET objects. IronPython is the .NET implementation of Python, and part of its power lies in the ability to exploit the huge .NET CLR. One quite reasonable answer to your dilemma is just to focus on IronPython. > - Does the fact that Dispatch is able to bring in that object mean anything? I'm looking for clues on where to look for the COM interfaces, was hoping there was something to these COM handles I'm able to dispatch. Yes, that's a very good point, and it nearly caused me to abort my original reply. The fact that you were able to create an object at all suggests that there may be a COM implementation of these objects. The difficulty will be figuring out how they can be used. All of the Googling I did led only to the .NET implementations. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From roche.maxime at creativeinfinity.fr Sat Feb 26 13:13:52 2011 From: roche.maxime at creativeinfinity.fr (Creative iNFiNiTY) Date: Sat, 26 Feb 2011 13:13:52 +0100 Subject: [python-win32] get the ao.Name encoding Message-ID: Hello, There is many method to get the window title, from a process it came with the ao.Name but i don't know how to get the encoding of window title, for example when the browser surf on page in another language. is there a way to get it with win32 ? Thanks Roche Maxime Creative iNFiNiTY roche.maxime at creativeinfinity.fr From greg.ewing at canterbury.ac.nz Sat Feb 26 21:31:21 2011 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 27 Feb 2011 09:31:21 +1300 Subject: [python-win32] Possible future direction for PyGUI on Win32 Message-ID: <4D696319.8080803@canterbury.ac.nz> Until recently I didn't think it was possible to use .NET libraries from CPython, but then I came across this: http://pythonnet.sourceforge.net/ Using this, it looks like it should be possible to create a PyGUI implementation based on Windows Forms. This has the potential to solve a number of headaches, as it appears to be a considerably more capable library than base win32. The downside is that 2k and XP users may need to install a .NET runtime. How would people feel about that? -- Greg From timjohnson at google.com Sat Feb 26 21:55:36 2011 From: timjohnson at google.com (Tim Johnson) Date: Sat, 26 Feb 2011 12:55:36 -0800 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <4D696319.8080803@canterbury.ac.nz> References: <4D696319.8080803@canterbury.ac.nz> Message-ID: That sounds very promising. Thanks for pointing this out, too. I hadn't realized this was out there. On Sat, Feb 26, 2011 at 12:31 PM, Greg Ewing wrote: > Until recently I didn't think it was possible to use .NET > libraries from CPython, but then I came across this: > > http://pythonnet.sourceforge.net/ > > Using this, it looks like it should be possible to create > a PyGUI implementation based on Windows Forms. This has the > potential to solve a number of headaches, as it appears > to be a considerably more capable library than base win32. > > The downside is that 2k and XP users may need to install > a .NET runtime. How would people feel about that? > > -- > Greg > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- Tim "They Call Me Tojo" Johnson Systems Administrator Gooooooooooooooogle -------------- next part -------------- An HTML attachment was scrubbed... URL: From orasnita at gmail.com Sun Feb 27 00:50:34 2011 From: orasnita at gmail.com (Octavian Rasnita) Date: Sun, 27 Feb 2011 01:50:34 +0200 Subject: [python-win32] Possible future direction for PyGUI on Win32 References: <4D696319.8080803@canterbury.ac.nz> Message-ID: <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> From: "Greg Ewing" > Until recently I didn't think it was possible to use .NET > libraries from CPython, but then I came across this: > > http://pythonnet.sourceforge.net/ > > Using this, it looks like it should be possible to create > a PyGUI implementation based on Windows Forms. This has the > potential to solve a number of headaches, as it appears > to be a considerably more capable library than base win32. > > The downside is that 2k and XP users may need to install > a .NET runtime. How would people feel about that? > If it will still be possible to use the standard Win32 GUI, it is OK to be able to use Windows Forms as an adition. Octavian From greg.ewing at canterbury.ac.nz Sun Feb 27 01:21:54 2011 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 27 Feb 2011 13:21:54 +1300 Subject: [python-win32] Possible future direction for PyGUI on Win32 References: <4D696319.8080803@canterbury.ac.nz> <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> Message-ID: From: Octavian Rasnita [mailto:orasnita at gmail.com] > If it will still be possible to use the standard Win32 GUI, > it is OK to be able to use Windows Forms as an adition. No, if I go this way, I would probably stop maintaining the current implementation. I don't want to have to support two backends on Windows, and some of the things I intend to do with Windows Forms would be impractical to do using the raw Win32 API. -- Greg This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. From klonuo at gmail.com Sun Feb 27 01:41:10 2011 From: klonuo at gmail.com (Klonuo) Date: Sun, 27 Feb 2011 01:41:10 +0100 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> Message-ID: <20110227014108.B490.B1C76292@gmail.com> > No, if I go this way, I would probably stop maintaining > the current implementation. I don't want to have to > support two backends on Windows, and some of the things > I intend to do with Windows Forms would be impractical > to do using the raw Win32 API. With all due respect to maintainers of .NET connectors, but this kind of thinking is one of the main reasons why I'm always avoiding any kind of .NET application - in majority they are suboptimal on several scales and give "developers" freedom to do things they shouldn't, by abusing precious resources. Cheers From orasnita at gmail.com Sun Feb 27 09:20:53 2011 From: orasnita at gmail.com (Octavian Rasnita) Date: Sun, 27 Feb 2011 10:20:53 +0200 Subject: [python-win32] Possible future direction for PyGUI on Win32 References: <4D696319.8080803@canterbury.ac.nz> <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> Message-ID: From: "Greg Ewing" From: Octavian Rasnita [mailto:orasnita at gmail.com] > If it will still be possible to use the standard Win32 GUI, > it is OK to be able to use Windows Forms as an adition. No, if I go this way, I would probably stop maintaining the current implementation. I don't want to have to support two backends on Windows, and some of the things I intend to do with Windows Forms would be impractical to do using the raw Win32 API. -- Greg Oh, in that case imho I think this is a very bad idea. Octavian From mhammond at skippinet.com.au Sun Feb 27 12:40:22 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 27 Feb 2011 22:40:22 +1100 Subject: [python-win32] [ANN] pywin32 build 216 released. Message-ID: <4D6A3826.7020106@skippinet.com.au> Hi all, Hot on the heels of being happy to announce build 215, I'm fairly nonchalant about announcing the release of pywin32 build 216 . This release is primarily to address some build related issues in build 215. If you use pywin32 to host COM objects (as opposed to simply using COM objects), use it to host IIS ISAPI applications, or wish to use the adodbapi package on Python 3.x, you should upgrade to build 216. The changes in this release are: * If you hosted COM objects or used ISAPI, your object/app would probably have failed to load, probably with a message related to msvcr90.dll - this has been fixed. In the case of COM, it has been fixed by introducing a new DLL as a "loader" for COM objects (pythoncomloaderxx.dll) which delegates to pythoncomxx.dll, but has an appropriate "manifest". * ISAPI apps could also crash when using GetServerVariable for an unknown variable on Windows 7. * adodbapi for Python 3.x builds have had syntax errors fixed. * Pythonwin now prints (ie, to a printer) correctly on Python 3.x and allows the background color of the selection to be customized. * A number of test related changes. As always, thanks to everyone who contributed (both code and issues) to this release! Get it now via: https://sourceforge.net/projects/pywin32/files/pywin32/Build216/ Cheers, Mark. From prologic at shortcircuit.net.au Sun Feb 27 20:21:34 2011 From: prologic at shortcircuit.net.au (James Mills) Date: Mon, 28 Feb 2011 05:21:34 +1000 Subject: [python-win32] [ANN] pywin32 build 216 released. In-Reply-To: <4D6A3826.7020106@skippinet.com.au> References: <4D6A3826.7020106@skippinet.com.au> Message-ID: On Sun, Feb 27, 2011 at 9:40 PM, Mark Hammond wrote: > Hi all, > ?Hot on the heels of being happy to announce build 215, I'm fairly > nonchalant about announcing the release of pywin32 build 216 . > > This release is primarily to address some build related issues in build 215. > ?If you use pywin32 to host COM objects (as opposed to simply using COM > objects), use it to host IIS ISAPI applications, or wish to use the adodbapi > package on Python 3.x, you should upgrade to build 216. ?The changes in this > release are: > > * If you hosted COM objects or used ISAPI, your object/app would probably > have failed to load, probably with a message related to msvcr90.dll - this > has been fixed. ?In the case of COM, it has been fixed by introducing a new > DLL as a "loader" for COM objects (pythoncomloaderxx.dll) which delegates to > pythoncomxx.dll, but has an appropriate "manifest". > > * ISAPI apps could also crash when using GetServerVariable for an unknown > variable on Windows 7. > > * adodbapi for Python 3.x builds have had syntax errors fixed. > > * Pythonwin now prints (ie, to a printer) correctly on Python 3.x and allows > the background color of the selection to be customized. > > * A number of test related changes. > > As always, thanks to everyone who contributed (both code and issues) to this > release! > > Get it now via: > https://sourceforge.net/projects/pywin32/files/pywin32/Build216/ Congrats on the new release. cheers James -- -- James Mills -- -- "Problems are solved by method" From fuzzyman at gmail.com Sun Feb 27 21:38:19 2011 From: fuzzyman at gmail.com (Michael Foord) Date: Sun, 27 Feb 2011 20:38:19 +0000 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <4D696319.8080803@canterbury.ac.nz> References: <4D696319.8080803@canterbury.ac.nz> Message-ID: On 26 February 2011 20:31, Greg Ewing wrote: > Until recently I didn't think it was possible to use .NET > libraries from CPython, but then I came across this: > > http://pythonnet.sourceforge.net/ > > Using this, it looks like it should be possible to create > a PyGUI implementation based on Windows Forms. This has the > potential to solve a number of headaches, as it appears > to be a considerably more capable library than base win32. > > The downside is that 2k and XP users may need to install > a .NET runtime. How would people feel about that? > > Python.NET is currently not maintained. Michael Foord > -- > Greg > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Sun Feb 27 23:56:39 2011 From: mc at mclaveau.com (Michel Claveau) Date: Sun, 27 Feb 2011 23:56:39 +0100 Subject: [python-win32] [ANN] pywin32 build 216 released. In-Reply-To: <4D6A3826.7020106@skippinet.com.au> References: <4D6A3826.7020106@skippinet.com.au> Message-ID: <9D6FE5C2371A4297A8FE81ECE0C95B8A@MCI1330> Hi! Thanks for 216. But, I have the same problem, when I want acces to Python/Pywin32-COM's servers. (However, no message on msvcr90) Below, example of messages. If I reinstall 214, the problem is solved. @-salutations -- Michel Claveau --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Windows\System32\WScript.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. --------------------------- OK --------------------------- --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Program Files\AutoIt3\AutoIt3.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. --------------------------- OK --------------------------- From vernondcole at gmail.com Mon Feb 28 06:01:52 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Sun, 27 Feb 2011 22:01:52 -0700 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> Message-ID: Hmmm... projects get abandoned for many reasons. Michael: In your professional opinion would it be worthwhile to clone/fork/resurrect the pythonnet project, or is it a bad idea better left dead? -- Vernon On Sun, Feb 27, 2011 at 1:38 PM, Michael Foord wrote: > > > On 26 February 2011 20:31, Greg Ewing wrote: > >> Until recently I didn't think it was possible to use .NET >> libraries from CPython, but then I came across this: >> >> http://pythonnet.sourceforge.net/ >> >> Using this, it looks like it should be possible to create >> a PyGUI implementation based on Windows Forms. This has the >> potential to solve a number of headaches, as it appears >> to be a considerably more capable library than base win32. >> >> The downside is that 2k and XP users may need to install >> a .NET runtime. How would people feel about that? >> >> > Python.NET is currently not maintained. > > Michael Foord > > >> -- >> Greg >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > > > -- > > http://www.voidspace.org.uk/ > > May you do good and not evil > May you find forgiveness for yourself and forgive others > > > May you share freely, never taking more than you give. > -- the sqlite blessing http://www.sqlite.org/different.html > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Mon Feb 28 07:19:40 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 28 Feb 2011 17:19:40 +1100 Subject: [python-win32] [ANN] pywin32 build 216 released. In-Reply-To: <9D6FE5C2371A4297A8FE81ECE0C95B8A@MCI1330> References: <4D6A3826.7020106@skippinet.com.au> <9D6FE5C2371A4297A8FE81ECE0C95B8A@MCI1330> Message-ID: <4D6B3E7C.4080701@gmail.com> On 28/02/2011 9:56 AM, Michel Claveau wrote: > Hi! > > Thanks for 216. > > But, I have the same problem, when I want acces to Python/Pywin32-COM's > servers. (However, no message on msvcr90) > Below, example of messages. > > If I reinstall 214, the problem is solved. I meant to mention in my announcement that it will be necessary to reregister your COM objects to get the new fixed behaviour - if you don't, pythoncomxx.dll will still be directly hosting the objects and will have the same problematic behaviour - but if you re-register, the objects will all be registered against the new pythoncomloaderxx.dll. Can you please try that? (And note that if you then need to roll back to build 214, you will want to re-register them again once you reinstall) Thanks! Mark From mail at timgolden.me.uk Mon Feb 28 10:40:03 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 28 Feb 2011 09:40:03 +0000 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> Message-ID: <4D6B6D73.3080701@timgolden.me.uk> On 28/02/2011 05:01, Vernon Cole wrote: > Hmmm... projects get abandoned for many reasons. > > Michael: > In your professional opinion would it be worthwhile to > clone/fork/resurrect the pythonnet project, or is it a bad idea better > left dead? Well, the last Svn commit was 4 weeks ago, by "barton_c", and Python27 "support" (ie switches") were added 2 months ago. Looks like "Barton_C" needs to do some advertising. I'll see if I can contact him/her through sf. I've just pulled the source code down; I'll see if I can get it to build against the Python27 repo. (When I get the time...) FWIW, I have used it successfully, if trivially, to employ SQL-SMO to script off my database. This (rather than IronPython) because I have an existing investment in the CPython svn bindings. (In short: pragmatism beats purity). TJG From mail at timgolden.me.uk Mon Feb 28 10:57:52 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 28 Feb 2011 09:57:52 +0000 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <4D6B6D73.3080701@timgolden.me.uk> References: <4D696319.8080803@canterbury.ac.nz> <4D6B6D73.3080701@timgolden.me.uk> Message-ID: <4D6B71A0.7000405@timgolden.me.uk> On 28/02/2011 09:40, Tim Golden wrote: > On 28/02/2011 05:01, Vernon Cole wrote: >> Hmmm... projects get abandoned for many reasons. >> >> Michael: >> In your professional opinion would it be worthwhile to >> clone/fork/resurrect the pythonnet project, or is it a bad idea better >> left dead? ... and what I meant to add was: Python.NET seems to sit in an awkward place in the ecosystem. Its niche seems to be: where you want a small bit of .NET technology (such as SQL-SMO in my case) but don't want to migrate any win-specific Python code. (ie stuff relying on pywin32) If you wanted lots of .NET stuff or if you only have pure Python code you'd probably use IronPython . TJG From developers at tefnet.pl Mon Feb 28 11:22:33 2011 From: developers at tefnet.pl (Tefnet Developers) Date: Mon, 28 Feb 2011 11:22:33 +0100 Subject: [python-win32] Problem with win32print.SetPrinter Message-ID: <1298888553.2645.29.camel@cacko> Hi, I am adding some printers connection as a user with win32print.AddPrinterConnection(). Afterwards I want to set paper size to A4 (I have no idea why Polish Windows XP sets it to Letter by default) with this example code: ================================================================== import win32print import win32con import win32gui import pywintypes printer = r'\\drukarki\kp01' handle = win32print.OpenPrinter(printer, {'DesiredAccess': win32print.PRINTER_ACCESS_USE}) devmodeSize=win32print.DocumentProperties(0, handle, printer, None, None, 0) devmode = pywintypes.DEVMODEType(devmodeSize - pywintypes.DEVMODEType().Size) win32print.DocumentProperties(0, handle, printer, devmode, devmode, win32con.DM_IN_BUFFER | win32con.DM_OUT_BUFFER) print 'FormName before: %s' % devmode.FormName print 'PaperSize before: %s' % devmode.PaperSize devmode.FormName = "A4" devmode.PaperSize = win32con.DMPAPER_A4 devmode.Fields = devmode.Fields | win32con.DM_FORMNAME | win32con.DM_PAPERSIZE print 'FormName set: %s' % devmode.FormName print 'PaperSize set: %s' % devmode.PaperSize info = win32print.GetPrinter(handle, 9) info["pDevMode"] = devmode win32print.SetPrinter(handle, 9, info, 0) devmodeSize=win32print.DocumentProperties(0, handle, printer, None, None, 0) devmode = pywintypes.DEVMODEType(devmodeSize - pywintypes.DEVMODEType().Size) win32print.DocumentProperties(0, handle, printer, devmode, devmode, win32con.DM_IN_BUFFER | win32con.DM_OUT_BUFFER) print 'FormName after: %s' % devmode.FormName print 'PaperSize after: %s' % devmode.PaperSize win32print.ClosePrinter(handle) win32gui.SendMessageTimeout(win32con.HWND_BROADCAST, win32con.WM_DEVMODECHANGE, 0, 0, 0, 2000) ================================================================== The output looks like this: ================================================================== FormName before: A4 PaperSize before: 1 FormName set: A4 PaperSize set: 9 FormName after: A4 PaperSize after: 1 ================================================================== So, as you can see - FormName changes, but PaperSize does not. Am I doing something wrong here? I've spent a lot of time trying to solve it, yet came up with nothing. Do you have any suggestions? Thanks, Filip Zyzniewski Tefnet From fuzzyman at gmail.com Mon Feb 28 13:47:12 2011 From: fuzzyman at gmail.com (Michael Foord) Date: Mon, 28 Feb 2011 12:47:12 +0000 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> Message-ID: On 28 February 2011 05:01, Vernon Cole wrote: > Hmmm... projects get abandoned for many reasons. > > Michael: > In your professional opinion would it be worthwhile to > clone/fork/resurrect the pythonnet project, or is it a bad idea better left > dead? > Python.NET is a great project. Michael > -- > Vernon > > > On Sun, Feb 27, 2011 at 1:38 PM, Michael Foord wrote: > >> >> >> On 26 February 2011 20:31, Greg Ewing wrote: >> >>> Until recently I didn't think it was possible to use .NET >>> libraries from CPython, but then I came across this: >>> >>> http://pythonnet.sourceforge.net/ >>> >>> Using this, it looks like it should be possible to create >>> a PyGUI implementation based on Windows Forms. This has the >>> potential to solve a number of headaches, as it appears >>> to be a considerably more capable library than base win32. >>> >>> The downside is that 2k and XP users may need to install >>> a .NET runtime. How would people feel about that? >>> >>> >> Python.NET is currently not maintained. >> >> Michael Foord >> >> >>> -- >>> Greg >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >>> >> >> >> >> -- >> >> http://www.voidspace.org.uk/ >> >> May you do good and not evil >> May you find forgiveness for yourself and forgive others >> >> >> >> May you share freely, never taking more than you give. >> -- the sqlite blessing http://www.sqlite.org/different.html >> >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Mon Feb 28 13:53:08 2011 From: mc at mclaveau.com (Michel Claveau) Date: Mon, 28 Feb 2011 13:53:08 +0100 Subject: [python-win32] [ANN] pywin32 build 216 released. In-Reply-To: <4D6B3E7C.4080701@gmail.com> References: <4D6A3826.7020106@skippinet.com.au> <9D6FE5C2371A4297A8FE81ECE0C95B8A@MCI1330> <4D6B3E7C.4080701@gmail.com> Message-ID: <59AD9B91E48B42B5B94DA321C122F903@MCI1330> Hi! After some tests... Again the same error: --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Windows\System32\WScript.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. --------------------------- OK --------------------------- When error, I look register: HKCR\CLSID\{EC501258-201C-449C-BE20-837A316EA382}\InprocServer32 contain the value pythoncomloader26.dll I tried several things: C:\Python26\Lib\site-packages\pywin32_system32 copy pythoncomloader26.dll et pythoncom*.dll in C:\windows\system32 copy pythoncomloader26.dll et pythoncom*.dll in courrent directory Copy in C:\windows\system32: mfc90.dll mfc90u.dll mfcm90.dll mfcm90u.dll Restart computer Re-registered my COM server Again & again the error But... Reinstall 214 without uninstall 216 => test OK (AND WITHOUT REGISTER AGAIN my COM server; therefore, with pythoncomloader26.dll in register (I look)) Reinstall 216 over 214, then test immediatly: Error Reinstall 214 over 216, then test immediatly: OK If that can help... In several hours, I will test on a new computer, without python... @+ -- Michel Claveau From roche.maxime at creativeinfinity.fr Mon Feb 28 13:22:53 2011 From: roche.maxime at creativeinfinity.fr (Creative iNFiNiTY) Date: Mon, 28 Feb 2011 13:22:53 +0100 Subject: [python-win32] (again) get Window Title encoding Message-ID: <2917B8BC-F174-4B93-BCFE-5409980E8212@creativeinfinity.fr> here is some code to get the window title: hwnd = win32gui.GetForegroundWindow() # we want the desktop window objid = pyAA.Constants.OBJID_WINDOW # get the object ao = pyAA.AccessibleObjectFromWindow(hwnd, objid) pr= ao.GetProcessAndThreadID() processes = win32process.EnumProcesses() for pid in processes: if pid in pr: handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS,False, pid) processactif=win32process.GetModuleFileNameEx(handle, 0) WindowTitle=ao.Name another code: import win32gui w=win32gui w.GetWindowText (w.GetForegroundWindow()) and i need to get the encoding of the title for internalisation purpose, does anyone know how to get it ? the automatic charset recognition in python ," chardet" don't work for every charset, if i can take it by the process that will be great. Thanks Roche Maxime Creative iNFiNiTY -------------- next part -------------- An HTML attachment was scrubbed... URL: From lueck at ipk-gatersleben.de Mon Feb 28 15:18:46 2011 From: lueck at ipk-gatersleben.de (=?iso-8859-1?Q?Stefanie_L=FCck?=) Date: Mon, 28 Feb 2011 15:18:46 +0100 Subject: [python-win32] Python Excel - 2 workbooks affect each other Message-ID: <000301cbd752$696751a0$1022a8c0@ipkgatersleben.de> Hello! I have a strange excel behaviour if 2 workbooks are open. I?m trying to create an excel workbook with a bar chart from some data which comes from my wxPython program. If I paste the data into my program from any source except another excel file, everything works as expected. But if I copy the values from a source excel workbook into my program and then try to create a new excel workbook with a chart, the new workbook takes the data of the chart from the source workbook and not from the sheet I specified. This happens only if the data of the source workbook are still selected from the copy before, if I click into another cell, my new created workbook will use the data of its sheet which I specified. Does anybody know what this could be? In my code I clearly specify to use the data of my new created worksheet. The name of the source workbook sheet is completely different. Looks like excel ignore it and use the currently selected data of any workbook. Is there a way to specify the Workbook and Worksheet, which I want to use? Any help would be appreciated! Thanks, Stefanie -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Mon Feb 28 17:33:28 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 28 Feb 2011 09:33:28 -0700 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> <4D6B6D73.3080701@timgolden.me.uk> <4D6B71A0.7000405@timgolden.me.uk> Message-ID: So with pythoncom on one hand and pywin32 on ironclad on the other you could go either way on either compiler? Sounds pretty neat. Is pythoncom python3 ready? (I haven't looked at source yet. Vernon Cole (sent from my 'droid phone) On Feb 28, 2011 2:58 AM, "Tim Golden" wrote: On 28/02/2011 09:40, Tim Golden wrote: > > On 28/02/2011 05:01, Vernon Cole wrote: >> >> Hmmm... pro... ... and what I meant to add was: Python.NET seems to sit in an awkward place in the ecosystem. Its niche seems to be: where you want a small bit of .NET technology (such as SQL-SMO in my case) but don't want to migrate any win-specific Python code. (ie stuff relying on pywin32) If you wanted lots of .NET stuff or if you only have pure Python code you'd probably use IronPython . TJG _______________________________________________ python-win32 mailing list python-win32 at python.org h... -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Mon Feb 28 19:03:08 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 28 Feb 2011 18:03:08 +0000 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> <4D6B6D73.3080701@timgolden.me.uk> <4D6B71A0.7000405@timgolden.me.uk> Message-ID: <4D6BE35C.6060600@timgolden.me.uk> On 28/02/2011 4:33 PM, Vernon Cole wrote: > So with pythoncom on one hand and pywin32 on ironclad on the other you could > go either way on either compiler? Sounds pretty neat. > Is pythoncom python3 ready? (I haven't looked at source yet. Certainly is. I've had my wmi module running against it for a while now. TJG From timr at probo.com Mon Feb 28 19:56:28 2011 From: timr at probo.com (Tim Roberts) Date: Mon, 28 Feb 2011 10:56:28 -0800 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <4D696319.8080803@canterbury.ac.nz> References: <4D696319.8080803@canterbury.ac.nz> Message-ID: <4D6BEFDC.2080508@probo.com> Greg Ewing wrote: > The downside is that 2k and XP users may need to install > a .NET runtime. How would people feel about that? Most XP users have long ago had 2.0, 3.0, and 3.5 runtimes pushed to their systems through service packs and updates. For 2000, the run-time installation is not very painful. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Feb 28 20:06:47 2011 From: timr at probo.com (Tim Roberts) Date: Mon, 28 Feb 2011 11:06:47 -0800 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <20110227014108.B490.B1C76292@gmail.com> References: <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> <20110227014108.B490.B1C76292@gmail.com> Message-ID: <4D6BF247.8020201@probo.com> Klonuo wrote: >> No, if I go this way, I would probably stop maintaining >> the current implementation. I don't want to have to >> support two backends on Windows, and some of the things >> I intend to do with Windows Forms would be impractical >> to do using the raw Win32 API. > With all due respect to maintainers of .NET connectors, but this kind of thinking is one of the main reasons why I'm always avoiding any kind of .NET application - in majority they are suboptimal on several scales and give "developers" freedom to do things they shouldn't, by abusing precious resources. That depends entirely on what resources you value. It is much quicker to develop .NET applications than it is to write straight to the API, in part because the CLR support is so vast. My time is WAY more valuable than my computer's time. I paid for 4GB of memory in my computer. Memory that is not being used is simply being wasted. I still do most of my programming in C++ because I like having control, but there is nothing wrong with .NET. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Mon Feb 28 22:52:17 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 01 Mar 2011 08:52:17 +1100 Subject: [python-win32] [ANN] pywin32 build 216 released. In-Reply-To: <59AD9B91E48B42B5B94DA321C122F903@MCI1330> References: <4D6A3826.7020106@skippinet.com.au> <9D6FE5C2371A4297A8FE81ECE0C95B8A@MCI1330> <4D6B3E7C.4080701@gmail.com> <59AD9B91E48B42B5B94DA321C122F903@MCI1330> Message-ID: <4D6C1911.5010209@skippinet.com.au> On 28/02/2011 11:53 PM, Michel Claveau wrote: > Hi! > > After some tests... > Again the same error: > --------------------------- > Microsoft Visual C++ Runtime Library > --------------------------- > Runtime Error! > Program: C:\Windows\System32\WScript.exe > R6034 > An application has made an attempt to load the C runtime library > incorrectly. > Please contact the application's support team for more information. > --------------------------- > OK > --------------------------- Could you also please try "wscript.exe win32com\test\testInterp.vbs" - this is a trivial vbscript test that loads the Python.Interpreter COM object and attempts to use it. This works fine for me on every configuration I have tried including a very clean Windows 7 VM. If that works for you, then we have a different problem related to your COM objects. If that doesn't work for you, then I will be quite confused :) Cheers, Mark From skippy.hammond at gmail.com Mon Feb 28 22:57:56 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 01 Mar 2011 08:57:56 +1100 Subject: [python-win32] (again) get Window Title encoding In-Reply-To: <2917B8BC-F174-4B93-BCFE-5409980E8212@creativeinfinity.fr> References: <2917B8BC-F174-4B93-BCFE-5409980E8212@creativeinfinity.fr> Message-ID: <4D6C1A64.8060506@gmail.com> You might find the 'mbcs' encoding is what you are after? Cheers, Mark On 28/02/2011 11:22 PM, Creative iNFiNiTY wrote: > here is some code to get the window title: > > hwnd = win32gui.GetForegroundWindow() > # we want the desktop window > objid = pyAA.Constants.OBJID_WINDOW > # get the object > ao = pyAA.AccessibleObjectFromWindow(hwnd, objid) > pr= ao.GetProcessAndThreadID() > processes = win32process.EnumProcesses() > for pid in processes: > if pid in pr: > handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS,False, pid) > processactif=win32process.GetModuleFileNameEx(handle, 0) > > WindowTitle=ao.Name > another code: > importwin32gui > w=win32gui > w.GetWindowText (w.GetForegroundWindow()) > > * > * > and i need to get the encoding of the title for internalisation purpose, > does anyone know how to get it ? > the automatic charset recognition in python ," chardet" don't work for > every charset, > if i can take it by the process that will be great. > Thanks > > Roche Maxime > Creative iNFiNiTY > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From greg.ewing at canterbury.ac.nz Mon Feb 28 23:14:36 2011 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 01 Mar 2011 11:14:36 +1300 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: References: <4D696319.8080803@canterbury.ac.nz> <96FB0913B4C9465A8B1AB3EF8359AF63@teddy> Message-ID: <4D6C1E4C.4090803@canterbury.ac.nz> Octavian Rasnita wrote: > From: "Greg Ewing" > >> No, if I go this way, I would probably stop maintaining >> the current implementation. > > Oh, in that case imho I think this is a very bad idea. Can you elaborate on exactly what is bad about it, and suggest an alternative? The standard Windows GUI API is severely crippled compared to what is available natively in Cocoa and Gtk. The only alternatives I see at the moment are: * Allow Windows to hold back the development of PyGUI on all the other platforms. * Implement the missing functionality on Windows in pure Python -- a lot of work, and probably not practical for something complex such as a rich text or HTML widget. * Rely on a third party library to supply the missing functionality on Windows. -- Greg From greg.ewing at canterbury.ac.nz Mon Feb 28 23:33:37 2011 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 01 Mar 2011 11:33:37 +1300 Subject: [python-win32] Possible future direction for PyGUI on Win32 In-Reply-To: <4D6B71A0.7000405@timgolden.me.uk> References: <4D696319.8080803@canterbury.ac.nz> <4D6B6D73.3080701@timgolden.me.uk> <4D6B71A0.7000405@timgolden.me.uk> Message-ID: <4D6C22C1.3020104@canterbury.ac.nz> Tim Golden wrote: > Python.NET seems to sit in an awkward > place in the ecosystem. Its niche seems to be: where you want a small > bit of .NET technology (such as SQL-SMO in my case) but don't want to > migrate any win-specific Python code. (ie stuff relying on pywin32) Or, as in my case, you are developing a library and want to make use of some .NET technology, but don't want to force all the users of your library to use a non-standard Python implementation. -- Greg