From rupole at hotmail.com Wed Nov 5 21:37:51 2014 From: rupole at hotmail.com (Roger Upole) Date: Wed, 5 Nov 2014 15:37:51 -0500 Subject: [python-win32] Error R6034 when I import uuid In-Reply-To: References: Message-ID: This appears to be due to way rpcrt4.dll is loaded by ctypes. If a side-by-side assembly has already loaded a version that?s not compatible with the activation context of Python itself, ctypes will attempt to use it anyway. Roger "Blair Hall" wrote in message news:CAJeTVArsN8Vp_e6cnF3yUf6cUC4uHUJ6ggmsKUeDCzcKA_=uKw at mail.gmail.com... I have a small python COM server that worked fine with Excel until I decided to import the standard Python 'uuid' module. Now I get the Windows Runtime error R6034 "An application has made an attempt to load the C runtime library incorrectly" I there anything that I can do to fix this? -------------------------------------------------------------------------------- _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jure.Erznoznik at perftech.si Wed Nov 12 15:32:18 2014 From: Jure.Erznoznik at perftech.si (=?iso-8859-2?Q?Jure_Erzno=BEnik?=) Date: Wed, 12 Nov 2014 14:32:18 +0000 Subject: [python-win32] adodbapi transaction counter Message-ID: I just installed this on Python 2.7 and immediately ran into a possible bug: When connection.rollback() is called, a new transaction wasn't immediately started. I traced the bug to line 382 in adodbapi.py where transaction_level is checked against 0. However, the COM routine called a bit above this line actually returns None as current level. Adding the check for None solves the issue: adodbapi.py def _rollback(self): # original statement didn't check for None if self.transaction_level == 0 or self.transaction_level is None: # line 382 Is it possible to add this to project source / PyPI? LP, Jure -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Thu Nov 13 22:35:52 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Thu, 13 Nov 2014 14:35:52 -0700 Subject: [python-win32] adodbapi transaction counter In-Reply-To: References: Message-ID: On Wed, Nov 12, 2014 at 7:32 AM, Jure Erzno?nik wrote: > if self.transaction_level == 0 *or self.transaction_level is None* > Rats! That's what I get for copying code that I don't really understand. My simple tests passed this as okay. I have changed the test to "if not self.transaction_level:" in order to fix the bug and avoid the "or" operation at the same time. That's pretty obscure, so I use your version as the comment. This bug fix will define version 2.6.1.2 -- to be pushed to pypi after testing. -- Vernon -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jure.Erznoznik at perftech.si Fri Nov 14 08:18:38 2014 From: Jure.Erznoznik at perftech.si (=?utf-8?B?SnVyZSBFcnpub8W+bmlr?=) Date: Fri, 14 Nov 2014 07:18:38 +0000 Subject: [python-win32] adodbapi transaction counter In-Reply-To: References: Message-ID: Thanks. And thanks for this nice lib. It was the final thing I needed to finally run 2to3 on my projects :D LP, Jure From: Vernon D. Cole [mailto:vernondcole at gmail.com] Sent: Thursday, November 13, 2014 10:36 PM To: Jure Erzno?nik Cc: python-win32 at python.org Subject: Re: [python-win32] adodbapi transaction counter On Wed, Nov 12, 2014 at 7:32 AM, Jure Erzno?nik > wrote: if self.transaction_level == 0 or self.transaction_level is None Rats! That's what I get for copying code that I don't really understand. My simple tests passed this as okay. I have changed the test to "if not self.transaction_level:" in order to fix the bug and avoid the "or" operation at the same time. That's pretty obscure, so I use your version as the comment. This bug fix will define version 2.6.1.2 -- to be pushed to pypi after testing. -- Vernon -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin.koetting at inetvalue.com Fri Nov 21 10:39:52 2014 From: benjamin.koetting at inetvalue.com (=?ISO-8859-15?Q?Benjamin_K=F6tting?=) Date: Fri, 21 Nov 2014 10:39:52 +0100 Subject: [python-win32] win32print pDevMode change DriverData Message-ID: <546F0868.2070701@inetvalue.com> An HTML attachment was scrubbed... URL: From timr at probo.com Mon Nov 24 07:21:15 2014 From: timr at probo.com (Tim Roberts) Date: Sun, 23 Nov 2014 22:21:15 -0800 Subject: [python-win32] win32print pDevMode change DriverData In-Reply-To: <546F0868.2070701@inetvalue.com> References: <546F0868.2070701@inetvalue.com> Message-ID: <82AF4E61-CF57-469B-BA5E-E197D696BAB7@probo.com> On Nov 21, 2014, at 1:39 AM, Benjamin K?tting > wrote: If I iterate over the pDevMode I see this options in DriverData binary string, first I try to make a binary replace in DriverData without success 2 more bytes are changed. OVERCOATTYPE OPTYPE_LUSTER If I will overwrite the whole DriverData with the data when the printer was set to matte using the windows dialog It works, so I have saved me the content and can load it into DriverData if needed. But I think it is a very dirty way to do, even I doesn't know which special features will follow in the future. Sadly, there really is no other way to do it. Windows tries its best to provide an abstraction for the devices at the bottom of things. With some classes of devices, the abstraction works well. With other classes, it doesn?t. Printing is one class of devices where it doesn?t work. Anything special features that weren?t anticipated in the abstraction aren?t available except through escapes and overrides, like what you are using. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrs.idx at ntlworld.com Thu Nov 27 19:06:24 2014 From: jrs.idx at ntlworld.com (John Sampson) Date: Thu, 27 Nov 2014 18:06:24 +0000 Subject: [python-win32] Get key press in Windows 7 Message-ID: <54776820.8040301@ntlworld.com> I have tried a module called readchar to make a Python 2.7 script detect keystrokes in Windows 7. I found it via a link from Stack Overflow. When z is pressed its output is printed in the console as u'\x1a' According to Python 2.7 its type is 'str'. Seeing that it is preceded by a 'u', why is it not 'unicode'? While it appears in the console as above, if it is assigned to a variable ( c = repr(readchar.readkey()) ) and then the value of the variable is tested: print c == u'\x1a' the answer is 'False' This does not make sense. What type of object is a keystroke? Perhaps I need to find some other way for a Python script detect keystrokes but I am confused as to what Python sees them as. Any advice would be welcome. Regards John Sampson From randy at thesyrings.us Thu Nov 27 19:26:19 2014 From: randy at thesyrings.us (Randy Syring) Date: Thu, 27 Nov 2014 13:26:19 -0500 Subject: [python-win32] Get key press in Windows 7 In-Reply-To: <54776820.8040301@ntlworld.com> References: <54776820.8040301@ntlworld.com> Message-ID: <54776CCB.6000903@thesyrings.us> I believe your problem is the use of repr() when assigning to c: >>> u'\x1a' u'\x1a' >>> c = u'\x1a' >>> c == u'\x1a' True >>> repr(c) "u'\\x1a'" >>> repr(c) == u'\x1a' False >>> *Randy Syring* Husband | Father | Redeemed Sinner /"For what does it profit a man to gain the whole world and forfeit his soul?" (Mark 8:36 ESV)/ On 11/27/2014 01:06 PM, John Sampson wrote: > I have tried a module called readchar to make a Python 2.7 script > detect keystrokes in Windows 7. > I found it via a link from Stack Overflow. > When z is pressed its output is printed in the console as > u'\x1a' > According to Python 2.7 its type is 'str'. Seeing that it is preceded > by a 'u', why is it not 'unicode'? > While it appears in the console as above, if it is assigned to a > variable ( c = repr(readchar.readkey()) ) > and then the value of the variable is tested: > print c == u'\x1a' > the answer is 'False' > This does not make sense. What type of object is a keystroke? > > Perhaps I need to find some other way for a Python script detect > keystrokes but I am confused as to what Python sees them as. > > Any advice would be welcome. > > Regards > > John Sampson > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrs.idx at ntlworld.com Thu Nov 27 21:30:20 2014 From: jrs.idx at ntlworld.com (John Sampson) Date: Thu, 27 Nov 2014 20:30:20 +0000 Subject: [python-win32] Get key press in Windows 7 In-Reply-To: <54776CCB.6000903@thesyrings.us> References: <54776820.8040301@ntlworld.com> <54776CCB.6000903@thesyrings.us> Message-ID: <547789DC.2080000@ntlworld.com> Many thanks - by excluding repr the code behaves in a comprehensible way. The example code that was provided at Stack Overflow included repr so I assumed that it was necessary for some reason. If I were allowed to comment there I would ask why. Regards John Sampson On 27/11/2014 18:26, Randy Syring wrote: > I believe your problem is the use of repr() when assigning to c: > > >>> u'\x1a' > u'\x1a' > >>> c = u'\x1a' > >>> c == u'\x1a' > True > >>> repr(c) > "u'\\x1a'" > >>> repr(c) == u'\x1a' > False > >>> > > > *Randy Syring* > Husband | Father | Redeemed Sinner > > /"For what does it profit a man to gain the whole world > and forfeit his soul?" (Mark 8:36 ESV)/ > > On 11/27/2014 01:06 PM, John Sampson wrote: >> I have tried a module called readchar to make a Python 2.7 script >> detect keystrokes in Windows 7. >> I found it via a link from Stack Overflow. >> When z is pressed its output is printed in the console as >> u'\x1a' >> According to Python 2.7 its type is 'str'. Seeing that it is preceded >> by a 'u', why is it not 'unicode'? >> While it appears in the console as above, if it is assigned to a >> variable ( c = repr(readchar.readkey()) ) >> and then the value of the variable is tested: >> print c == u'\x1a' >> the answer is 'False' >> This does not make sense. What type of object is a keystroke? >> >> Perhaps I need to find some other way for a Python script detect >> keystrokes but I am confused as to what Python sees them as. >> >> Any advice would be welcome. >> >> Regards >> >> John Sampson >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Nov 28 07:44:36 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 27 Nov 2014 22:44:36 -0800 Subject: [python-win32] Get key press in Windows 7 In-Reply-To: <54776820.8040301@ntlworld.com> References: <54776820.8040301@ntlworld.com> Message-ID: On Nov 27, 2014, at 10:06 AM, John Sampson wrote: > > I have tried a module called readchar to make a Python 2.7 script detect > keystrokes in Windows 7. > I found it via a link from Stack Overflow. > When z is pressed its output is printed in the console as > u'\x1a? Right, because that?s the ASCII value for Ctrl-Z. > While it appears in the console as above, if it is assigned to a > variable ( c = repr(readchar.readkey()) ) In this line, ?readchar.readkey()? returns a string of length 1. It contains one character, with a value of 1A in hex. When you pass that through ?repr?, you end up with a string of length 7: ?u?, apostrophe, backslash, ?x?, ?1?, ?a?, and apostrophe. Naturally, when you compare that to a string of length 1, it doesn?t match. > This does not make sense. What type of object is a keystroke? It?s a string containing one character. Wasn?t that obvious from your output? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jrs.idx at ntlworld.com Fri Nov 28 09:46:15 2014 From: jrs.idx at ntlworld.com (John Sampson) Date: Fri, 28 Nov 2014 08:46:15 +0000 Subject: [python-win32] Repr, and Unicode type [Was: Get key press in Windows 7] In-Reply-To: References: <54776820.8040301@ntlworld.com> Message-ID: <54783657.6010206@ntlworld.com> In answer to Time Roberts, I saw an item prefixed with 'u' (u'\x1a'). What is the purpose of this prefix? I would have thought it meant 'Unicode' but the type according to Python is 'str'. Thank you for the explanation of 'repr'. The issue turned out to be the inclusion of 'repr' in the sample code without evidence or explanation of its purpose there. Once I was given a clue that 'repr' was the problem and I eliminated it things became clear. Regards JohnSampson From wernerfbd at gmx.ch Fri Nov 28 10:57:50 2014 From: wernerfbd at gmx.ch (Werner) Date: Fri, 28 Nov 2014 10:57:50 +0100 Subject: [python-win32] Repr, and Unicode type [Was: Get key press in Windows 7] In-Reply-To: <54783657.6010206@ntlworld.com> References: <54776820.8040301@ntlworld.com> <54783657.6010206@ntlworld.com> Message-ID: On 11/28/2014 9:46, John Sampson wrote: > In answer to Time Roberts, I saw an item prefixed with 'u' (u'\x1a'). > What is the purpose of this prefix? I would have thought it meant > 'Unicode' but the type according to Python is 'str'. In Py2: a = u'x' type(a) In Py3.4: a = u'x' type(a) Note that u'' is not available in Py 3.0 - 3.2. See e.g. here for more details: https://docs.python.org/3/howto/pyporting.html?highlight=unicode%20literal#from-future-import-unicode-literals Werner From joe.li at msn.com Fri Nov 28 13:44:15 2014 From: joe.li at msn.com (LiJoe) Date: Fri, 28 Nov 2014 20:44:15 +0800 Subject: [python-win32] Python: using stdout instead of stderr Message-ID: Hi, I am new for Python user under windows, so any suggestion would be help. :) Currently i am using Cython 2.7.2 under windows, i found that Python sends command prompt(that is ">>>") to stderr instead of stdout, now i need to change it from stderr to stdout. I have check the source code and didn't found how to achieve it, any expert can help me on this? thanks in advance. :) Python 2.7.2 on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: