From mhammond at skippinet.com.au Tue Jun 1 20:06:28 2010 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 02 Jun 2010 04:06:28 +1000 Subject: [python-win32] Python service hangs in Dispatch when frozen with py2exe In-Reply-To: <4C05466D.70409@advpubtech.com> References: <4BFB13BA.1030009@gmail.com> <4BFB278C.3020300@advpubtech.com> <4BFF640A.2030509@gmail.com> <4C05466D.70409@advpubtech.com> Message-ID: <4C054C24.405@skippinet.com.au> On 2/06/2010 3:42 AM, Don Dwiggins wrote: > The object is part of a DLL written in VB6. It's currently single > threaded -- apartment threading is the only other option in the IDE. Right - Apartment threading might give better results. >> >> What is your main thread doing? Can you make it run a message loop to >> test (ie, call pythoncom.PumpMessages() in that main thread?) > > Hmm, I'll have to look at that. I'm running under a Twisted reactor, and > I'm not sure without looking how the reactor sets up the thread. I'm not > sure how (or why) PumpMessages would work here -- there's nothing going > on in the object that would require a Windows message loop. The Windows message loop is used by the COM marshalling process. IIRC, the first thread to initialize COM in a process is the thread in which single-threaded objects will always end up being called in. If a different thread creates the object, COM uses Windows messages to marshall all calls back to that main thread. IOW, your second thread makes a call - even to create the object - which results in that thread sending a windows message to the main thread to act on the request. What this probably means in practice is that twisted needs to use a reactor which calls MsgWaitForMultipleObjects() and runs a message loop when the function detects a new message is in the queue. I'm not sure if there is an existing reactor which does this. IIRC, apartment threading may fix this - the second thread can call CoInit indicating it is a new apartment, which should mean that no marshalling will happen between that thread and the new apartment-threaded object. As mentioned above though, if the object reports it is "single threaded", calls will *always* be marshalled to the main thread and will always require a message loop to work correctly. HTH, Mark From ddwiggins at advpubtech.com Tue Jun 1 19:42:05 2010 From: ddwiggins at advpubtech.com (Don Dwiggins) Date: Tue, 01 Jun 2010 10:42:05 -0700 Subject: [python-win32] Python service hangs in Dispatch when frozen with py2exe In-Reply-To: <4BFF640A.2030509@gmail.com> References: <4BFB13BA.1030009@gmail.com> <4BFB278C.3020300@advpubtech.com> <4BFF640A.2030509@gmail.com> Message-ID: <4C05466D.70409@advpubtech.com> Mark Hammond wrote: > On 25/05/2010 11:27 AM, Don Dwiggins wrote: >> There's a good hint there. I've got all my imports listed at the top of >> the file. I do know that, when using the source, the file is read twice >> -- once from the command line by the usual Python interpreter, and once >> by PythonService; it must be different, though, when the compiled .exe >> is run both to install and to start the service. I can't quite use the >> hint to figure out why it should fail when I do an explicit CoInitialize >> at the start of a thread. > > By "fail" here you mean "hang" right? Yes. > The object model semantics are tricky - if the object says it only > supports single or apartment threading, COM is likely to marshal to > the main thread regardless of how the thread initializes COM. The object is part of a DLL written in VB6. It's currently single threaded -- apartment threading is the only other option in the IDE. > > What is your main thread doing? Can you make it run a message loop to > test (ie, call pythoncom.PumpMessages() in that main thread?) Hmm, I'll have to look at that. I'm running under a Twisted reactor, and I'm not sure without looking how the reactor sets up the thread. I'm not sure how (or why) PumpMessages would work here -- there's nothing going on in the object that would require a Windows message loop. > >> I think (not sure) that the point where it hangs is always in >> pythoncom.new (for all permutations), where it's getting the OLE object >> to be wrapped. The question is, where in that function could it hang up >> waiting for something to happen? > > In the underlying call to COM's CoCreateInstance. I can't think of > *why* that could happen though... OK, thanks. I may wind up moving this whole thing into a separate "wrapper" process, to be invoked by the server. It's simple enough, and there's no performance issue with doing that; it's just an annoyance. Thanks, Don From morfeokmg at gmail.com Thu Jun 3 09:30:28 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 03 Jun 2010 02:30:28 -0500 Subject: [python-win32] module namedtuple no found on Python Win 2.5.4 In-Reply-To: <4C075977.6030605@gmail.com> References: <4C075977.6030605@gmail.com> Message-ID: <4C075A14.9000002@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, i have an problem at import module collections: > #=========================================================== Python > 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on win32 Traceback (most recent call last): File > "C:\CONCILIACIONES\bin\conciliadorprepago.py", line 13, in > from collections import namedtuple ImportError: cannot import name > namedtuple > #=========================================================== > > i work on Python 2.5.4 and cx_Oracle. > > This is my code: #Seccion de librerias import sys import os -->from > collections import namedtuple > > I need work on this environment for council process. > > GREETINGS. > > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMB1oUAAoJEFWGNhWbCcUYgDoQAIIaeimeSODlPXv0SfjLwpMX p0xkiciPm2C12HW/xvTOvdjNao9qveysS0Q8p7ZoUTBMeJOm4kzzMeSYujqtBXmK P7hwb4def+JXHZ8YzguQK2+MEN7XaBYiAwvDeMOlDDrucgccS85usbio4iIERFmI A2sfFcgVHdpvBy14gPeUeEQyhUjku8lnBf+1lPpTuQw/EsKxRW8RbUeTctHNWnUx vg7xyTkm/np8gJb0DmZr/ZLl8Rs834Jn9GdwWxbae0vhj9uty0KMQCY96uIxt6D8 Kv3L/JV6xDh6zkVGCdyG+TQ4LLp5zWz0w0LMSKYfQ4ZhHfBY7psN4SANtsFQKT43 0cdcYpuAB6frb1njtkOIZtxUcuzUf6Zu32k6fehkIM9vUQ+fmgGejBgJwck/6F/Z Q2fFYmDn/1//lD8+VEcwwboXaTo7dt6iZkX9HbSJxYSGIrHhrZDNFo1xrHU/wHs6 6Jq/pjVTUhXgOaeK15Z2Sd0hDSgmQ+eU66ehphyNm1Lv4JZW+bauUob3qkXnIcsZ HfU/U84fIWFkLST07gbxigKweEbe+jYC+1TjNDwCcxabuLE2WyQePCESfoxGGJN7 kIaHOZfGf5PTQSk8Gve64Tm+6mc5wt8ZsRX16okiW+qftxiRd3UFTF0A4BbFYRzy 1P5wNeIAqu70BESyXZEi =WFrB -----END PGP SIGNATURE----- From graemeglass at gmail.com Thu Jun 3 10:16:00 2010 From: graemeglass at gmail.com (Graeme Glass) Date: Thu, 3 Jun 2010 10:16:00 +0200 Subject: [python-win32] module namedtuple no found on Python Win 2.5.4 In-Reply-To: <4C075A14.9000002@gmail.com> References: <4C075977.6030605@gmail.com> <4C075A14.9000002@gmail.com> Message-ID: On Thu, Jun 3, 2010 at 9:30 AM, Mauricio Martinez Garcia wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, i have an problem at import module collections: >> #=========================================================== Python >> 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit >> (Intel)] on win32 Traceback (most recent call last): File >> "C:\CONCILIACIONES\bin\conciliadorprepago.py", line 13, in >> ?from collections import namedtuple ImportError: cannot import name >> namedtuple >> #=========================================================== >> >> i work on Python 2.5.4 and cx_Oracle. >> >> This is my code: #Seccion de librerias import sys import os -->from >> collections import namedtuple >> >> I need work on this environment for council process. >> >> GREETINGS. That is because namedtuple was only added in python 2.6 http://docs.python.org/dev/library/collections.html From morfeokmg at gmail.com Thu Jun 3 19:50:18 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 03 Jun 2010 12:50:18 -0500 Subject: [python-win32] How can improvement time of response of Python cx_Oracle Message-ID: <4C07EB5A.3000803@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. This is my code for Oracle Connection with python and cx_Oracle. How can improvement time of response?. #========================================================== #Este metodo crea una conexion a oracle def creaConexion(self,v_user, v_passwd, v_schema): rowsSchema = v_schema.split(",") v_server = str(rowsSchema[0]) v_port = int(rowsSchema[1]) v_sid = str(rowsSchema[2]) dsn = cx_Oracle.makedsn(v_server, v_port, v_sid) try: connection = cx_Oracle.connect(v_user, v_passwd,dsn) return connection except cx_Oracle.DatabaseError, exc: error, = exc.args print >> sys.stderr, XP_ERROR+"Oracle-Error-Code:", error.code print >> sys.stderr, XP_ERROR+"Oracle-Error-Message:", error.message sys.exit(1) #metodo que ejecuta un query en oracle def ejecutaQuery(self, query, conn): cursor = conn.cursor() cursor.arraysize = 10000 try: cursor.parse(query) cursor.execute(query) cursorReturn = cursor.fetchall() return cursorReturn except cx_Oracle.DatabaseError, exc: error, = exc.args print >> sys.stderr, XP_ERROR+"Oracle-Error-Code:", error.code print >> sys.stderr, XP_ERROR+"Oracle-Error-Message:", error.message print query sys.exit(1) #========================================================== The time for an comparation of 2 DBs are many. Python: 1 - 2 mins by rows. Java 0.02 - 0.10 secs by rows. my code for comparation #============================================================ n = 1 iniciaconexionBSCS = OracleConnections() iniciaconexionATS = OracleConnections() #Realizamos la conexion a oracle. conn = iniciaconexionBSCS.creaConexion(usrBSCS, pasBSCS, 'BSCSP') conn2 = iniciaconexionATS.creaConexion(usrATS, passATS, 'ATSP') for rows in tuplaTotal: BODY_SQL_BSCS = TMPLT_BSCS % (rows.telefono) BODY_SQL_ATS = TMPLT_ATS % (rows.telefono) error_co_id = '0' error_ciclo = '0' error_pt = '0' error_status = '0' error_activacion = '0' error_saldo = '0' #print BODY_SQL_BSCS #print BODY_SQL_ATS ejecBSCS = iniciaconexionBSCS.ejecutaQuery(BODY_SQL_BSCS, conn) ejecATS = iniciaconexionATS.ejecutaQuery(BODY_SQL_ATS, conn2) for rowsBSCS in ejecBSCS: for rowsATS in ejecATS: #Ejemplos de salida #BS (3404, 7956771, '5546037825', '10', 'a', 'CCT116') #AT ('7956771', '5546037825', '334010011470558', '10', 'a', 'CCT116', 'AC', 0, 335.35000000000002, 0) if ((str(rowsBSCS[2]) == str(rowsATS[1])) and ((int(rowsBSCS[1]) <> int(rowsATS[0])) or (str(rowsBSCS[3]) <> str(rowsATS[3])) or (str(rowsBSCS[4]) <> str(rowsATS[4])) or (str(rowsBSCS[5]) <> str(rowsATS[5])) or (str(rowsATS[6]) == 'CR') or (rowsATS[7] < 0) or (rowsATS[8] < 0) or (rowsATS[9] < 0))): print 'DN Con error: '+rows.telefono if (int(rowsBSCS[1]) <> int(rowsATS[0])): error_co_id = '1' elif (str(rowsBSCS[3]) <> str(rowsATS[3])): error_ciclo = '1' elif (str(rowsBSCS[4]) <> str(rowsATS[4])): error_status = '1' elif (str(rowsBSCS[5]) <> str(rowsATS[5])): error_pt = '1' elif (str(rowsATS[6]) == 'CR'): error_activacion = '1' elif ((rowsATS[7] < 0) or (rowsATS[8] < 0) or (rowsATS[9] < 0)): error_saldo = '1' DNIncorrecto = str(rowsATS[1])+"|"+str(rowsBSCS[1])+"|"+str(rowsATS[0])+"|"+str(rowsBSCS[3])+"|"+str(rowsATS[3])+"|"+str(rowsBSCS[4])+"|"+str(rowsATS[4])+"|"+str(rowsBSCS[5])+"|"+str(rowsATS[5])+"|"+str(rowsATS[6])+"|"+str(rowsATS[7])+"|"+str(rowsATS[8])+"|"+str(rowsATS[9])+"|"+error_co_id+"|"+error_ciclo+"|"+error_status+"|"+error_pt+"|"+error_activacion+"|"+error_saldo+"|"+error_co_id+error_ciclo+error_status+error_pt+error_activacion+error_saldo print str(n)+"--"+XP_LOG+DNIncorrecto #n = n + 1 else: DNCorrecto = str(rowsATS[1])+"|"+str(rowsBSCS[1])+"|"+str(rowsATS[0])+"|"+str(rowsBSCS[3])+"|"+str(rowsATS[3])+"|"+str(rowsBSCS[4])+"|"+str(rowsATS[4])+"|"+str(rowsBSCS[5])+"|"+str(rowsATS[5])+"|"+str(rowsATS[6])+"|"+str(rowsATS[7])+"|"+str(rowsATS[8])+"|"+str(rowsATS[9]) print str(n)+"--"+XP_LOG+DNCorrecto #n = n + 1 #print str(n), rows.telefono n = n + 1 iniciaconexionBSCS.cierraConexion(conn) iniciaconexionATS.cierraConexion(conn2) #============================================================ I need improvement the time of response of 1 - 2 minutes to 0.02 - 0.10 secs. How can this?. GREETINGS. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMB+tZAAoJEFWGNhWbCcUY5vIP/AlE7nTFzX+HkLPq3Lj6yj9s 6yFYRIlcJwX+QEa0PGPXDcJ/nJw5uqLNsKZW2v7R5zmeDmX7BSUx0nO57xju/sEB PnRBYrqXBKd1GvJU46SUJi2ahQx7y37ctzjU9l2sdZ/74JrSWiW1L3Ip4DJnlohR hgmS6PfTx4IvHb26Pn8Sxa5UGmL0OGVrW7b/U9BI+IAXjkXMnrmVQKbaInBIrE3m ZGCwsySTjfSKEhH9ybOVhk4CZHkeRY2wKNv4YZ98++sSkrCFMhdnoPM0fMAsAEN2 sgQhZ9ziNCtpiyGmtL/QVkxeQhwNwpnixrkXf96FfzeVLESwf2117m3RcTntLWKC ixvOOHV2gCF6YCf5UKucQEq8V/D1UgPliPU4pacBvq/5/Xq3zoJxOWxnHRZRiUtA /UgGnhn+7vHvhiYTXJtJrI95i6YyR7mud0ZuWcc7pYGZ6kJ1toIZIgqeLxvK33u0 OrQUOf0n6j+JWS9DiJRrIMhhRPr8IX5pjGg6GfqfcQBKUcJuJnLzev57GFTQHcCl S18lkASTykWV3SPdAc6mmAf2Pv/B2X8CFZk9Oc9kgnqYUVFyikCY4GRv7GCnMucQ 1yYoWT5nz/N9+6SeLkGGhS9nxWL/OJlepYR66shJR4J/1K1Qp5BERhOtLMX5f2kK L8MNhHxT1IictTauhp0D =wckT -----END PGP SIGNATURE----- From heather625 at gmail.com Thu Jun 3 20:14:15 2010 From: heather625 at gmail.com (Heather Kelly) Date: Thu, 03 Jun 2010 14:14:15 -0400 Subject: [python-win32] python 2.5.1 and MSVC++ 2008 Message-ID: <4c07f0fd.e22be50a.1dc5.17b7@mx.google.com> Hi, I work on a project that still supports 2.5.1 for now (we plan to upgrade to 2.6 in the near future). In the meantime, we are moving to MSVC++ 2008 from MSVC++ 2003. Up to now, we have been using the binary distribution of python, but I believe to support MSVC++ 2008, we now must build python 2.5.1 ourselves. Actually, I've already built python itself, but I have run into trouble trying to build tcl/tk 8.4, which comes with support for MSVC++ 6. now for my questions.. am I wrong that I need to rebuilt python 2.5.1 to fully support our MSVC++ users who only have MSVC++ 2008 on their systems? Could I just provide them a couple specific MSVC++ 2003 libraries and they'll be fine? Has anyone else managed to build the tcl/tk with MSVC++ 2008? Would these troubles disappear if we just upgrade to python 2.6 now? Are there any web pages out there that discuss building python and its associated components from scratch? Thanks, Heather From trent at snakebite.org Thu Jun 3 21:13:46 2010 From: trent at snakebite.org (Trent Nelson) Date: Thu, 3 Jun 2010 15:13:46 -0400 Subject: [python-win32] python 2.5.1 and MSVC++ 2008 In-Reply-To: <4c07f0fd.e22be50a.1dc5.17b7@mx.google.com> References: <4c07f0fd.e22be50a.1dc5.17b7@mx.google.com> Message-ID: <4C07FEEA.2040900@snakebite.org> On 6/3/2010 2:14 PM, Heather Kelly wrote: > Hi, > > I work on a project that still supports 2.5.1 for now (we plan to > upgrade to 2.6 in the near future). In the meantime, we are moving > to MSVC++ 2008 from MSVC++ 2003. Up to now, we have been using the > binary distribution of python, but I believe to support MSVC++ 2008, > we now must build python 2.5.1 ourselves. Actually, I've already > built python itself, but I have run into trouble trying to build > tcl/tk 8.4, which comes with support for MSVC++ 6. > > now for my questions.. am I wrong that I need to rebuilt python > 2.5.1 to fully support our MSVC++ users who only have MSVC++ 2008 on > their systems? Could I just provide them a couple specific MSVC++ > 2003 libraries and they'll be fine? > > Has anyone else managed to build the tcl/tk with MSVC++ 2008? > > Would these troubles disappear if we just upgrade to python 2.6 now? I'd highly recommend taking that approach. The compiler toolchain doesn't change for a m.n release (i.e. 2.5.x, 2.6.x). If your strongest requirement is MSVC++ 2008 support, I'd go with 2.6. > Are there any web pages out there that discuss building python and > its associated components from scratch? The buildbots are a good place to start: http://svn.python.org/projects/python/branches/release26-maint/Tools/buildbot/ The external*.bat scripts in that directory take care of building all the external dependencies, like Tcl/Tk. (And from that, you'll be able to see where we grab Tcl/Tk from (svn.python.org/contrib), and all the fiddling we had to do to get that building properly with a non-vc6 toolchain). Trent. From trent at snakebite.org Thu Jun 3 21:16:50 2010 From: trent at snakebite.org (Trent Nelson) Date: Thu, 3 Jun 2010 15:16:50 -0400 Subject: [python-win32] How can improvement time of response of Python cx_Oracle In-Reply-To: <4C07EB5A.3000803@gmail.com> References: <4C07EB5A.3000803@gmail.com> Message-ID: <4C07FFA2.4000701@snakebite.org> On 6/3/2010 1:50 PM, Mauricio Martinez Garcia wrote: > The time for an comparation of 2 DBs are many. > Python: 1 - 2 mins by rows. > Java 0.02 - 0.10 secs by rows. > I need improvement the time of response of 1 - 2 minutes to 0.02 - > 0.10 secs. How can this?. Out of interest, have you ruled out that the Python overhead isn't incurred by just establishing the connection? Oracle interop can be funny sometimes -- underlying configuration oddities can hang initial connection attempts by a couple of minutes. How long does it take to establish a connection and run a dummy query? Trent. From morfeokmg at gmail.com Thu Jun 3 09:27:51 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 03 Jun 2010 02:27:51 -0500 Subject: [python-win32] module namedtuple no found on Python Win 2.5.4 Message-ID: <4C075977.6030605@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, i have an problem at import module collections: #=========================================================== Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Traceback (most recent call last): File "C:\CONCILIACIONES\bin\conciliadorprepago.py", line 13, in from collections import namedtuple ImportError: cannot import name namedtuple #=========================================================== i work on Python 2.5.4 and cx_Oracle. This is my code: #Seccion de librerias import sys import os - -->from collections import namedtuple I need work on this environment for council process. GREETINGS. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMB1l3AAoJEFWGNhWbCcUYRS4QAJjlL9uXXsfI+IFh4F3hXh9Z bSet1H9F+7NGXCkK0X+Alo45xTUXVUQpABpHxE8z7Hhu0CML8+KDbDooJ0FRG1Sf J2NH5VXWUkmlDEGIZVHJ8VPNyR9CA+CsknBB48hqJ6bUD1HLZnK1p37+FyAuQ+WF IdtAjJdjXz5sWaXt0KboKn0T+EUvWpFkK3DOWNHdoMyyajnk7iA71IOlg8gBF2T6 NDuPuGsrmZUFNACXL8FmjtKfHGKb38tkq2HxMj0XshAN0AqNJOdkiGxdYy/EpfJa qH0BXHxz9aj5gthM878o5EbjXKap9jTPCONLvEI6wNjgemXJHGXiXFdNSZQNKMMF IrAGMHOMqzIGA1IQiZRlqTt7A0ydd0n0/vKmbbqyE+rtDoS35BFGauJfFvnTAvhE XJt6ZxUVY0glPecXz6GZjYjpjWe5/96o8UIurmXBPSIWV9cmKo92UYizipR7N4ow Am5empWBk1Lq/pTfzj5UzStDLTWWXdAw50dICkYppDwwk+EDecB4qh0CAzxEKedI KSVdHsB2Jd14xnoVkOnELvXGWxOUxZ75UHrWDPIa61oqQtiQNCs3217s9hu47hrd c7kfaWeJxTqTU8y/0ylVEqYdXKekW+UV4aDQPmR5P22lnewd5jSFLmgzWlta7NIe NeRApQYDUQqnPLzaK5YA =AN2h -----END PGP SIGNATURE----- From brian.curtin at gmail.com Sun Jun 6 06:36:27 2010 From: brian.curtin at gmail.com (Brian Curtin) Date: Sat, 5 Jun 2010 23:36:27 -0500 Subject: [python-win32] module namedtuple no found on Python Win 2.5.4 In-Reply-To: <4C075977.6030605@gmail.com> References: <4C075977.6030605@gmail.com> Message-ID: On Thu, Jun 3, 2010 at 02:27, Mauricio Martinez Garcia wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, i have an problem at import module collections: > #=========================================================== > Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit > (Intel)] on > win32 > Traceback (most recent call last): > File "C:\CONCILIACIONES\bin\conciliadorprepago.py", line 13, in > from collections import namedtuple > ImportError: cannot import name namedtuple > #=========================================================== > > i work on Python 2.5.4 and cx_Oracle. > > This is my code: > #Seccion de librerias > import sys > import os > - -->from collections import namedtuple > > I need work on this environment for council process. > > GREETINGS. > collections.namedtuple was added in 2.6 -------------- next part -------------- An HTML attachment was scrubbed... URL: From arn.vollebregt at xs4all.nl Mon Jun 7 16:53:06 2010 From: arn.vollebregt at xs4all.nl (Arn Vollebregt) Date: Mon, 7 Jun 2010 16:53:06 +0200 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink Message-ID: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> Hi, A while ago I asked a question[1] about hooking MAPI events in Outlook. Although this question was answered[2] back then, I am afraid I am still stuck on the subject: It seems I have been able to hook the AdviseSink, but the onNotify() never fires. However, the fnevNewMail[3] event is seen by OutlookSpy[4] in the IMsgStore::Advise() tab on the folder in question, so I must be doing something wrong. I have attached my example code, and would appreciate any pointers on the subject. Regards, Arn Vollebregt [1] http://mail.python.org/pipermail/python-win32/2009-August/009503.html [2] http://mail.python.org/pipermail/python-win32/2009-August/009504.html [3] http://msdn.microsoft.com/en-us/library/cc765897.aspx [4] http://www.dimastr.com/outspy/ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: hook.py URL: From skippy.hammond at gmail.com Tue Jun 8 01:29:01 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 08 Jun 2010 09:29:01 +1000 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink In-Reply-To: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> References: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> Message-ID: <4C0D80BD.3040503@gmail.com> I'd suggest looking for some C++ code which manages to hook that event as a point of comparison for what magic needs to be done to make things work. Mark On 8/06/2010 12:53 AM, Arn Vollebregt wrote: > Hi, > > A while ago I asked a question[1] about hooking MAPI events in Outlook. > Although this question was answered[2] back then, I am afraid I am still > stuck on the subject: It seems I have been able to hook the AdviseSink, > but the onNotify() never fires. However, the fnevNewMail[3] event is seen > by OutlookSpy[4] in the IMsgStore::Advise() tab on the folder in question, > so I must be doing something wrong. > > I have attached my example code, and would appreciate any pointers on the > subject. > > Regards, > > Arn Vollebregt > > [1] http://mail.python.org/pipermail/python-win32/2009-August/009503.html > [2] http://mail.python.org/pipermail/python-win32/2009-August/009504.html > [3] http://msdn.microsoft.com/en-us/library/cc765897.aspx > [4] http://www.dimastr.com/outspy/ > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From arn.vollebregt at xs4all.nl Tue Jun 8 10:44:15 2010 From: arn.vollebregt at xs4all.nl (Arn Vollebregt) Date: Tue, 8 Jun 2010 10:44:15 +0200 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink In-Reply-To: <4C0D80BD.3040503@gmail.com> References: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> <4C0D80BD.3040503@gmail.com> Message-ID: <9ac8103adc9667af26c44c7700d85b85.squirrel@webmail.xs4all.nl> Ah, I found out why the fnevNewMail event doesnt fire: Advise is only implemented for PyIMAPISession and PyIMAPITable, and not (for example) for PyIMsgStore and PyIMAPIFolder. The later are the only objects which receive fnevNewMail: http://msdn.microsoft.com/en-us/library/cc840027.aspx Will this by any chance be implemented in the near future? Reading C++ is one thing, but I doubt I'll be able to implement this myself. It looks to me like a simple copy/paste action isnt going to cut it, going by the code (difference) in PyIMAPISession.cpp and PyIMAPITable.cpp Regards, Arn Vollebregt > I'd suggest looking for some C++ code which manages to hook that event > as a point of comparison for what magic needs to be done to make things > work. > > Mark > > On 8/06/2010 12:53 AM, Arn Vollebregt wrote: >> Hi, >> >> A while ago I asked a question[1] about hooking MAPI events in Outlook. >> Although this question was answered[2] back then, I am afraid I am still >> stuck on the subject: It seems I have been able to hook the AdviseSink, >> but the onNotify() never fires. However, the fnevNewMail[3] event is >> seen >> by OutlookSpy[4] in the IMsgStore::Advise() tab on the folder in >> question, >> so I must be doing something wrong. >> >> I have attached my example code, and would appreciate any pointers on >> the >> subject. >> >> Regards, >> >> Arn Vollebregt >> >> [1] >> http://mail.python.org/pipermail/python-win32/2009-August/009503.html >> [2] >> http://mail.python.org/pipermail/python-win32/2009-August/009504.html >> [3] http://msdn.microsoft.com/en-us/library/cc765897.aspx >> [4] http://www.dimastr.com/outspy/ >> >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > From python at bdurham.com Wed Jun 9 23:30:54 2010 From: python at bdurham.com (python at bdurham.com) Date: Wed, 09 Jun 2010 17:30:54 -0400 Subject: [python-win32] Creating a list of stress tests for unit tests involving files Message-ID: <1276119054.23858.1379334897@webmail.messagingengine.com> I'm working on a set of unit tests designed to stress test some file handling capabilities of our application. Listed below are some file names designed to cause failures when used with open/codecs.open and with the os/shutil module file functions. Can anyone think of additional scenarios (path names or unusual file access) that we could test against? My tests will initially be for the Windows platform (2000-Windows 7), but I would welcome Linux and/or Mac specific failure conditions as well. UNITTEST_DRIVE_NOT_READY = r'a:' UNITTEST_DRIVE_READ_ONLY = r'g:' # CD drive with CD UNITTEST_UNC_NOT_EXIST = r'\\unc_not_exist' UNITTEST_FILE_BAD_CHARS = r'path_bad_chars_*<>|' UNITTEST_FILE_NO_WRITE = r'c:\program files' UNITTEST_FILE_NOT_EXIST = r'\path_not_exist' UNITTEST_FILE_LOCKED = r'file_locked.tmp' unittest_file_locked = open( UNITTEST_FILE_LOCKED, 'w' ) UNITTEST_UNICODE_PATH = ur'\xunicode_test_\xb0_\xb1_' Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jun 10 00:02:28 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 09 Jun 2010 15:02:28 -0700 Subject: [python-win32] Creating a list of stress tests for unit tests involving files In-Reply-To: <1276119054.23858.1379334897@webmail.messagingengine.com> References: <1276119054.23858.1379334897@webmail.messagingengine.com> Message-ID: <4C100F74.5030607@probo.com> On 6/9/2010 2:30 PM, python at bdurham.com wrote: > I'm working on a set of unit tests designed to stress test some file > handling capabilities of our application. > ... > UNITTEST_UNICODE_PATH = ur'\xunicode_test_\xb0_\xb1_' That string consists of nothing but ordinary ASCII characters (in part, because of the "r"). Were you trying to include some real Unicode outside of the ASCII subset? If so, then maybe something like this: UNITTEST_UNICODE_PATH = u"U\u00F1i\u00E7\u03B8de" That's "U?i??de", which is a valid Windows file name. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From sacaquija at hotmail.com Thu Jun 10 04:22:49 2010 From: sacaquija at hotmail.com (=?iso-8859-1?B?Sm9z6SBCZW5pdG8gQ2FtafFhIFByYWRv?=) Date: Wed, 9 Jun 2010 21:22:49 -0500 Subject: [python-win32] help Message-ID: Hi, I?m trying to do a path logger (Navigation logger) in Python, the thing that I need is that the program can get the paths that de user is accesing in real time, for example: C:\Documents and Settings\ C:\Documents and Settings\Administrator\ C:\Documents and Settings\Administrator\Desktop\ C:\Documents and Settings\Administrator\Desktop\archivos\ C:\Documents and Settings\Administrator\Desktop\Freescale ZeD 1.1.0.lnk C:\Documents and Settings\Administrator\Desktop\Freescale BeeKit.lnk C:\Documents and Settings\All Users\Desktop\PowerISO.lnk Someone knows how I can do this? I read and used the library pyhook, because I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't use it and doesn't give the path only things like the Message, the time, the name of the window, etc. Note: I?m using Windows XP 32bits and python 2.6 Thanks in advance! _________________________________________________________________ Enciende tu hotness con Hotmail www.hotmailhotness.com.mx -------------- next part -------------- An HTML attachment was scrubbed... URL: From sacaquija at hotmail.com Thu Jun 10 04:50:01 2010 From: sacaquija at hotmail.com (sacaquija) Date: Wed, 9 Jun 2010 19:50:01 -0700 (PDT) Subject: [python-win32] Python Hooks Navigation Logger Windows Message-ID: <28838190.post@talk.nabble.com> Hi, I?m trying to do a path logger (Navigation logger) in Python, the thing that I need is that the program can get the paths that de user is accesing in real time, for example: C:\Documents and Settings\ C:\Documents and Settings\Administrator\ C:\Documents and Settings\Administrator\Desktop\ C:\Documents and Settings\Administrator\Desktop\archivos\ C:\Documents and Settings\Administrator\Desktop\Freescale ZeD 1.1.0.lnk C:\Documents and Settings\Administrator\Desktop\Freescale BeeKit.lnk C:\Documents and Settings\All Users\Desktop\PowerISO.lnk Someone knows how I can do this? I read and used the library pyhook, because I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't use it and doesn't give the path only things like the Message, the time, the name of the window, etc. Note: I?m using Windows XP 32bits and python 2.6 Thanks in advance! -- View this message in context: http://old.nabble.com/Python-Hooks-Navigation-Logger-Windows-tp28838190p28838190.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From weichenqi at gmail.com Thu Jun 10 04:57:08 2010 From: weichenqi at gmail.com (chq.wei) Date: Thu, 10 Jun 2010 10:57:08 +0800 Subject: [python-win32] About monitor windows 2003 for Python Message-ID: I am trying to use Python to monitor CPU usage ,traffic and tcp established?on windows 2003?How to do it?THX??? From pacopyc at gmail.com Thu Jun 10 08:51:30 2010 From: pacopyc at gmail.com (pacopyc pacopyc) Date: Thu, 10 Jun 2010 08:51:30 +0200 Subject: [python-win32] disable network interface Message-ID: Excuse me, I'd like to disable network interface of a remote host. I'm thinking to use Win32_NetworkAdapter. What do you think? How can I do? Is it possible disable network interface? Can you help me? I found in Internet this code: import wmi; c = wmi.WMI() o = c.query("select * from Win32_NetworkAdapter where NetConnectionID='wifi'")[0] o.EnableDevice(1) ** -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu Jun 10 09:44:09 2010 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 10 Jun 2010 08:44:09 +0100 Subject: [python-win32] disable network interface In-Reply-To: References: Message-ID: <4C1097C9.6000902@timgolden.me.uk> On 10/06/2010 07:51, pacopyc pacopyc wrote: > Excuse me, I'd like to disable network interface of a remote host. I'm > thinking to use Win32_NetworkAdapter. Isn't that rather like sawing off the branch you're sitting on? > What do you think? How can I do? Is it possible disable network interface? > Can you help me? > > I found in Internet this code: > > import wmi; > c = wmi.WMI() > o = c.query("select * from Win32_NetworkAdapter where > NetConnectionID='wifi'")[0] > o.EnableDevice(1) Well, the Win32_NetworkAdapter class doesn't have an EnableDevice method AFAICS, although it has Enable and Disable methods from Vista/2k8 onwards. The other obvious place to look is Win32_NetworkAdapterConfiguration. Although that doesn't have a straightforward Enable/Disable, you might achieve the same effect by turning off DHCP and giving it a NULL static address. Or something. TJG From dokrasa at gmail.com Thu Jun 10 13:28:20 2010 From: dokrasa at gmail.com (Damian Okrasa) Date: Thu, 10 Jun 2010 13:28:20 +0200 Subject: [python-win32] problems when running python script from windows service app Message-ID: I'm using Python 3.1.2 on Windows 7. I have windows service written in C which starts python script and it doesn't work. However when C program isn't windows service it works flawlessly. // part of windows service Py_Initialize(); PyRun_SimpleString(buffer); Py_Finalize(); # python scipt import http.server try: server = http.server.HTTPServer(('', 9000), http.server.SimpleHTTPRequestHandler) server.serve_forever() except Exception as inst: f = open("c:\\log.txt", "w") f.write(str(type(inst))) f.write(str(inst.args)) f.write(str(inst)) f.close() // log.txt ("'NoneType' object has no attribute 'write'",)'NoneType' object has no attribute 'write' From pacopyc at gmail.com Thu Jun 10 13:45:49 2010 From: pacopyc at gmail.com (pacopyc pacopyc) Date: Thu, 10 Jun 2010 13:45:49 +0200 Subject: [python-win32] disable network interface Message-ID: Ok, thank you. But I'd like to block network access to a remote host while it is working ... without execute shutdown. Is it possible? I want that it could continue working but without network access. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arn.vollebregt at xs4all.nl Thu Jun 10 12:25:38 2010 From: arn.vollebregt at xs4all.nl (Arn Vollebregt) Date: Thu, 10 Jun 2010 12:25:38 +0200 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink In-Reply-To: <9ac8103adc9667af26c44c7700d85b85.squirrel@webmail.xs4all.nl> References: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> <4C0D80BD.3040503@gmail.com> <9ac8103adc9667af26c44c7700d85b85.squirrel@webmail.xs4all.nl> Message-ID: <11049beef127c9fb8dfd7868e34de0a6.squirrel@webmail.xs4all.nl> I have made an attempt at implementing the Advise function for PyIMsgStore, as you will find attached. However, following the trend thusfar, onNotify() still is not called. Am I on the wrong path here, or am I still missing something? Regards, Arn Vollebregt P.S.: In my previous email I was claiming the Advise function should also be available for PyIMAPIFolder, but this is not the case: http://msdn.microsoft.com/en-us/library/bb159903.aspx > Ah, I found out why the fnevNewMail event doesnt fire: Advise is only > implemented for PyIMAPISession and PyIMAPITable, and not (for example) for > PyIMsgStore and PyIMAPIFolder. The later are the only objects which > receive fnevNewMail: http://msdn.microsoft.com/en-us/library/cc840027.aspx > > Will this by any chance be implemented in the near future? Reading C++ is > one thing, but I doubt I'll be able to implement this myself. It looks to > me like a simple copy/paste action isnt going to cut it, going by the code > (difference) in PyIMAPISession.cpp and PyIMAPITable.cpp > > Regards, > > Arn Vollebregt > >> I'd suggest looking for some C++ code which manages to hook that event >> as a point of comparison for what magic needs to be done to make things >> work. >> >> Mark >> >> On 8/06/2010 12:53 AM, Arn Vollebregt wrote: >>> Hi, >>> >>> A while ago I asked a question[1] about hooking MAPI events in Outlook. >>> Although this question was answered[2] back then, I am afraid I am >>> still >>> stuck on the subject: It seems I have been able to hook the AdviseSink, >>> but the onNotify() never fires. However, the fnevNewMail[3] event is >>> seen >>> by OutlookSpy[4] in the IMsgStore::Advise() tab on the folder in >>> question, >>> so I must be doing something wrong. >>> >>> I have attached my example code, and would appreciate any pointers on >>> the >>> subject. >>> >>> Regards, >>> >>> Arn Vollebregt >>> >>> [1] >>> http://mail.python.org/pipermail/python-win32/2009-August/009503.html >>> [2] >>> http://mail.python.org/pipermail/python-win32/2009-August/009504.html >>> [3] http://msdn.microsoft.com/en-us/library/cc765897.aspx >>> [4] http://www.dimastr.com/outspy/ >>> >>> >>> >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >> >> > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: hook.py URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: PyIMsgStore.cpp URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: PyIMsgStore.h URL: From skippy.hammond at gmail.com Fri Jun 11 09:33:34 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 11 Jun 2010 17:33:34 +1000 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink In-Reply-To: <11049beef127c9fb8dfd7868e34de0a6.squirrel@webmail.xs4all.nl> References: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> <4C0D80BD.3040503@gmail.com> <9ac8103adc9667af26c44c7700d85b85.squirrel@webmail.xs4all.nl> <11049beef127c9fb8dfd7868e34de0a6.squirrel@webmail.xs4all.nl> Message-ID: <4C11E6CE.5090406@gmail.com> On 10/06/2010 8:25 PM, Arn Vollebregt wrote: > I have made an attempt at implementing the Advise function for > PyIMsgStore, as you will find attached. However, following the trend > thusfar, onNotify() still is not called. Am I on the wrong path here, or > am I still missing something? I'm traveling at the moment so can't look in any detail, but what would help is if you could attach a diff rather than the modified files. Mark From skippy.hammond at gmail.com Fri Jun 11 09:36:39 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 11 Jun 2010 17:36:39 +1000 Subject: [python-win32] problems when running python script from windows service app In-Reply-To: References: Message-ID: <4C11E787.5030800@gmail.com> On 10/06/2010 9:28 PM, Damian Okrasa wrote: > I'm using Python 3.1.2 on Windows 7. I have windows service written in > C which starts python script and it doesn't work. However when C > program isn't windows service it works flawlessly. Why not just implement the service directly in Python? > // log.txt > ("'NoneType' object has no attribute > 'write'",)'NoneType' object has no attribute 'write' You need to get the full traceback - I suspect the problem is that something is attempting to write to sys.stderr or sys.stdout, but these will be None in py3k when there is no console attached. Cheers, Mark From arn.vollebregt at xs4all.nl Fri Jun 11 14:21:56 2010 From: arn.vollebregt at xs4all.nl (Arn Vollebregt) Date: Fri, 11 Jun 2010 14:21:56 +0200 Subject: [python-win32] PyIMAPISession && IID_IMAPIAdviseSink In-Reply-To: <4C11E6CE.5090406@gmail.com> References: <848d9804589eca304f782aeb23d0457e.squirrel@webmail.xs4all.nl> <4C0D80BD.3040503@gmail.com> <9ac8103adc9667af26c44c7700d85b85.squirrel@webmail.xs4all.nl> <11049beef127c9fb8dfd7868e34de0a6.squirrel@webmail.xs4all.nl> <4C11E6CE.5090406@gmail.com> Message-ID: > I'm traveling at the moment so can't look in any detail, but what would > help is if you could attach a diff rather than the modified files. Here you go. Regards, Arn Vollebregt -------------- next part -------------- A non-text attachment was scrubbed... Name: PyIMsgStore.cpp.patch Type: application/octet-stream Size: 3345 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: PyIMsgStore.h.patch Type: application/octet-stream Size: 519 bytes Desc: not available URL: From dokrasa at gmail.com Fri Jun 11 15:08:23 2010 From: dokrasa at gmail.com (Damian Okrasa) Date: Fri, 11 Jun 2010 15:08:23 +0200 Subject: [python-win32] problems when running python script from windows service app In-Reply-To: <4C11E787.5030800@gmail.com> References: <4C11E787.5030800@gmail.com> Message-ID: 2010/6/11 Mark Hammond : > On 10/06/2010 9:28 PM, Damian Okrasa wrote: >> >> I'm using Python 3.1.2 on Windows 7. I have windows service written in >> C which starts python script and it doesn't work. However when C >> program isn't windows service it works flawlessly. > > Why not just implement the service directly in Python? > I don't know if I could. I have everything in one directory, so installing python won't be required. The service only sets current working directory to directory where service exe and python dll are, and then it starts python application. >> // log.txt >> ("'NoneType' object has no attribute >> 'write'",)'NoneType' object has no attribute 'write' > > You need to get the full traceback - I suspect the problem is that something > is attempting to write to sys.stderr or sys.stdout, but these will be None > in py3k when there is no console attached. > > Cheers, > > Mark > I checked the traceback and the last log lines were: File "C:\Python31\Lib\http\server.py", line 464, in log_message sys.stderr.write("%s - - [%s] %s\n" % AttributeError: 'NoneType' object has no attribute 'write' So you were right. It worked when I added: f = open("c:\\stderr.txt", "w") sys.stderr = f From ackermad at carleton.edu Fri Jun 11 17:08:33 2010 From: ackermad at carleton.edu (Dan Ackerman) Date: Fri, 11 Jun 2010 10:08:33 -0500 (CDT) Subject: [python-win32] Trying to send info through serial port In-Reply-To: <1759259046.1478857.1276268814277.JavaMail.root@mail2.its.carleton.edu> Message-ID: <2004446107.1478920.1276268913488.JavaMail.root@mail2.its.carleton.edu> Hello, I need to be able to send some information through my computer's serial port. I am using python version 2.6, the pyserial 1.21 module, and the pywin module. My code seems to be sending info somewhere, because any print statement I add after the import serial command doesn't show up in my terminal window. However, the device connected to my serial port doesn't seem to be registering any received information. I want to send the string "FREQ 720 MHz." If anyone could help me out with this code, it would be greatly appreciated: import serial ser = serial.Serial(0) #if port has specific name, use: ser = serial.Serial('portName', 19200, timeout=0) print ser.portstr #should tell you what specific port was used ser.write('FREQ 720 MHz') ser.close() Thanks, Dan From jdmain at comcast.net Fri Jun 11 22:10:27 2010 From: jdmain at comcast.net (J.D. Main) Date: Fri, 11 Jun 2010 14:10:27 -0600 Subject: [python-win32] Trying to send info through serial port In-Reply-To: <2004446107.1478920.1276268913488.JavaMail.root@mail2.its.carleton.edu> References: <1759259046.1478857.1276268814277.JavaMail.root@mail2.its.carleton.edu>, <2004446107.1478920.1276268913488.JavaMail.root@mail2.its.carleton.edu> Message-ID: <4C1243D3.13124.9E6A1314@jdmain.comcast.net> Hi, I have found that the serial port doesn't get opened sometimes. Here's what I do: import serial ser = serial.Serial() ser.port = 0 ser.baudrate = 9600 ser.timeout = 1 ser.open() You can see if the port is open by printing the serial object. In your code you'll use: print ser one of the parameters is open= True (or False) By explicitly setting the serial object properties it always works for me. JDM Hello, I need to be able to send some information through my computer's serial port. I am using python version 2.6, the pyserial 1.21 module, and the pywin module. My code seems to be sending info somewhere, because any print statement I add after the import serial command doesn't show up in my terminal window. However, the device connected to my serial port doesn't seem to be registering any received information. I want to send the string "FREQ 720 MHz." If anyone could help me out with this code, it would be greatly appreciated: import serial ser = serial.Serial(0) #if port has specific name, use: ser = serial.Serial('portName', 19200, timeout=0) print ser.portstr #should tell you what specific port was used ser.write('FREQ 720 MHz') ser.close() Thanks, Dan _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From roberto.c.aguilar at gmail.com Fri Jun 11 18:35:52 2010 From: roberto.c.aguilar at gmail.com (Roberto Aguilar) Date: Fri, 11 Jun 2010 09:35:52 -0700 Subject: [python-win32] Trying to send info through serial port In-Reply-To: <2004446107.1478920.1276268913488.JavaMail.root@mail2.its.carleton.edu> References: <2004446107.1478920.1276268913488.JavaMail.root@mail2.its.carleton.edu> Message-ID: On Jun 11, 2010, at 8:08 AM, Dan Ackerman wrote: > Hello, > I need to be able to send some information through my computer's serial port. I am using python version 2.6, the pyserial 1.21 module, and the pywin module. My code seems to be sending info somewhere, because any print statement I add after the import serial command doesn't show up in my terminal window. However, the device connected to my serial port doesn't seem to be registering any received information. I want to send the string "FREQ 720 MHz." > > If anyone could help me out with this code, it would be greatly appreciated: > > import serial > ser = serial.Serial(0) #if port has specific name, use: ser = serial.Serial('portName', 19200, timeout=0) > print ser.portstr #should tell you what specific port was used > ser.write('FREQ 720 MHz') > ser.close() Dan, In my experience connecting to a serial port does not cause prints to stop sending to stdout. My guess is that ser.portstr is an empty string or None. Try printing this instead to test that theory: print 'portstr: "%s"' % (ser.portstr,) My bet is you get: portstr: "" Secondly, what COM port are you connecting to? If, for example, you're connecting to COM1 and the baud rate is 19200, try this: ser = serial.Serial('COM1', 19200, timeout=0) Finally, highly dependent on the device you are sending data to, maybe you're missing a newline or something at the end of the string you are sending? ser.write('FREQ 720 MHz\n') Good luck, -Roberto. From fwdtome at netcologne.de Sat Jun 12 14:40:28 2010 From: fwdtome at netcologne.de (Micha Stellmacher) Date: Sat, 12 Jun 2010 14:40:28 +0200 Subject: [python-win32] watermark bitmap in a property sheet wizard Message-ID: <4C13803C.5030505@netcologne.de> Hi, I would like to create a property sheet wizard with a "watermark" bitmap. The following sample code runs on a XP Pro (IE 8) machine: ------------------------------------------------------------------------------- from pywin.mfc import dialog from win32api import LoadLibrary from win32com.shell import shellcon from win32gui import LoadImage import win32con class PropertySheetWizard(dialog.PropertySheet): def __init__(self, pageList, dll): dialog.PropertySheet.__init__(self, 'My Property Sheet Wizard', dll, pageList) self.SetWizardMode() dwFlags = (shellcon.PSH_WIZARD97 | shellcon.PSH_WATERMARK | shellcon.PSH_USEHBMWATERMARK | shellcon.PSH_STRETCHWATERMARK) self.SetPSHBit(dwFlags, 1) hlib = LoadLibrary(dll) self.hbmWatermark = LoadImage(hlib, 124, win32con.IMAGE_BITMAP, 0, 0, 0) # ... ??? page = self.GetActivePage() page.SetPSPBit(shellcon.PSP_HIDEHEADER, 1) wiz = PropertySheetWizard([49,], r'C:\Windows\system32\syssetup.dll') wiz.DoModal() ------------------------------------------------------------------------------- MSDN says: "The watermark is specified in the wizard's PROPSHEETHEADER structure and is added to the page automatically." [http://msdn.microsoft.com/en-us/library/bb774544%28VS.85%29.aspx] What have I to do to set my image resp. to pass my hbmWatermark to the PROPSHEETHEADER structure? Thank you in advance. Micha Stellmacher From ackermad at carleton.edu Mon Jun 14 16:52:56 2010 From: ackermad at carleton.edu (Dan Ackerman) Date: Mon, 14 Jun 2010 09:52:56 -0500 (CDT) Subject: [python-win32] Problem with Pyserial Message-ID: <440293443.1528722.1276527176719.JavaMail.root@mail2.its.carleton.edu> Hello, I am trying to send some information out of my computer's serial port. I found the code posted below online, and the person who posted it said it worked for them. However, when I tried the code, nothing was sent through the serial port but I didn't receive any error messages. Does anyone know what the problem could be? import serial ser=serial.Serial(0) ser.baudrate=9600 ser.port=0 ser.open() ser.write("hello\n") ser.close() Thanks, Dan From timr at probo.com Mon Jun 14 19:45:18 2010 From: timr at probo.com (Tim Roberts) Date: Mon, 14 Jun 2010 10:45:18 -0700 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <28838190.post@talk.nabble.com> References: <28838190.post@talk.nabble.com> Message-ID: <4C166AAE.9000504@probo.com> On 6/9/2010 7:50 PM, sacaquija wrote: > Hi, I?m trying to do a path logger (Navigation logger) in Python, the thing > that I need is that the program can get the paths that de user is accesing > in real time, for example: > > C:\Documents and Settings\ > C:\Documents and Settings\Administrator\ > C:\Documents and Settings\Administrator\Desktop\ > C:\Documents and Settings\Administrator\Desktop\archivos\ > C:\Documents and Settings\Administrator\Desktop\Freescale ZeD 1.1.0.lnk > C:\Documents and Settings\Administrator\Desktop\Freescale BeeKit.lnk > C:\Documents and Settings\All Users\Desktop\PowerISO.lnk > > Someone knows how I can do this? I read and used the library pyhook, because > I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't > use it and doesn't give the path only things like the Message, the time, the > name of the window, etc. > I'm not sure I understand your requirement. Are you trying to track every directory and every file that the user accesses, in every program that's currently running? There are no hooks that implement that kind of thing. The performance hit would be disastrous. That requires a kernel-mode file system filter driver, which is an enormously complicated beast that absolutely cannot be written in Python. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mdriscoll at co.marshall.ia.us Mon Jun 14 23:19:09 2010 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 14 Jun 2010 16:19:09 -0500 Subject: [python-win32] SetPrinterDataEx or SetPrinterData Message-ID: <4C169CCD.1060102@co.marshall.ia.us> Hi, I am looking for a way to call SetPrinterDataEx or SetPrinterData so I can set some parameters for one our admins. For some reason, the new Brother printer we bought thinks that we're not admins, so we need a way to hack it. I can't find anything in Python about these functions. Here are the MSDN pages I found: http://msdn.microsoft.com/en-us/library/dd145084%28VS.85%29.aspx http://msdn.microsoft.com/en-us/library/dd145083%28VS.85%29.aspx I googled various terms, but it doesn't look like PyWin32 wraps either of these directly. Does anyone know any workarounds? Thanks! -- *Mike Driscoll* Blog: http://blog.pythonlibrary.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jun 14 23:40:36 2010 From: timr at probo.com (Tim Roberts) Date: Mon, 14 Jun 2010 14:40:36 -0700 Subject: [python-win32] SetPrinterDataEx or SetPrinterData In-Reply-To: <4C169CCD.1060102@co.marshall.ia.us> References: <4C169CCD.1060102@co.marshall.ia.us> Message-ID: <4C16A1D4.9080604@probo.com> On 6/14/2010 2:19 PM, Mike Driscoll wrote: > > I am looking for a way to call SetPrinterDataEx or SetPrinterData so I > can set some parameters for one our admins. For some reason, the new > Brother printer we bought thinks that we're not admins, so we need a > way to hack it. I can't find anything in Python about these functions. > Here are the MSDN pages I found: > > http://msdn.microsoft.com/en-us/library/dd145084%28VS.85%29.aspx > http://msdn.microsoft.com/en-us/library/dd145083%28VS.85%29.aspx > > I googled various terms, but it doesn't look like PyWin32 wraps either > of these directly. Does anyone know any workarounds? Thanks! Those are just shortcuts to registry access. Have you tried manipulating the registry by hand to make sure you can effect the changes you want? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jdmain at comcast.net Tue Jun 15 03:02:31 2010 From: jdmain at comcast.net (J.D. Main) Date: Mon, 14 Jun 2010 19:02:31 -0600 Subject: [python-win32] Problem with Pyserial In-Reply-To: <440293443.1528722.1276527176719.JavaMail.root@mail2.its.carleton.edu> References: <440293443.1528722.1276527176719.JavaMail.root@mail2.its.carleton.edu> Message-ID: <4C167CC7.12755.F61F1F3@jdmain.comcast.net> Hello, Question: How do you know that ser.write("hello\n") isn't outputing the string "hello"? Did you plug another computer into that COM port to check? I have learned to never take any serial port stuff for granted. I usually plug another computer into the serial port to make absolutely sure that data is really flowing at the baudrate that I expect. PC1(with python script) | * null modem DB9F-DB9F cable * | PC2 (with hyperterminal listening at 9600 baud) If you run the python script, and your port is really setup correctly, you will see the string "hello" on the other end. If you don't, it is possible that COM1 ser(0) isn't the port on the back your PC - maybe it's COM2 or COM3 or COM23... Also, be sure that you've got the right cable - Straight Thru vs Null Modem. If you're trying to connect a Female port to a Male port, then you need a straight thru cable (probably). If you're trying to connect a M to M or F to F then you need a null modem (probably). I have used Pyserial a lot and it always does what I want so my guess is that you are using the wrong cable, sending the wrong string, or instantiating the wrong serial port. Of course, it is possible that your serial port is busted - it can happen (that sucks!) Good luck. JDM Hello, I am trying to send some information out of my computer's serial port. I found the code posted below online, and the person who posted it said it worked for them. However, when I tried the code, nothing was sent through the serial port but I didn't receive any error messages. Does anyone know what the problem could be? import serial ser=serial.Serial(0) ser.baudrate=9600 ser.port=0 ser.open() ser.write("hello\n") ser.close() Thanks, Dan _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From amonroe at columbus.rr.com Tue Jun 15 05:14:56 2010 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Mon, 14 Jun 2010 23:14:56 -0400 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <4C166AAE.9000504@probo.com> References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com> Message-ID: <147689968912.20100614231456@columbus.rr.com> >> Hi, I?m trying to do a path logger (Navigation logger) in Python, the thing >> that I need is that the program can get the paths that de user is accesing >> in real time, for example: >> >> C:\Documents and Settings\ >> C:\Documents and Settings\Administrator\ >> C:\Documents and Settings\Administrator\Desktop\ >> C:\Documents and Settings\Administrator\Desktop\archivos\ >> C:\Documents and Settings\Administrator\Desktop\Freescale ZeD 1.1.0.lnk >> C:\Documents and Settings\Administrator\Desktop\Freescale BeeKit.lnk >> C:\Documents and Settings\All Users\Desktop\PowerISO.lnk >> >> Someone knows how I can do this? I read and used the library pyhook, because >> I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't >> use it and doesn't give the path only things like the Message, the time, the >> name of the window, etc. >> Can you cheat, and use something like Sysinternals Filemon writing to a log, then reading that log? Alan From timr at probo.com Tue Jun 15 18:37:28 2010 From: timr at probo.com (Tim Roberts) Date: Tue, 15 Jun 2010 09:37:28 -0700 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <147689968912.20100614231456@columbus.rr.com> References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com> <147689968912.20100614231456@columbus.rr.com> Message-ID: <4C17AC48.7020406@probo.com> On 6/14/2010 8:14 PM, R. Alan Monroe wrote: >>> ... >>> Someone knows how I can do this? I read and used the library pyhook, because >>> I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't >>> use it and doesn't give the path only things like the Message, the time, the >>> name of the window, etc. >>> > Can you cheat, and use something like Sysinternals Filemon writing to > a log, then reading that log? That's a good suggestion. Filemon, for what it's worth, DOES install a file system filter driver, just as I described. It also installs filter drivers in many other driver stacks. It's a fairly intrusive technology. Darn cool voodoo, but intrusive. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From sacaquija at hotmail.com Wed Jun 16 00:33:41 2010 From: sacaquija at hotmail.com (=?iso-8859-1?B?Sm9z6SBCZW5pdG8gQ2FtafFhIFByYWRv?=) Date: Tue, 15 Jun 2010 17:33:41 -0500 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <4C17AC48.7020406@probo.com> References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, <147689968912.20100614231456@columbus.rr.com>, <4C17AC48.7020406@probo.com> Message-ID: On 6/14/2010 8:14 PM, R. Alan Monroe wrote: >>> ... >>> Someone knows how I can do this? I read and used the library pyhook, because >>> I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't >>> use it and doesn't give the path only things like the Message, the time, the >>> name of the window, etc. >>> > Can you cheat, and use something like Sysinternals Filemon writing to > a log, then reading that log? That's a good suggestion. Filemon, for what it's worth, DOES install a file system filter driver, just as I described. It also installs filter drivers in many other driver stacks. It's a fairly intrusive technology. Darn cool voodoo, but intrusive. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. Jos? Cami?a (sacaquija): May be I can use that but I need communication with python too, what I mean is that the program, for example the Filemon send messages to a resident program, so it?s good to write in a file but I need also to send the new logs to python in real time. Thanks for your answers. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 _________________________________________________________________ ?Te crees fan de Messenger? Compru?balo www.vivirmessenger.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From RDahlstrom at directedge.com Wed Jun 16 00:41:13 2010 From: RDahlstrom at directedge.com (Dahlstrom, Roger) Date: Tue, 15 Jun 2010 18:41:13 -0400 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: Message-ID: <78C91C6FD63DD04BB8812EE9288C1E8125BA22334E@EXCHANGE01.office.directedge.net> You could tail the log file... ________________________________ From: python-win32-bounces+rdahlstrom=directedge.com at python.org To: timr at probo.com ; python-win32 at python.org Sent: Tue Jun 15 18:33:41 2010 Subject: Re: [python-win32] Python Hooks Navigation Logger Windows On 6/14/2010 8:14 PM, R. Alan Monroe wrote: >>> ... >>> Someone knows how I can do this? I read and used the library pyhook, because >>> I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't >>> use it and doesn't give the path only things like the Message, the time, the >>> name of the window, etc. >>> > Can you cheat, and use something like Sysinternals Filemon writing to > a log, then reading that log? That's a good suggestion. Filemon, for what it's worth, DOES install a file system filter driver, just as I described. It also installs filter drivers in many other driver stacks. It's a fairly intrusive technology. Darn cool voodoo, but intrusive. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. Jos? Cami?a (sacaquija): May be I can use that but I need communication with python too, what I mean is that the program, for example the Filemon send messages to a resident program, so it?s good to write in a file but I need also to send the new logs to python in real time. Thanks for your answers. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 ________________________________ En Messenger est?n mis contactos con los que s? tengo contacto ________________________________ DISCLAIMER: This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. Direct Edge may, at its discretion, monitor and review the content of all e-mail communications. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Jun 16 00:49:10 2010 From: timr at probo.com (Tim Roberts) Date: Tue, 15 Jun 2010 15:49:10 -0700 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, <147689968912.20100614231456@columbus.rr.com>, <4C17AC48.7020406@probo.com> Message-ID: <4C180366.1060602@probo.com> On 6/15/2010 3:33 PM, Jos? Benito Cami?a Prado wrote: > Jos? Cami?a (sacaquija): > May be I can use that but I need communication with python too, what I mean is that > the program, for example the Filemon send messages to a resident program, so it?s good > to write in a file but I need also to send the new logs to python in real time. > If you are not able to leverage something like Filemon, then you have to create a file system filter driver. If you don't have kernel experience, it will take you more than 6 months to create such a thing. Also, you need to remember that there are an ENORMOUS number of file system manipulations going on in the typical Windows system. Have you ever looked at the output of Filemon? Most people are astonished by the number of file accesses and file reads and directory reads and existence tests that get done. Just starting up a relatively simple application can cause THOUSANDS of file and directory accesses, as it searches through its path for each and every DLL. If your system is busy, Python won't be able to keep up. Roger Dahlstrom wrote: >You could tail the log file... Another good suggestion... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From d_vineet at yahoo.com Thu Jun 17 16:38:05 2010 From: d_vineet at yahoo.com (Vineet Deodhar) Date: Thu, 17 Jun 2010 07:38:05 -0700 (PDT) Subject: [python-win32] shelve / pickle error Message-ID: <474123.77481.qm@web32008.mail.mud.yahoo.com> Hi ! I am using python ver 2.6.5 Trying to use shelve to save an object on the disc. ================================= In the code---- # There are 'Person' & 'Manager' classes. # I created instance objects a,b,c from these classes. from person import Person, Manager a = Person('A A') b = Person('B B', job = 'clerk', pay=5000) c = Manager('C C', 15000) # instance objects a,b,c were created correctly. # then I store them on a shelve import shelve dbs = shelve.open('mydb') for x in (a, b, c): dbs[x.name] = x dbs.close() # On the disc, I can see the 3 files viz. mydb.dat, mydb.bak, mydb.dir # dbs.keys() is also giving me the correct list of keys. ================================== # NOW THE PROBLEM AREA --- # when I try to fetch an object by key--- a = dbs['A A'] # I get an error as-- # File "F:\Py26\lib\shelve.py", line 122, in __getitem__ # value = Unpickler(f).load() # ValueError: unsupported pickle protocol: 3 ============================= I couldn't locate the bug in this. Can anybody pl. point out? ---Thanks, Vineet. -------------- next part -------------- An HTML attachment was scrubbed... URL: From morfeokmg at gmail.com Thu Jun 17 20:09:05 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 17 Jun 2010 13:09:05 -0500 Subject: [python-win32] Parse HTML String only not file Message-ID: <1276798145.5063.37.camel@lnx-Mobile.tux-net.mmg> Hi, how can parse an HTML String. I need parse next Line : 'BSCS statusstringnoneTopCre_lifeinteger0' And this is the program: ============================================== #!/usr/bin/env python from sgmllib import SGMLParser import urllib import pdb class ParserHTML(SGMLParser): #pdb.set_trace() def unknown_starttag(self, tag, attrs): value = 0 startTAG = '<' + tag for i in attrs: if(i[0].lower() == i[1].lower() and not i[0] == i[1]): startTAG = startTAG[:-1] + ' ' + str(i[1]) value = 1 else: startTAG += ' ' + str(i[0]) + '="' + str(i[1]) + '"' value = 0 if(value == 1): startTAG += '"' startTAG += '>' def handle_data(self, data): #print data detalle = [] detalle2 = [] a = '' for pruebas in data: #pruebas = data detalle.extend(pruebas) a = ''.join([a, pruebas]) detalle2.append(a) print detalle2 return detalle2 def P_main(self, atr): return p.feed(atr) if __name__ == '__main__': node = 'BSCS statusstringnoneTopCre_lifeinteger0' p = ParserHTML() dts = p.P_main(node) ============================================== Result of program its: bash-3.1$ ./pruebasDOM.py ['BSCS status'] ['string'] ['none'] ['TopCre_life'] ['integer'] ['0'] I can't pass the data to one dict() or []. I need all values, ['BSCS Status', 'string', 'none', 'TopCre_life', 'integer', '0'] That i can do? Tanks and greetings. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part URL: From morfeokmg at gmail.com Thu Jun 17 20:18:08 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 17 Jun 2010 13:18:08 -0500 Subject: [python-win32] python-win32 Digest, Vol 87, Issue 3 In-Reply-To: References: Message-ID: <1276798688.5063.38.camel@lnx-Mobile.tux-net.mmg> On response: row--mins--LOG_PYTHON: register info 192--1.62111605008--LOG_PYTHON: 526862501806|6130314|6130314|01|01|s|s| CELIT710|CELIT710|AC|0|57.22| 0 193--1.6306677858--LOG_PYTHON: 523330779616|5038757|5038757|01|01|s|s| CPLUS1315|CPLUS1315|AC|0|1790.77| 0 194--1.64019101858--LOG_PYTHON: 522464589571|5039835|5039835|01|01|s|s| CPLUS015|CPLUS015|AC|0|240.64| 0 195--1.65014798244--LOG_PYTHON: 528115941967|5035308|5035308|01|01|s|s| CCT1316|CCT1316|AC|0|382.43| 1.08 196--1.66029798587--LOG_PYTHON: 522226159880|5033797|5033797|01|01|a|a| CCT1316|CCT1316|AC|0|282.15|0 197--1.67140610218--LOG_PYTHON: 527351660404|5032529|5032529|01|01|s|s| CCT1316|CCT1316|AC|0|392.35|0 198--1.68326413234--LOG_PYTHON: 527351660042|7204513|7204513|01|01|s|s| CPLUS015|CPLUS015|AC|0|364|0 199--1.69420450131--LOG_PYTHON: 529932672067|5029001|5029001|01|01|s|s| CPLUS015|CPLUS015|AC|0|349.46| 0 200--1.70307114919--LOG_PYTHON: 529932672069|5029006|5029006|01|01|s|s| CPLUS015|CPLUS015|AC|0|364|0 201--1.71299698353--LOG_PYTHON: 524641211699|6738198|6738198|01|01|s|s| CPLUS015|CPLUS015|AC|0|291.89| 0 202--1.72252208392--LOG_PYTHON: 522226163037|6391680|6391680|01|01|s|s| CPLUS015|CPLUS015|AC|0|364|0 203--1.73303683599--LOG_PYTHON: 528117371540|7844922|7844922|01|01|a|a| CCT116|CCT116|AC|0|374.3|0 204--1.742791152--LOG_PYTHON: 528115945727|5003318|5003318|01|01|s|s| CPLUS015|CPLUS015|AC|0|353.08|0 205---2.1497408549e-06--LOG_PYTHON: 528113804731|5000770|5000770|05|05| a|a|CPLUS015|CPLUS015|AC|0|-139.041|0|0|0|0|0|0|1|000001 On Fri, 2010-06-04 at 12:00 +0200, python-win32-request at python.org wrote: > Message: 4 > Date: Thu, 3 Jun 2010 15:16:50 -0400 > From: Trent Nelson > To: > Subject: Re: [python-win32] How can improvement time of response of > Python cx_Oracle > Message-ID: <4C07FFA2.4000701 at snakebite.org> > Content-Type: text/plain; charset="ISO-8859-1"; format=flowed > > On 6/3/2010 1:50 PM, Mauricio Martinez Garcia wrote: > > The time for an comparation of 2 DBs are many. > > Python: 1 - 2 mins by rows. > > Java 0.02 - 0.10 secs by rows. > > > I need improvement the time of response of 1 - 2 minutes to 0.02 - > > 0.10 secs. How can this?. > > Out of interest, have you ruled out that the Python overhead isn't > incurred by just establishing the connection? Oracle interop can be > funny sometimes -- underlying configuration oddities can hang initial > connection attempts by a couple of minutes. > > How long does it take to establish a connection and run a dummy query? > > Trent. > > > ------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > End of python-win32 Digest, Vol 87, Issue 3 > ******************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part URL: From timr at probo.com Thu Jun 17 21:06:49 2010 From: timr at probo.com (Tim Roberts) Date: Thu, 17 Jun 2010 12:06:49 -0700 Subject: [python-win32] Parse HTML String only not file In-Reply-To: <1276798145.5063.37.camel@lnx-Mobile.tux-net.mmg> References: <1276798145.5063.37.camel@lnx-Mobile.tux-net.mmg> Message-ID: <4C1A7249.7020204@probo.com> On 6/17/2010 11:09 AM, Mauricio Martinez Garcia wrote: > Hi, how can parse an HTML String. > I need parse next Line : > > 'BSCS > statusstringnoneTopCre_lifeinteger0' That's not HTML. It's XML. You CAN parse this with the SGMLParser (since XML is a variant of SGML), but you might consider whether you would be better served using xmllib, or even xml.sax. > Result of program its: > > bash-3.1$ ./pruebasDOM.py > ['BSCS status'] > ['string'] > ['none'] > ['TopCre_life'] > ['integer'] > ['0'] > > > I can't pass the data to one dict() or []. I need all values, ['BSCS > Status', 'string', 'none', 'TopCre_life', 'integer', '0'] > > That i can do? Of course. Just change your ParserHTML class to create a list in "def __init__", then append the values that you get to the list instead of printing them. So, for example: class ParserHTML(SGMLParser): def __init__(self): SGMLParser.__init__(self) self.results = [] ... def handle_data(self, data): ... self.results.append(data) ... if __name__ == '__main__': ... p = ParserHTML() p.feed(node) print p.results -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rsyring at inteli-com.com Thu Jun 17 22:42:12 2010 From: rsyring at inteli-com.com (Randy Syring) Date: Thu, 17 Jun 2010 16:42:12 -0400 Subject: [python-win32] Parse HTML String only not file In-Reply-To: <4C1A7249.7020204@probo.com> References: <1276798145.5063.37.camel@lnx-Mobile.tux-net.mmg> <4C1A7249.7020204@probo.com> Message-ID: <4C1A88A4.90304@inteli-com.com> We have had great success with PyQuery for getting API access to XML data: http://pypi.python.org/pypi/pyquery -------------------------------------- Randy Syring Intelicom 502-644-4776 "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 Tim Roberts wrote: > On 6/17/2010 11:09 AM, Mauricio Martinez Garcia wrote: > >> Hi, how can parse an HTML String. >> I need parse next Line : >> >> 'BSCS >> statusstringnoneTopCre_lifeinteger0' >> > > That's not HTML. It's XML. You CAN parse this with the SGMLParser > (since XML is a variant of SGML), but you might consider whether you > would be better served using xmllib, or even xml.sax. > > > >> Result of program its: >> >> bash-3.1$ ./pruebasDOM.py >> ['BSCS status'] >> ['string'] >> ['none'] >> ['TopCre_life'] >> ['integer'] >> ['0'] >> >> >> I can't pass the data to one dict() or []. I need all values, ['BSCS >> Status', 'string', 'none', 'TopCre_life', 'integer', '0'] >> >> That i can do? >> > > Of course. Just change your ParserHTML class to create a list in "def > __init__", then append the values that you get to the list instead of > printing them. So, for example: > > class ParserHTML(SGMLParser): > def __init__(self): > SGMLParser.__init__(self) > self.results = [] > ... > def handle_data(self, data): > ... > self.results.append(data) > ... > if __name__ == '__main__': > ... > p = ParserHTML() > p.feed(node) > print p.results > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From morfeokmg at gmail.com Thu Jun 17 19:55:12 2010 From: morfeokmg at gmail.com (Mauricio Martinez Garcia) Date: Thu, 17 Jun 2010 12:55:12 -0500 Subject: [python-win32] Message: 4 -- Re: How can improvement time of response of Python cx_Oracle In-Reply-To: References: Message-ID: <1276797312.5063.23.camel@lnx-Mobile.tux-net.mmg> Tanks for the response. The next change modified the time of response and its more best. Old Time: 1 - 2 mins by rows New Time: 1.58548355103e-06 - 5.64257303874e-07 segs prom. This it is an example: LOG_PYTHON: Iniciando el proceso de conciliacion espere... 2010-06-05 06:19:51.180799 1--6.00020090739e-07--LOG_PYTHON: 522226163232|6416764|6416764|10|10|s| s|CPLUS015|CPLUS015|AC|0|364|0 2--6.00020090739e-07--LOG_PYTHON: 527442169944|6417057|6417057|10|10|s| s|CPLUS215|CPLUS215|AC|0|364|2.27 .... 19269--7.15255737305e-07--LOG_PYTHON: 524641251912|7841944|7841944|10| 10|s|s|CCT116|CCT116|AC|0|446.5|0 19270--5.64257303874e-07--LOG_PYTHON: 528442476903|7882244|7882244|10| 10|s|s|CCT116|CCT116|AC|0|446.5|0.64 Change the module ======================================================= def creaConexion(self,v_user, v_passwd, v_schema).... ======================================================= with the new module ======================================================= def creaConexion(self,v_user, v_passwd, v_schema): if (v_schema == "PREPAGO"): try: ds = cx_Oracle.makedsn(self.SERV_PREPAGO, self.PORT_PREPAGO, self.SID_PREPAGO) pool = cx_Oracle.SessionPool(user = v_user, password= v_passwd, dsn = ds, min=5, max=10, increment=1, connectiontype=cx_Oracle.Connection, threaded=False, getmode=cx_Oracle.SPOOL_ATTRVAL_NOWAIT, homogeneous=True ) #connection = cx_Oracle.connect(v_user, v_passwd,ds) connection = pool.acquire() return connection ======================================================= The change its an pool connection vs an cx_Oracle.connect() GREETINGS On Fri, 2010-06-04 at 12:00 +0200, python-win32-request at python.org wrote: > Send python-win32 mailing list submissions to > python-win32 at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-request at python.org > > You can reach the person managing the list at > python-win32-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > > Today's Topics: > > 1. How can improvement time of response of Python cx_Oracle > (Mauricio Martinez Garcia) > 2. python 2.5.1 and MSVC++ 2008 (Heather Kelly) > 3. Re: python 2.5.1 and MSVC++ 2008 (Trent Nelson) > 4. Re: How can improvement time of response of Python cx_Oracle > (Trent Nelson) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 03 Jun 2010 12:50:18 -0500 > From: Mauricio Martinez Garcia > To: python-win32 at python.org > Subject: [python-win32] How can improvement time of response of Python > cx_Oracle > Message-ID: <4C07EB5A.3000803 at gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi. > > This is my code for Oracle Connection with python and cx_Oracle. > > How can improvement time of response?. > > #========================================================== > > #Este metodo crea una conexion a oracle > > def creaConexion(self,v_user, v_passwd, v_schema): > > rowsSchema = v_schema.split(",") > > v_server = str(rowsSchema[0]) > > v_port = int(rowsSchema[1]) > > v_sid = str(rowsSchema[2]) > > dsn = cx_Oracle.makedsn(v_server, v_port, v_sid) > > try: > > connection = cx_Oracle.connect(v_user, v_passwd,dsn) > > return connection > > > except cx_Oracle.DatabaseError, exc: > > error, = exc.args > > print >> sys.stderr, XP_ERROR+"Oracle-Error-Code:", > error.code > > print >> sys.stderr, XP_ERROR+"Oracle-Error-Message:", > error.message > > sys.exit(1) > > > #metodo que ejecuta un query en oracle > > def ejecutaQuery(self, query, conn): > > cursor = conn.cursor() > > cursor.arraysize = 10000 > > try: > > cursor.parse(query) > > cursor.execute(query) > > cursorReturn = cursor.fetchall() > > return cursorReturn > > > except cx_Oracle.DatabaseError, exc: > > error, = exc.args > > print >> sys.stderr, XP_ERROR+"Oracle-Error-Code:", error.code > > print >> sys.stderr, XP_ERROR+"Oracle-Error-Message:", > error.message > > print query > > sys.exit(1) > > #========================================================== > > The time for an comparation of 2 DBs are many. > Python: 1 - 2 mins by rows. > Java 0.02 - 0.10 secs by rows. > > > my code for comparation > > #============================================================ > > n = 1 > > iniciaconexionBSCS = OracleConnections() > > iniciaconexionATS = OracleConnections() > > #Realizamos la conexion a oracle. > > conn = iniciaconexionBSCS.creaConexion(usrBSCS, pasBSCS, 'BSCSP') > > conn2 = iniciaconexionATS.creaConexion(usrATS, passATS, > 'ATSP') > > for rows in tuplaTotal: > > BODY_SQL_BSCS = TMPLT_BSCS % (rows.telefono) > > BODY_SQL_ATS = TMPLT_ATS % (rows.telefono) > > error_co_id = '0' > > error_ciclo = '0' > > error_pt = '0' > > error_status = '0' > > error_activacion = '0' > > error_saldo = '0' > > #print BODY_SQL_BSCS > > #print BODY_SQL_ATS > > > > ejecBSCS = iniciaconexionBSCS.ejecutaQuery(BODY_SQL_BSCS, > conn) > > ejecATS = iniciaconexionATS.ejecutaQuery(BODY_SQL_ATS, conn2) > > for rowsBSCS in ejecBSCS: > > for rowsATS in ejecATS: > > #Ejemplos de salida > > #BS (3404, 7956771, '5546037825', '10', 'a', 'CCT116') > > #AT ('7956771', '5546037825', '334010011470558', > '10', 'a', 'CCT116', 'AC', 0, 335.35000000000002, 0) > > if ((str(rowsBSCS[2]) == str(rowsATS[1])) and > ((int(rowsBSCS[1]) <> int(rowsATS[0])) or (str(rowsBSCS[3]) <> > str(rowsATS[3])) or (str(rowsBSCS[4]) <> str(rowsATS[4])) or > (str(rowsBSCS[5]) <> str(rowsATS[5])) or (str(rowsATS[6]) == 'CR') or > (rowsATS[7] < 0) or (rowsATS[8] < 0) or (rowsATS[9] < 0))): > > print 'DN Con error: '+rows.telefono > > if (int(rowsBSCS[1]) <> int(rowsATS[0])): > > error_co_id = '1' > > elif (str(rowsBSCS[3]) <> str(rowsATS[3])): > > error_ciclo = '1' > > elif (str(rowsBSCS[4]) <> str(rowsATS[4])): > > error_status = '1' > > elif (str(rowsBSCS[5]) <> str(rowsATS[5])): > > error_pt = '1' > > elif (str(rowsATS[6]) == 'CR'): > > error_activacion = '1' > > elif ((rowsATS[7] < 0) or (rowsATS[8] < 0) or > (rowsATS[9] < 0)): > > error_saldo = '1' > > DNIncorrecto = > str(rowsATS[1])+"|"+str(rowsBSCS[1])+"|"+str(rowsATS[0])+"|"+str(rowsBSCS[3])+"|"+str(rowsATS[3])+"|"+str(rowsBSCS[4])+"|"+str(rowsATS[4])+"|"+str(rowsBSCS[5])+"|"+str(rowsATS[5])+"|"+str(rowsATS[6])+"|"+str(rowsATS[7])+"|"+str(rowsATS[8])+"|"+str(rowsATS[9])+"|"+error_co_id+"|"+error_ciclo+"|"+error_status+"|"+error_pt+"|"+error_activacion+"|"+error_saldo+"|"+error_co_id+error_ciclo+error_status+error_pt+error_activacion+error_saldo > > print str(n)+"--"+XP_LOG+DNIncorrecto > > #n = n + 1 > > else: > > DNCorrecto = > str(rowsATS[1])+"|"+str(rowsBSCS[1])+"|"+str(rowsATS[0])+"|"+str(rowsBSCS[3])+"|"+str(rowsATS[3])+"|"+str(rowsBSCS[4])+"|"+str(rowsATS[4])+"|"+str(rowsBSCS[5])+"|"+str(rowsATS[5])+"|"+str(rowsATS[6])+"|"+str(rowsATS[7])+"|"+str(rowsATS[8])+"|"+str(rowsATS[9]) > > print str(n)+"--"+XP_LOG+DNCorrecto > > #n = n + 1 > > > #print str(n), rows.telefono > > n = n + 1 > > iniciaconexionBSCS.cierraConexion(conn) > > iniciaconexionATS.cierraConexion(conn2) > > > #============================================================ > > I need improvement the time of response of 1 - 2 minutes to 0.02 - > 0.10 secs. How can this?. > > GREETINGS. > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJMB+tZAAoJEFWGNhWbCcUY5vIP/AlE7nTFzX+HkLPq3Lj6yj9s > 6yFYRIlcJwX+QEa0PGPXDcJ/nJw5uqLNsKZW2v7R5zmeDmX7BSUx0nO57xju/sEB > PnRBYrqXBKd1GvJU46SUJi2ahQx7y37ctzjU9l2sdZ/74JrSWiW1L3Ip4DJnlohR > hgmS6PfTx4IvHb26Pn8Sxa5UGmL0OGVrW7b/U9BI+IAXjkXMnrmVQKbaInBIrE3m > ZGCwsySTjfSKEhH9ybOVhk4CZHkeRY2wKNv4YZ98++sSkrCFMhdnoPM0fMAsAEN2 > sgQhZ9ziNCtpiyGmtL/QVkxeQhwNwpnixrkXf96FfzeVLESwf2117m3RcTntLWKC > ixvOOHV2gCF6YCf5UKucQEq8V/D1UgPliPU4pacBvq/5/Xq3zoJxOWxnHRZRiUtA > /UgGnhn+7vHvhiYTXJtJrI95i6YyR7mud0ZuWcc7pYGZ6kJ1toIZIgqeLxvK33u0 > OrQUOf0n6j+JWS9DiJRrIMhhRPr8IX5pjGg6GfqfcQBKUcJuJnLzev57GFTQHcCl > S18lkASTykWV3SPdAc6mmAf2Pv/B2X8CFZk9Oc9kgnqYUVFyikCY4GRv7GCnMucQ > 1yYoWT5nz/N9+6SeLkGGhS9nxWL/OJlepYR66shJR4J/1K1Qp5BERhOtLMX5f2kK > L8MNhHxT1IictTauhp0D > =wckT > -----END PGP SIGNATURE----- > > > > ------------------------------ > > Message: 2 > Date: Thu, 03 Jun 2010 14:14:15 -0400 > From: Heather Kelly > To: python-win32 at python.org > Subject: [python-win32] python 2.5.1 and MSVC++ 2008 > Message-ID: <4c07f0fd.e22be50a.1dc5.17b7 at mx.google.com> > Content-Type: text/plain; charset="us-ascii"; format=flowed > > Hi, > > I work on a project that still supports 2.5.1 for now (we plan to > upgrade to 2.6 in the near future). In the meantime, we are moving > to MSVC++ 2008 from MSVC++ 2003. Up to now, we have been using the > binary distribution of python, but I believe to support MSVC++ 2008, > we now must build python 2.5.1 ourselves. Actually, I've already > built python itself, but I have run into trouble trying to build > tcl/tk 8.4, which comes with support for MSVC++ 6. > > now for my questions.. am I wrong that I need to rebuilt python > 2.5.1 to fully support our MSVC++ users who only have MSVC++ 2008 on > their systems? Could I just provide them a couple specific MSVC++ > 2003 libraries and they'll be fine? > > Has anyone else managed to build the tcl/tk with MSVC++ 2008? > > Would these troubles disappear if we just upgrade to python 2.6 now? > > Are there any web pages out there that discuss building python and > its associated components from scratch? > > Thanks, > Heather > > > > ------------------------------ > > Message: 3 > Date: Thu, 3 Jun 2010 15:13:46 -0400 > From: Trent Nelson > To: > Subject: Re: [python-win32] python 2.5.1 and MSVC++ 2008 > Message-ID: <4C07FEEA.2040900 at snakebite.org> > Content-Type: text/plain; charset="ISO-8859-1"; format=flowed > > On 6/3/2010 2:14 PM, Heather Kelly wrote: > > Hi, > > > > I work on a project that still supports 2.5.1 for now (we plan to > > upgrade to 2.6 in the near future). In the meantime, we are moving > > to MSVC++ 2008 from MSVC++ 2003. Up to now, we have been using the > > binary distribution of python, but I believe to support MSVC++ 2008, > > we now must build python 2.5.1 ourselves. Actually, I've already > > built python itself, but I have run into trouble trying to build > > tcl/tk 8.4, which comes with support for MSVC++ 6. > > > > now for my questions.. am I wrong that I need to rebuilt python > > 2.5.1 to fully support our MSVC++ users who only have MSVC++ 2008 on > > their systems? Could I just provide them a couple specific MSVC++ > > 2003 libraries and they'll be fine? > > > > Has anyone else managed to build the tcl/tk with MSVC++ 2008? > > > > Would these troubles disappear if we just upgrade to python 2.6 now? > > I'd highly recommend taking that approach. The compiler toolchain > doesn't change for a m.n release (i.e. 2.5.x, 2.6.x). If your strongest > requirement is MSVC++ 2008 support, I'd go with 2.6. > > > Are there any web pages out there that discuss building python and > > its associated components from scratch? > > The buildbots are a good place to start: > http://svn.python.org/projects/python/branches/release26-maint/Tools/buildbot/ > > The external*.bat scripts in that directory take care of building all > the external dependencies, like Tcl/Tk. (And from that, you'll be able > to see where we grab Tcl/Tk from (svn.python.org/contrib), and all the > fiddling we had to do to get that building properly with a non-vc6 > toolchain). > > Trent. > > > ------------------------------ > > Message: 4 > Date: Thu, 3 Jun 2010 15:16:50 -0400 > From: Trent Nelson > To: > Subject: Re: [python-win32] How can improvement time of response of > Python cx_Oracle > Message-ID: <4C07FFA2.4000701 at snakebite.org> > Content-Type: text/plain; charset="ISO-8859-1"; format=flowed > > On 6/3/2010 1:50 PM, Mauricio Martinez Garcia wrote: > > The time for an comparation of 2 DBs are many. > > Python: 1 - 2 mins by rows. > > Java 0.02 - 0.10 secs by rows. > > > I need improvement the time of response of 1 - 2 minutes to 0.02 - > > 0.10 secs. How can this?. > > Out of interest, have you ruled out that the Python overhead isn't > incurred by just establishing the connection? Oracle interop can be > funny sometimes -- underlying configuration oddities can hang initial > connection attempts by a couple of minutes. > > How long does it take to establish a connection and run a dummy query? > > Trent. > > > ------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > End of python-win32 Digest, Vol 87, Issue 3 > ******************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part URL: From dhovart at gmail.com Fri Jun 18 19:05:55 2010 From: dhovart at gmail.com (Denis) Date: Fri, 18 Jun 2010 19:05:55 +0200 Subject: [python-win32] Using win32serviceutil.InstallService() on a non admin account Message-ID: Hi, I'm creating an application that needs to run CherryPy as a background service. It currently works fine in Linux and Mac OS X, but I'm a bit struggling to make the windows version as I'm new to win development. My code is a barely modified version of what can be found here : http://tools.cherrypy.org/wiki/WindowsService I've compiled it using py2exe and can run it without any problem logged as an administrator. The thing is that when I try to install the service on a default user account, I get an error 5 ? "Access is denied" from OpenSCManager. C:\cherrypy_service\cherrypy_service.exe -install Traceback (most recent call last): File "boot_service.py", line 158 in File "win32serviceutil.pyo", line 156, in InstallService pywintypes.error: (5, ?OpenSCManager?, ?Access is denied.?) I've tried to install it with "sc create cherryPyService binPath=C:\cherrypy_service\cherrypy_service.exe", even with specifying the username and password, but the result is the same : [SC] OpenSCManager FAILED 5: Access is denied. What is the correct way to install a service for a non-admin account on windows ? Since I'd also like to create an installer for my app (I need to append a new entry in the %SystemRoot%\system32\drivers\etc\hosts file), I guess that I could install my service in the same time using admin privileges. Would that be possible ? What tool would you recommand for this ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhovart at gmail.com Sat Jun 19 00:52:50 2010 From: dhovart at gmail.com (Denis) Date: Sat, 19 Jun 2010 00:52:50 +0200 Subject: [python-win32] Using win32serviceutil.InstallService() on a non admin account In-Reply-To: References: Message-ID: After some searches I've found a possible way to accomplish what I want using two executables provided as part of the Microsotf 2003 Resource Kits, namely Instsrv and Srvany (heck, windows utilities have wonderful names). Here is a tutorial to setup Trac as standalone using them : http://trac.edgewall.org/wiki/TracOnWindowsStandalone I could include them in my installer to make it follow the same procedure. I'm going to try this approach - just tell me if there's an other and more adapted way to proceed : windows development is unkown territory to me. Thanks in advance, Denis. On Fri, Jun 18, 2010 at 7:05 PM, Denis Hovart wrote: > Hi, > I'm creating an application that needs to run CherryPy as a background > service. > It currently works fine in Linux and Mac OS X, but I'm a bit struggling to > make the windows version as I'm new to win development. > > My code is a barely modified version of what can be found here : > http://tools.cherrypy.org/wiki/WindowsService > I've compiled it using py2exe and can run it without any problem logged as > an administrator. > The thing is that when I try to install the service on a default user > account, I get an error 5 ? "Access is denied" from OpenSCManager. > > C:\cherrypy_service\cherrypy_service.exe -install > Traceback (most recent call last): > File "boot_service.py", line 158 in > File "win32serviceutil.pyo", line 156, in InstallService > pywintypes.error: (5, ?OpenSCManager?, ?Access is denied.?) > > I've tried to install it with "sc create cherryPyService > binPath=C:\cherrypy_service\cherrypy_service.exe", even with specifying the > username and password, but the result is the same : > > [SC] OpenSCManager FAILED 5: > Access is denied. > > What is the correct way to install a service for a non-admin account on > windows ? > > Since I'd also like to create an installer for my app (I need to append a > new entry in the %SystemRoot%\system32\drivers\etc\hosts file), I guess that > I could install my service in the same time using admin privileges. Would > that be possible ? What tool would you recommand for this ? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhovart at gmail.com Sat Jun 19 01:20:40 2010 From: dhovart at gmail.com (Denis) Date: Sat, 19 Jun 2010 01:20:40 +0200 Subject: [python-win32] Using win32serviceutil.InstallService() on a non admin account In-Reply-To: References: Message-ID: Erm. Forget everything I wrote. The error messages were actually pretty clear. I was experimenting with an account on which I just can't install anything *at all*. There's no problem with win32util.InstallService(), that was just me being stupid. So excuse the useless noise :-) On Sat, Jun 19, 2010 at 12:52 AM, Denis wrote: > After some searches I've found a possible way to accomplish what I want > using two executables provided as part of the Microsotf 2003 Resource Kits, > namely Instsrv and Srvany (heck, windows utilities have wonderful names). > > Here is a tutorial to setup Trac as standalone using them : > http://trac.edgewall.org/wiki/TracOnWindowsStandalone > I could include them in my installer to make it follow the same procedure. > > I'm going to try this approach - just tell me if there's an other and more > adapted way to proceed : windows development is unkown territory to me. > > Thanks in advance, > > Denis. > > > On Fri, Jun 18, 2010 at 7:05 PM, Denis Hovart wrote: > >> Hi, >> I'm creating an application that needs to run CherryPy as a background >> service. >> It currently works fine in Linux and Mac OS X, but I'm a bit struggling to >> make the windows version as I'm new to win development. >> >> My code is a barely modified version of what can be found here : >> http://tools.cherrypy.org/wiki/WindowsService >> I've compiled it using py2exe and can run it without any problem logged as >> an administrator. >> The thing is that when I try to install the service on a default user >> account, I get an error 5 ? "Access is denied" from OpenSCManager. >> >> C:\cherrypy_service\cherrypy_service.exe -install >> Traceback (most recent call last): >> File "boot_service.py", line 158 in >> File "win32serviceutil.pyo", line 156, in InstallService >> pywintypes.error: (5, ?OpenSCManager?, ?Access is denied.?) >> >> I've tried to install it with "sc create cherryPyService >> binPath=C:\cherrypy_service\cherrypy_service.exe", even with specifying the >> username and password, but the result is the same : >> >> [SC] OpenSCManager FAILED 5: >> Access is denied. >> >> What is the correct way to install a service for a non-admin account on >> windows ? >> >> Since I'd also like to create an installer for my app (I need to append a >> new entry in the %SystemRoot%\system32\drivers\etc\hosts file), I guess that >> I could install my service in the same time using admin privileges. Would >> that be possible ? What tool would you recommand for this ? >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wjm251 at gmail.com Tue Jun 22 16:59:43 2010 From: wjm251 at gmail.com (=?UTF-8?B?5bCP5piO5ZCM5a2m?=) Date: Tue, 22 Jun 2010 22:59:43 +0800 Subject: [python-win32] why word hang and the taskmanager auto statup? Message-ID: hi all: I use python win32com to process word document.but the call to wordapp.Save() or do other com invoke, this invoke will hang occasionally. (may be the user also open another word document to edit at the same time manually ,is it relates to?) and sometimes the taskmanager auto statup,and it will statup again soon if you close the taskmanager window.(using processexplorer tool to examine,the taskmgr.exe process was hung below the winword.exe,that looks like it was generated by word process) how can these happen ,can you help me? I using office 2003 in Windows XP thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwupole at msn.com Tue Jun 22 21:16:18 2010 From: rwupole at msn.com (Roger Upole) Date: Tue, 22 Jun 2010 15:16:18 -0400 Subject: [python-win32] unable to read mssql varchar(max) Message-ID: Vernon Cole wrote: >I ran into the same problem using adodbapi. I tracked it down to the COM > call which errored out, and decided that maybe it was a Microsoft problem > and ignored it, just leaving the application broken on that feature. If > pyODBC can do it, then the problem must be in the COM routines in pywin32. > I can throw together a quick example of the failure if that will help > with > debugging. It involves a sample SQL data table that must be imported for > the > test and is not small (several recorded telephone calls as blobs)-- so I > will only do it if needed. Does anyone (Mark?) need it? > -- I think I spotted a problem with the buffer resizing logic in the odbc module. Can you send me your table layout so I can verify it's fixed for your case ? Regarding adodbapi, it seems to use the DefinedSize property unconditionally, but this property won't be present for columns without a size limit. Roger From adam.pletcher at gmail.com Tue Jun 22 23:22:26 2010 From: adam.pletcher at gmail.com (Adam Pletcher) Date: Tue, 22 Jun 2010 16:22:26 -0500 Subject: [python-win32] Registering 64-bit Shell Extension using 32-bit Python Message-ID: I have Python 2.6.2 (32-bit) and pywin32 212, on Vista 64. Using the ?context_menu? sample script as reference, I made a script that registers a shell extension, adding a couple right-click commands to 32-bit Explorer. I now need to register it for use in 64-bit Explorer, but can?t seem to work it out (short of manually adding keys in regedit). I actually have the ContextMenuHandlers registry keys in both 32 and 64 hives, it?s the CLSID entry in the 64 hive that appears to be the missing piece. Basically whatever RegisterClasses does? Is there an example somewhere showing how to register a shell extension for 64-bit Explorer when running 32-bit Python? I haven?t been able to turn one up in my searching. - Adam From timr at probo.com Wed Jun 23 00:20:20 2010 From: timr at probo.com (Tim Roberts) Date: Tue, 22 Jun 2010 15:20:20 -0700 Subject: [python-win32] Registering 64-bit Shell Extension using 32-bit Python In-Reply-To: References: Message-ID: <4C213724.3040204@probo.com> Adam Pletcher wrote: > I have Python 2.6.2 (32-bit) and pywin32 212, on Vista 64. > > Using the ?context_menu? sample script as reference, I made a script > that registers a shell extension, adding a couple right-click commands > to 32-bit Explorer. I now need to register it for use in 64-bit > Explorer, but can?t seem to work it out (short of manually adding keys > in regedit). I actually have the ContextMenuHandlers registry keys in > both 32 and 64 hives, it?s the CLSID entry in the 64 hive that appears > to be the missing piece. Basically whatever RegisterClasses does? > > Is there an example somewhere showing how to register a shell > extension for 64-bit Explorer when running 32-bit Python? I haven?t > been able to turn one up in my searching. > Do you actually have a 64-bit build of your extension DLL? You can't load a 32-bit DLL into a 64-bit process. There is an API to turn off the file system redirection (which makes all of your 32-bit process's requests for System32 instead go to SysWow64), but I'm not aware of an API to turn off the registry redirection. You need to specify KEY_WOW64_64KEY in the permission field of RegOpenKeyEx to access the 64-bit hive from a 32-bit application. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From adam.pletcher at gmail.com Wed Jun 23 04:40:53 2010 From: adam.pletcher at gmail.com (Adam Pletcher) Date: Tue, 22 Jun 2010 21:40:53 -0500 Subject: [python-win32] Registering 64-bit Shell Extension using 32-bit Python Message-ID: Sorry, I should have included more info. I'm not registering a DLL, at least not directly. The extension I'm registering is a class in a Python script, much like the "context_menu.py" example. I was under the impression that it gets registered to run via pythonw.exe when the context menu command is used, and wouldn't have the 32/64-bit DLL issue. I could definitely be mistaken. I took a closer look at the registry entries created by registering it for 32-bit Explorer. It has a CLSID registry key called InprocServer32 with a value of "pythoncom26.dll". Suggesting I need to use the 64-bit build of that DLL, perhaps? On the other hand, it also has a LocalServer32 entry with a value of: C:\Python26\pythonw.exe "C:\Python26\lib\site-packages\win32com\server\localserver.py" {d6d38fd0-77fb-11df-93f2-0800200c9a66} I've looked through the python code for win32com.server.register.RegisterServer, and it appears as if I may need to use Python x64 + pywin32 x64 if I want to add a Python-based contextmenu for Explorer x64. But I'd be very happy to learn how to register it on Exp64 using the 32-bit stuff... Thanks. - Adam > -----Original Message----- > From: python-win32-bounces+adam=volition-inc.com at python.org > [mailto:python-win32-bounces+adam=volition-inc.com at python.org] On > Behalf Of Tim Roberts > Sent: Tuesday, June 22, 2010 5:20 PM > To: Python-Win32 List > Subject: Re: [python-win32] Registering 64-bit Shell Extension using > 32-bit Python > > Adam Pletcher wrote: > > I have Python 2.6.2 (32-bit) and pywin32 212, on Vista 64. > > > > Using the ?context_menu? sample script as reference, I made a script > > that registers a shell extension, adding a couple right-click > commands > > to 32-bit Explorer. I now need to register it for use in 64-bit > > Explorer, but can?t seem to work it out (short of manually adding > keys > > in regedit). I actually have the ContextMenuHandlers registry keys > in > > both 32 and 64 hives, it?s the CLSID entry in the 64 hive that > appears > > to be the missing piece. Basically whatever RegisterClasses does? > > > > Is there an example somewhere showing how to register a shell > > extension for 64-bit Explorer when running 32-bit Python? I haven?t > > been able to turn one up in my searching. > > > > Do you actually have a 64-bit build of your extension DLL? You can't > load a 32-bit DLL into a 64-bit process. > > There is an API to turn off the file system redirection (which makes > all > of your 32-bit process's requests for System32 instead go to SysWow64), > but I'm not aware of an API to turn off the registry redirection. You > need to specify KEY_WOW64_64KEY in the permission field of RegOpenKeyEx > to access the 64-bit hive from a 32-bit 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 axel at esperanto-jeunes.org Wed Jun 23 10:20:00 2010 From: axel at esperanto-jeunes.org (Axel Rousseau) Date: Wed, 23 Jun 2010 10:20:00 +0200 Subject: [python-win32] how to disable word macro ? Message-ID: Hi, I write a python script. This script open word document, print them and close them. But in some of this documents, there is "auto-close" macro. This macro is launched when the document is closed. How can I disable this macro (or all macro) ? Can I parameter word to never run macros ? Can I delete the macro (I don't save the document, so it's not a problem) ? Thank you for your help, Axel -------------- next part -------------- An HTML attachment was scrubbed... URL: From RDahlstrom at directedge.com Wed Jun 23 14:03:24 2010 From: RDahlstrom at directedge.com (Dahlstrom, Roger) Date: Wed, 23 Jun 2010 08:03:24 -0400 Subject: [python-win32] how to disable word macro ? In-Reply-To: References: Message-ID: <78C91C6FD63DD04BB8812EE9288C1E8125BF5B9990@EXCHANGE01.office.directedge.net> What version of Word? From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Axel Rousseau Sent: Wednesday, June 23, 2010 4:20 AM To: python-win32 at python.org Subject: [python-win32] how to disable word macro ? Hi, I write a python script. This script open word document, print them and close them. But in some of this documents, there is "auto-close" macro. This macro is launched when the document is closed. How can I disable this macro (or all macro) ? Can I parameter word to never run macros ? Can I delete the macro (I don't save the document, so it's not a problem) ? Thank you for your help, Axel ________________________________ DISCLAIMER: This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. Direct Edge may, at its discretion, monitor and review the content of all e-mail communications. -------------- next part -------------- An HTML attachment was scrubbed... URL: From axel at esperanto-jeunes.org Wed Jun 23 16:41:35 2010 From: axel at esperanto-jeunes.org (Axel Rousseau) Date: Wed, 23 Jun 2010 16:41:35 +0200 Subject: [python-win32] how to disable word macro ? In-Reply-To: <78C91C6FD63DD04BB8812EE9288C1E8125BF5B9990@EXCHANGE01.office.directedge.net> References: <78C91C6FD63DD04BB8812EE9288C1E8125BF5B9990@EXCHANGE01.office.directedge.net> Message-ID: Word 2007 2010/6/23 Dahlstrom, Roger > What version of Word? > > > > *From:* python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto: > python-win32-bounces+rdahlstrom = > directedge.com at python.org] *On Behalf Of *Axel Rousseau > *Sent:* Wednesday, June 23, 2010 4:20 AM > *To:* python-win32 at python.org > *Subject:* [python-win32] how to disable word macro ? > > > > Hi, > I write a python script. This script open word document, print them and > close them. But in some of this documents, there is "auto-close" macro. This > macro is launched when the document is closed. > > How can I disable this macro (or all macro) ? Can I parameter word to never > run macros ? Can I delete the macro (I don't save the document, so it's not > a problem) ? > > Thank you for your help, > > Axel > > ------------------------------ > DISCLAIMER: > This e-mail, and any attachments thereto, is intended only for use by the > addressee(s) named herein and may contain legally privileged and/or > confidential information. If you are not the intended recipient of this > e-mail, you are hereby notified that any dissemination, distribution or > copying of this e-mail is prohibited. If you have received this in error, > please immediately notify me and permanently delete the original and any > copy of any e-mail and any printout thereof. The sender therefore does not > accept liability for any errors or omissions in the contents of this message > which arise as a result of e-mail transmission. Direct Edge may, at its > discretion, monitor and review the content of all e-mail communications. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sacaquija at hotmail.com Wed Jun 23 22:29:43 2010 From: sacaquija at hotmail.com (=?iso-8859-1?B?Sm9z6SBCZW5pdG8gQ2FtafFhIFByYWRv?=) Date: Wed, 23 Jun 2010 15:29:43 -0500 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <4C180366.1060602@probo.com> References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, , <147689968912.20100614231456@columbus.rr.com>, , <4C17AC48.7020406@probo.com>, , <4C180366.1060602@probo.com> Message-ID: Hi again and thanks for your answers, now a friend helped me and I have a program in C# using the Filemon that you recommended me and it prints the paths, but you know if there is a way to have a kind of communication between C# and Python, what I want is that the C# programs send directly the paths being access to a program made in python that is resident. Thanks in advance! Jos? Cami?a > Date: Tue, 15 Jun 2010 15:49:10 -0700 > From: timr at probo.com > To: python-win32 at python.org > Subject: Re: [python-win32] Python Hooks Navigation Logger Windows > > On 6/15/2010 3:33 PM, Jos? Benito Cami?a Prado wrote: > > Jos? Cami?a (sacaquija): > > May be I can use that but I need communication with python too, what I mean is that > > the program, for example the Filemon send messages to a resident program, so it?s good > > to write in a file but I need also to send the new logs to python in real time. > > > > If you are not able to leverage something like Filemon, then you have to > create a file system filter driver. If you don't have kernel > experience, it will take you more than 6 months to create such a thing. > > Also, you need to remember that there are an ENORMOUS number of file > system manipulations going on in the typical Windows system. Have you > ever looked at the output of Filemon? Most people are astonished by the > number of file accesses and file reads and directory reads and existence > tests that get done. Just starting up a relatively simple application > can cause THOUSANDS of file and directory accesses, as it searches > through its path for each and every DLL. If your system is busy, Python > won't be able to keep up. > > Roger Dahlstrom wrote: > >You could tail the log file... > > Another good suggestion... > > -- > 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 _________________________________________________________________ Prefiero un d?a sin coche que sin Messenger www.vivirmessenger.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Jun 23 22:48:16 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 23 Jun 2010 13:48:16 -0700 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, , <147689968912.20100614231456@columbus.rr.com>, , <4C17AC48.7020406@probo.com>, , <4C180366.1060602@probo.com> Message-ID: <4C227310.3010504@probo.com> Jos? Benito Cami?a Prado wrote: > > Hi again and thanks for your answers, now a friend helped me and I > have a program in C# using the Filemon that you recommended me and it > prints the paths, but you know if there is a way to have a kind of > communication between C# and Python, what I want is that the C# > programs send directly the paths being access to a program made in > python that is resident. > That's the wrong path. Whatever you can do in C# can also be done in Python. You should probably port the C# code, rather than trying to use both. On the other hand, if it's working in C#, I'm not sure why you would want to change it. Just extend the C# code to do what you need. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From sacaquija at hotmail.com Thu Jun 24 03:41:02 2010 From: sacaquija at hotmail.com (=?iso-8859-1?B?Sm9z6SBCZW5pdG8gQ2FtafFhIFByYWRv?=) Date: Wed, 23 Jun 2010 20:41:02 -0500 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: <4C227310.3010504@probo.com> References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, ,,<147689968912.20100614231456@columbus.rr.com>, , , <4C17AC48.7020406@probo.com>, , , , <4C180366.1060602@probo.com>, , <4C227310.3010504@probo.com> Message-ID: The thing is that in C# there is a EasyHook, that let?s you to make a program like filemon that doesn't exists in python, I?m not good at programming in C# I have never used it, and i have some expirience using python thats why I want to use Python. > Date: Wed, 23 Jun 2010 13:48:16 -0700 > From: timr at probo.com > To: python-win32 at python.org > Subject: Re: [python-win32] Python Hooks Navigation Logger Windows > > Jos? Benito Cami?a Prado wrote: > > > > Hi again and thanks for your answers, now a friend helped me and I > > have a program in C# using the Filemon that you recommended me and it > > prints the paths, but you know if there is a way to have a kind of > > communication between C# and Python, what I want is that the C# > > programs send directly the paths being access to a program made in > > python that is resident. > > > > That's the wrong path. Whatever you can do in C# can also be done in > Python. You should probably port the C# code, rather than trying to use > both. > > On the other hand, if it's working in C#, I'm not sure why you would > want to change it. Just extend the C# code to do what you need. > > -- > 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 _________________________________________________________________ ?Qu? signigica Messenger para ti? www.vivirmessenger.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jun 24 03:54:43 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 23 Jun 2010 18:54:43 -0700 Subject: [python-win32] Python Hooks Navigation Logger Windows In-Reply-To: References: <28838190.post@talk.nabble.com> <4C166AAE.9000504@probo.com>, , , <147689968912.20100614231456@columbus.rr.com>, , , <4C17AC48.7020406@probo.com>, , , , <4C180366.1060602@probo.com>, , <4C227310.3010504@probo.com> Message-ID: <4C22BAE3.8090600@probo.com> Jos? Benito Cami?a Prado wrote: > The thing is that in C# there is a EasyHook, that let?s you to make a > program like filemon that doesn't exists in python, I?m not good at > programming in C# I have never used it, and i have some expirience > using python thats why I want to use Python. EasyHook is just a DLL. It can be called from Python. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From adam.pletcher at volition-inc.com Tue Jun 22 21:34:37 2010 From: adam.pletcher at volition-inc.com (Adam Pletcher) Date: Tue, 22 Jun 2010 12:34:37 -0700 Subject: [python-win32] Registering 64-bit Shell Extension using 32-bit Python Message-ID: <0106AB904DD7F14EA8FD51A6DA57C304B6B79A83@PHXXMBC01.thqinc.com> I have Python 2.6.2 (32-bit) and pywin32 212, on Vista 64. Using the "context_menu" sample script as reference, I made a script that registers a shell extension, adding a couple right-click commands to 32-bit Explorer. I now need to register it for use in 64-bit Explorer, but can't seem to work it out (short of manually adding keys in regedit). I actually have the ContextMenuHandlers registry keys in both 32 and 64 hives, it's the CLSID entry in the 64 hive that appears to be the missing piece. Basically whatever RegisterClasses does? Is there an example somewhere showing how to register a shell extension for 64-bit Explorer when running 32-bit Python? I haven't been able to turn one up in my searching. - Adam ________________________________ This message, including any attachments, may contain privileged and/or confidential information. Any distribution or use of this email by anyone other than the intended recipient(s) is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and delete all copies. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.sudwarts at gmail.com Thu Jun 24 16:43:26 2010 From: robert.sudwarts at gmail.com (Robert Sudwarts) Date: Thu, 24 Jun 2010 15:43:26 +0100 Subject: [python-win32] Python script jumps back to 'main' in long running win32 event Message-ID: Hi, I'm hoping that someone can help with this... I've seen some old posts which I think may refer to this same issue but I'm having difficulty understanding how to come up with a solution, and particularly where any "PumpWaitingMessages" should be located and/or/how/whether pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) should be used. The code processes data for 25/30 messages received back from the com object but then seems to jump back to the 'if __name__ == '__main__' and passes that same parameter (originally passed from the command line) and runs all over again... The process is intended to: 1. pass a parameter from the command line 2. open a [pickle] file to store the data 3. call a COM object with Dispatch events (to an EventHandler) 4. for each block of data received back into the EventHandler, drop it into the pickle 5. close the pickle file I'd be immensely grateful for any assistance you can give. Rob Essentially the skeleton code I have (and I hope it's intelligible) is as follows: if __name__ == '__main__': arg = sys.argv[1:] proc(arg[0]) def proc(arg): fh = file("thispickle.pkl", 'wb') x = Async(arg) # see below fh.close() [in a seperate module I have the following construct for the Dispatch] class EventHandler: def onData(self, event): # do stuff with data in 'event' cPickle.dump(data, self.fh) # flag this as 'done' class Async: def __init__(self, params): #pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) # should this go here?? s = win32com.client.DispatchWithEvents('com_obj' , EventHandler) self.finished = False while not self.finished: PumpWaitingMessages() if messages_all_flagged: self.finished = True -------------- next part -------------- An HTML attachment was scrubbed... URL: From elrond79 at gmail.com Fri Jun 25 03:02:03 2010 From: elrond79 at gmail.com (Paul Molodowitch) Date: Thu, 24 Jun 2010 18:02:03 -0700 Subject: [python-win32] Using Properties with arugments (or optional arguments) Message-ID: Hi all - I was wondering what the proper way to access properties on COM objects which take arguments (or optional arguments). As an example, it's easy to get a 'System' WshEnvironment object: shell = win32com.client.Dispatch("WScript.Shell") sysEnv = shell.Environment print sysEnv['PATH'] However, I can find no way to get a 'Volatile' environment object, since the User/System/Volatile/Process argument for the Environment property is optional. How would I do this? - Paul From davea at ieee.org Fri Jun 25 15:24:52 2010 From: davea at ieee.org (Dave Angel) Date: Fri, 25 Jun 2010 09:24:52 -0400 Subject: [python-win32] Python script jumps back to 'main' in long running win32 event In-Reply-To: References: Message-ID: <4C24AE24.9030203@ieee.org> Robert Sudwarts wrote: > Hi, > > I'm hoping that someone can help with this... I've seen some old posts which > I think may refer to this same issue but I'm having difficulty understanding > how to come up with a solution, and particularly where any > "PumpWaitingMessages" should be located and/or/how/whether > pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) should be used. > > The code processes data for 25/30 messages received back from the com object > but then seems to jump back to the 'if __name__ == '__main__' and passes > that same parameter (originally passed from the command line) and runs all > over again... > > Stab in the dark here: Are you perhaps importing your original script as a module someplace? If you have recursive imports, you can actually see two instances of the same module, which can lead to the kind of behavior you're describing. If your main script is called main.py, then search for any reference to main in another source file, in a line such as import main or from main import fh or some such. DaveA From varun at aryaka.com Tue Jun 29 12:49:00 2010 From: varun at aryaka.com (Varun Avashia) Date: Tue, 29 Jun 2010 10:49:00 +0000 Subject: [python-win32] Enable/disable Remote Desktop via Python In-Reply-To: References: Message-ID: How about this one? I don't work on win7 but this might help... http://blogs.techrepublic.com.com/itdojo/?p=1864&tag=nl.e101 -----Original Message----- From: python-win32-bounces+varun.avashia=aryaka.com at python.org [mailto:python-win32-bounces+varun.avashia=aryaka.com at python.org] On Behalf Of Tony Cappellini Sent: Tuesday, May 18, 2010 7:26 PM To: python-win32 at python.org Subject: Re: [python-win32] Enable/disable Remote Desktop via Python Message: 4 Date: Tue, 18 May 2010 10:19:28 +1000 From: Mark Hammond Cc: Python-Win32 List Subject: Re: [python-win32] Enable/disable Remote Desktop via Python Message-ID: <4BF1DD10.2020502 at gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >>Or even if you do manage to do this without stopping the service and >>immediately losing your connection, what happens when the network drops >>out etc and you lose your existing connection without the opportunity of >>re-enabling future remote connections? Then I'll walk over to the machine and re-enable it myself. I've been toggling the checkbox in Control Panel manually ever since I knew RD existed, and it has never terminated the connection I was using at the time.Perhaps certain configurations might cuase that, but I don't know what those would be. It's just not convenient to not be able to do this with a batchfile, or shortcut _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 * * * This message and any attachments are confidential and may also be legally privileged. If you are not the intended recipient, please notify the sender immediately. You must not copy this message or use it for any purpose nor publish or disclose its contents to any other person- Aryaka IT * * *