Convert PySerial to python 3.0

2009-02-24 Thread Seth
I am just messing around trying to get pyserial to work with 3.0. I am stuck on this line: if type(port) in [type(''), type(u'')] how can I convert this to 3.0? I tried changing the u to a d that did not do anything. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
On Feb 24, 10:55 pm, Chris Rebert c...@rebertia.com wrote: On Tue, Feb 24, 2009 at 7:46 PM, Seth king.s...@gmail.com wrote: I am just messing around trying to get pyserial to work with 3.0. I am stuck on this line: if type(port) in [type(''), type(u'')] how can I convert this to 3.0? I

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
Originally: if type(port) in [type(''), type(u'')] self.portstr = port else: self.portstr = self.makeDeviceName(port) On Feb 25, 8:47 am, Christian Heimes li...@cheimes.de wrote: Seth wrote: I implemented if isinstance(port, str): that seems to work

Re: Convert PySerial to python 3.0

2009-02-25 Thread Seth
that I am working on and pyserial has not been converted so I just started messing around with it. Thanks for the help. Seth On Feb 25, 10:16 am, Christian Heimes li...@cheimes.de wrote: Seth wrote: I tried all three ways you guys listed nothing seems to convert the string to bytes

shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-09 Thread seth
There is something you could possibly help me with. We have a code that creates a simple Python shelve database. We are able to serialize objects and store them in the dbm file. This seem to work the same on Windows XP Python 2.5, Ubuntu 9.1 with Python 2.6, but on Os X 10.5 with Python 2.5 the

Re: shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-16 Thread seth
On Feb 14, 1:21 pm, a...@pythoncraft.com (Aahz) wrote: Nope -- any reason you can't change the filename? -- Os X 10.5 did not recognized the dbm extension. But, I have been able to fix the problem (hope it helps somebody): At http://docs.python.org/library/shelve.html it says:

Pyserial and pyQt

2009-07-21 Thread Seth
box and eventually a graph in pyQt. I can't find any documentation or tutorials on how to do this. If anyone can point me in the right direction or give me some tips I would be grateful. Thanks, Seth -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyserial and pyQt

2009-07-22 Thread Seth
On Jul 21, 7:24 pm, David Boddie da...@boddie.org.uk wrote: On Tuesday 21 July 2009 21:37, Seth wrote: I have used pyserial in the past but this is my first experience with pyQt.  I am using the Python xy package for windows current but might move to linux.  I have a small device

Help with Asyncore

2005-07-29 Thread Seth Nielson
buffers. Should I also overwrite send and have the data appended to a buffer? If not, how should writable and handle_write be implemented? I'm not sure what to do here... Thank you in advance, -- Seth Nielson -- http://mail.python.org/mailman/listinfo/python-list

Re: A replacement for lambda

2005-07-30 Thread Seth Nielson
of saying, don't do this now. That is why I use lambda. -- Seth Nielson On 7/30/05, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Stefan Rank wrote: on 30.07.2005 10:20 Paolino said the following: why (x**2 with(x))(x**3 with(x)) is not taken in consideration? If 'with' must

gdbm dying wierdly

2005-08-27 Thread Seth Nielson
WITHOUT an exception! It just disappears! (signal maybe?) Please help! I'm up against the wall! -- Seth N. -- http://mail.python.org/mailman/listinfo/python-list

Re: gdbm dying wierdly

2005-08-27 Thread Seth Nielson
Nevermind. The problem wasn't in gdbm. I had exception in stead of Exception in the try-except statement. -- SethNOn 8/27/05, Seth Nielson [EMAIL PROTECTED] wrote: Hi guys. I'm using a python script as a redirector for Squid. My python script uses gdbm and exhibits some weird behavior. 1. If I

minidom and unicode errors

2006-03-06 Thread Abhimanyu Seth
Hi all,I'm trying to parse and modify an XML document using xml.dom.minidom module and Python 2.4.2 from xml.dom import minidom dom = minidom.parse (c:/test.txt)If the xml file contains a non-ascii character, then i get a parse error. I have the following line in my xml file:targetException beim

Re: minidom and unicode errors

2006-03-06 Thread Abhimanyu Seth
On 3/7/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Abhimanyu Seth wrote: I'm trying to parse and modify an XML document using xml.dom.minidom module and Python 2.4.2 from xml.dom import minidom dom = minidom.parse (c:/test.txt) If the xml file contains a non-ascii character, then i get a parse

Re: minidom and unicode errors

2006-03-06 Thread Abhimanyu Seth
On 3/7/06, Abhimanyu Seth [EMAIL PROTECTED] wrote: On 3/7/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Abhimanyu Seth wrote: I'm trying to parse and modify an XML document using xml.dom.minidom module and Python 2.4.2 from xml.dom import minidom dom = minidom.parse (c:/test.txt) If the xml

Re: minidom and unicode errors

2006-03-06 Thread Abhimanyu Seth
On 3/7/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Abhimanyu Seth wrote: I have the following line in my xml file: targetException beim Löschen des Audit-Moduls aufgetreten. Exception Stack lautet: %1./target ExpatError: not well-formed (invalid token): line 8, column 27 I've specified utf-8

Re: minidom and unicode errors

2006-03-06 Thread Abhimanyu Seth
On 3/7/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Abhimanyu Seth wrote: Sorry, my mistake. The file was not saved as utf-8. Saving it as utf-8 solves my problems. f = codecs.open (c:/test.txt, r, utf-8) dom = minidom.parseString (codecs.encode (f.read(), utf-8)) However, I still need to encode

Re: Performance: sets vs dicts.

2010-08-29 Thread Seth Rees
On 08/29/10 14:43, Peter Otten wrote: John Nagle wrote: Is the in test faster for a dict or a set? Is frozenset faster than set? Use case is for things like applying in on a list of 500 or so words while checking a large body of text. As Arnaud suspects: no significant difference: $

Re: accessing a text file

2010-09-05 Thread Seth Rees
On 09/05/10 16:47, Baba wrote: level: beginner how can i access the contents of a text file in Python? i would like to compare a string (word) with the content of a text file (word_list). i want to see if word is in word_list. let's assume the TXT file is stored in the same directory as

Combinations or Permutations

2010-09-20 Thread Seth Leija
I need to know how to generate a list of combinations/permutations (can't remember which it is). Say I have a list of variables: [a,b,c,d,...,x,y,z] I am curious if there is an optimized way to generate this: [[a,b],[a,c],[a,d],...,[x,z],[y,z]] I currently have an iteration that does this:

Re: Combinations or Permutations

2010-09-20 Thread Seth Leija
On Sep 20, 3:08 pm, Mark Lawrence breamore...@yahoo.co.uk wrote: On 20/09/2010 21:54, Seth Leija wrote: I need to know how to generate a list of combinations/permutations (can't remember which it is). Say I have a list of variables: [a,b,c,d,...,x,y,z] I am curious

[issue12162] Documentation about re \number

2011-05-23 Thread Seth Troisi
New submission from Seth Troisi brain...@gmail.com: It would be nice to clarify re documentation on how to use \number. current documentation lists three half examples: (.+) \1 matches 'the the' or '55 55', but not 'the end' (note the space after the group). This is rather confusing (at least

[issue12162] Documentation about re \number

2011-05-23 Thread Seth Troisi
Seth Troisi brain...@gmail.com added the comment: Given David Murray's input I think the example would be best done as re.search(r'(\w+) \1', can you do the can can?) # Matches the duplicate can _sre.SRE_Match object at ... I want to stress that the documentation is not wrong

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
New submission from Seth Bromberger: ipaddress.ip_address instances should be flyweight. There's really no reason to make them mutable: a = ipaddress.ip_address(10.1.2.3) b = ipaddress.ip_address(10.1.2.3) id(a) 140066533772368 id(b) 140066504622544 Especially with IPv6 and large numbers

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: Confirmed on 3.4.0; likely exists in previous versions as well. -- versions: +Python 3.4 -Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23103

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: What is your proposal? WeakValueDictionary mapping raw bytes object to single instance of ipaddress that is queried from ipaddress's __new__? No built-in has quite that extensive a level of caching and aggressive deduplication to my knowledge. I

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: 1) However: b = ipaddress.IPv4Address('1.2.3.4') a = ipaddress.IPv4Address('1.2.3.4') id(a) 4428380928 id(b) 4428381768 a == b True b._ip += 6 id(b) 4428381768 b IPv4Address('1.2.3.10') 2) Isn’t _version already a class attribute? It’s set in _Basev4

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: The opposite argument is that it may be better left up to the application that has to handle lots of ips to do the caching according to what it knows to be an optimum pattern. I'd agree with you wholeheartedly if ipaddress wasn't part of stdlib

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: As a test, I tried the following (taken mostly from http://codesnipers.com/?q=python-flyweights): class Foo(object): _Foo = weakref.WeakValueDictionary() def __new__(cls, addr): obj = Foo._Foo.get(addr, None) if obj is None

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: Sorry for the additional followup, but I re-ran the test with approximately real-world parameters. In this second test, I created 10 million Foo() instances with random values from 1-2000 (using random.randint). This corresponds to 2000 hosts generating 10

[issue23103] ipaddress should be Flyweight

2014-12-23 Thread Seth Bromberger
Seth Bromberger added the comment: I'm just pointing out that if he thinks 56 bytes per object is too large, he's going to be disappointed with what Python has to offer. General purpose user-defined Python objects don't optimize for low memory usage, and even __slots__ only gets you so far

tarfile vs zipfile

2015-03-02 Thread Seth P
Is there a reason tarfile and zipfile don't use the same method/member names, where it makes sense? Consider the following six methods/members, which I would expect to be the same (with the possible exception of mtime vs date_time, which are of different types). It almost seems like someone

[issue27094] Floating Point Printing Error with 2+.8553 or 3+.8553

2016-05-23 Thread Seth Norton
New submission from Seth Norton: In a basic command line interpreter, adding 2 or 3 to .8553 will cause the result to be displayed as if a rounding error occurred. The number is so small that I expect it is not a mathematical error but rather in how the number is printed. The displayed

[issue27094] Floating Point Printing Error with 2+.8553 or 3+.8553

2016-05-23 Thread Seth Norton
Changes by Seth Norton <snorton...@gmail.com>: -- versions: +Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27094> ___

[issue39318] NamedTemporaryFile could cause double-close on an fd if _TemporaryFileWrapper throws

2020-01-13 Thread Seth Troisi
Change by Seth Troisi : -- nosy: +Seth.Troisi ___ Python tracker <https://bugs.python.org/issue39318> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39949] truncating match in regular expression match objects repr

2020-03-12 Thread Seth Troisi
New submission from Seth Troisi : Following on https://bugs.python.org/issue17087 Today I was mystified by why a regex wasn't working. >>> import re >>> re.match(r'.{10}', 'A'*49+'B') <_sre.SRE_Match object; span=(0, 10), match='AA'> >>

[issue39949] truncating match in regular expression match objects repr

2020-03-24 Thread Seth Troisi
Change by Seth Troisi : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue39949> ___ ___

[issue41270] NamedTemporaryFile is not its own iterator.

2020-10-19 Thread Seth Sims
Change by Seth Sims : -- pull_requests: +21728 pull_request: https://github.com/python/cpython/pull/22766 ___ Python tracker <https://bugs.python.org/issue41

[issue41542] module `__all__` cannot detect function name with `φ`

2020-08-13 Thread Seth Woodworth
Seth Woodworth added the comment: I don't think it is worth throwing a warning. This might be the desired, or at least allowed, behavior. I'm relying on the behavior in a toy library I'm working on. -- ___ Python tracker <ht

[issue41542] module `__all__` cannot detect function name with `φ`

2020-08-13 Thread Seth Woodworth
Seth Woodworth added the comment: As described in PEP3131, unicode identifiers are normalized via NFKC before being added to the globals, and presumably __all__ as in your example. You can see what python _did_ add via unicodedata.normalize('NFKC', 'ϕ') which returns 'φ' [ins] In [8

[issue41270] NamedTemporaryFile is not its own iterator.

2020-07-10 Thread Seth Sims
New submission from Seth Sims : _TemporaryFileWrapper does not proxy __next__ to the underlying file object. There was a discussion on the mailing list in 2016 mentioning this, however it seems it was dropped without a consensus. Biopython encountered this issue (referenced below) and we

[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Seth Troisi
Seth Troisi added the comment: I didn't propose a patch before because I was unsure of decision. Now that there is a +1 from Raymond I'll working on a patch and some documentation. Expect a patch within the week. -- ___ Python tracker <ht

[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Seth Troisi
Change by Seth Troisi : -- keywords: +patch pull_requests: +20100 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/20922 ___ Python tracker <https://bugs.python.org/issu

[issue39949] truncating match in regular expression match objects repr

2020-06-16 Thread Seth Troisi
Seth Troisi added the comment: @matpi The current behavior is for the right quote to not appear I kept this behavior but happy to consider changing that. See the linked patch for examples -- ___ Python tracker <https://bugs.python.

[issue39949] truncating match in regular expression match objects repr

2020-06-18 Thread Seth Troisi
Seth Troisi added the comment: I was thinking about how to add the end quote and found these weird cases: >>> "asdf'asdf'asdf" "asdf'asdf'asdf" >>> "asdf\"asdf\"asdf" 'asdf"asdf"asdf' >>> "asdf\"a

[issue41542] module `__all__` cannot detect function name with `φ`

2020-08-14 Thread Seth Woodworth
Seth Woodworth added the comment: @Steven, I'm exploring what unicode code points can be used as valid starting characters for identifiers. I'm looping over the code point ranges with the XID_START property and attempting to add them to globals() to see if they maintain the same

[issue42107] Monotonic time on macOS 10.12+ should use mach_continuous_time()

2020-10-21 Thread Seth Junot
New submission from Seth Junot : This blog post describes an issue with Apple's "CLOCK_UPTIME_RAW" where the clock is reset after a system that hibernates: https://rachelbythebay.com/w/2020/10/20/ticktock/ According to Apple's documentation, CLOCK_UPTIME_RAW c

[issue29091] Python 3.5+ socket.socketpair fallback incorrectly implemented

2016-12-28 Thread Seth Michael Larson
Seth Michael Larson added the comment: Sorry for making noise, yes I was using the implementation in Python 2.x. I will do better investigation in the future. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29091] Python 3.5+ socket.socketpair fallback incorrectly implemented

2016-12-27 Thread Seth Michael Larson
New submission from Seth Michael Larson: The socket.socketpair() fallback for Python 3.5+ is incorrectly implemented from the original source. The fallback doesn't provide a backlog argument to the lsock.listen() function call. When running the function it gives the following error

[issue29704] Can't read data from Transport after asyncio.SubprocessStreamProtocol closes

2017-03-02 Thread Seth Michael Larson
New submission from Seth Michael Larson: Copied from https://github.com/python/asyncio/issues/484 """ >From https://bugs.python.org/issue23242#msg284930 The following script is used to reproduce the bug: import asyncio async def execute(): process = await asyncio.crea

[issue29704] Can't read data from Transport after asyncio.SubprocessStreamProtocol closes

2017-03-02 Thread Seth Michael Larson
Changes by Seth Michael Larson <sethmichaellar...@protonmail.com>: -- components: +asyncio nosy: +gvanrossum type: -> behavior ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-04 Thread Seth Michael Larson
Seth Michael Larson added the comment: Leaving a thought here, I'm highlighting that we're now implementing two different standards, RFC 3986 with hints of WHATWG-URL. There are pitfalls to doing so as now a strict URL parser for RFC 3986 (like the one used by urllib3/requests) will give