Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 5:34 PM, Ian Kelly wrote: > On Mon, Dec 29, 2014 at 7:05 PM, Chris Angelico wrote: >> Are .pyc files compatible across revisions? Could I carry this file to >> a 2.7.9 and see if the crash still happens? > > PEP 6 requires that .pyc files for a particular major release mus

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Ian Kelly
On Mon, Dec 29, 2014 at 11:34 PM, Ian Kelly wrote: > On Mon, Dec 29, 2014 at 7:05 PM, Chris Angelico wrote: >> Are .pyc files compatible across revisions? Could I carry this file to >> a 2.7.9 and see if the crash still happens? > > PEP 6 requires that .pyc files for a particular major release mu

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Ian Kelly
On Mon, Dec 29, 2014 at 7:05 PM, Chris Angelico wrote: > Are .pyc files compatible across revisions? Could I carry this file to > a 2.7.9 and see if the crash still happens? PEP 6 requires that .pyc files for a particular major release must work with all the bug fix releases for that version. --

Re: suggestions for VIN parsing

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 10:45 AM, Rick Johnson wrote: > [ADDENDUM #3] This reminds me of the transcript of "Still Alive" at the end of Portal. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 12:40 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> Unlike playing with sre_constants.pyc, this one *does* result in a >> different file after renaming away the .pyc. So somehow, SOMEHOW, the >> .pyc file became corrupt. Is this something worth reporting? I now >>

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Steven D'Aprano
Chris Angelico wrote: > Unlike playing with sre_constants.pyc, this one *does* result in a > different file after renaming away the .pyc. So somehow, SOMEHOW, the > .pyc file became corrupt. Is this something worth reporting? I now > have what appears to be a file whose presence in the current dir

Re: suggestions for VIN parsing

2014-12-29 Thread Rick Johnson
[ADDENDUM #3] I got off on a tangent in that last post, now i intend to re-focus the discussion. > OPTION 1: Define the keys as ranges and the values as years. > > From the perspective of the mapping, the semantic order is > inversed. The "range" has no semantical meaning UNLESS it >

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Gregory Ewing
Chris Angelico wrote: On Tue, Dec 30, 2014 at 7:17 AM, Ian Kelly wrote: You could try renaming the .pyc instead of deleting it. Hmm, and in doing so I just learned that they don't, after all, have any sort of timestamp in them - I thought they did. I think it contains the timestamp of the

Re: suggestions for VIN parsing

2014-12-29 Thread Rick Johnson
[Addendum #2] WHO'S RESPONSIBLE FOR THE "SEMANTIC WARS"? I've always believed in the philosophy of: "Responsibility to the responsible". After reading that statement,

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 5:58 AM, Peter Otten <__pete...@web.de> wrote: > OK. sre_constants.py looks pretty generic, the only module it imports (_sre) > is a built-in and the interpreter is known-good. If the modules imported > before sre_constants.py are known-good, too, and no other debian user se

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 7:17 AM, Ian Kelly wrote: > On Mon, Dec 29, 2014 at 9:28 AM, Chris Angelico wrote: >> Why is sre_constants segfaulting?! It's such a simple file! I assume >> the "matches" comment means it thinks there's no problem with the .pyc >> file; is it possible that, despite those

Re: suggestions for VIN parsing

2014-12-29 Thread Rick Johnson
On Monday, December 29, 2014 12:27:33 PM UTC-6, Rick Johnson wrote: > > [...] > [Addendum] WHEN LOGICAL AND SUBJECTIVE CONSTRUCTS INTERSECT, "SEMANTIC WARS" ARE WAGED! I be

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Ian Kelly
On Mon, Dec 29, 2014 at 9:28 AM, Chris Angelico wrote: > Why is sre_constants segfaulting?! It's such a simple file! I assume > the "matches" comment means it thinks there's no problem with the .pyc > file; is it possible that, despite those checks, there's an issue > there? I could delete the .py

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Peter Otten
Chris Angelico wrote: > On Tue, Dec 30, 2014 at 4:28 AM, Peter Otten <__pete...@web.de> wrote: >> Maybe the interpreter itself is corrupted? Google suggests that debsums >> may be the tool to find out. > > That's part of what I'm trying to track down, but why it should have > changed in the past

Re: suggestions for VIN parsing

2014-12-29 Thread Rick Johnson
On Monday, December 29, 2014 10:58:59 AM UTC-6, Vincent Davis wrote: > Rick, Thanks for your suggestions, I was just starting > version2 and wanted to do something like you suggest. > Another question. I what to change the logic so that > rather than return THE match it return all matches. I want

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 4:28 AM, Peter Otten <__pete...@web.de> wrote: > Maybe the interpreter itself is corrupted? Google suggests that debsums may > be the tool to find out. That's part of what I'm trying to track down, but why it should have changed in the past few days is beyond me. There's no

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Peter Otten
Chris Angelico wrote: > On Tue, Dec 30, 2014 at 3:05 AM, Irmen de Jong > wrote: >> On 29-12-2014 15:33, Chris Angelico wrote: >> >>> So clearly an empty 'site' can be imported safely, but running Python >>> without -S segfaults. >>> >>> Can anyone advise as to where I should look for the cause of

Re: CSV Dictionary

2014-12-29 Thread Tim Chase
On 2014-12-29 16:37, JC wrote: > On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote: > > > On Mon, Dec 29, 2014 at 10:11 AM, JC > > wrote: > >> Do I have to open the file again to get 'rdr' work again? > > > > Yes, but if you want the number of records, just operate on the > > rows list, e

Re: suggestions for VIN parsing

2014-12-29 Thread Vincent Davis
On Sun, Dec 28, 2014 at 11:50 PM, Rick Johnson wrote: > 3. I see that you are utilizing regexps to aid in the logic, > and although i agree that regexps are overkill for this > problem (since it could "technically" be solved with string > methods) if *I* had to solve this problem, i would use the

Re: suggestions for VIN parsing

2014-12-29 Thread Vincent Davis
On Mon, Dec 29, 2014 at 7:47 AM, Denis McMahon wrote: > K .. D would be the appropriate month prefixes for the 1981 model year, > but if both the 1981 and 1982 model years used DA as a year prefix, there > would be some prefixes that appeared twice, in the 1981 model year and > the 1982 model yea

Re: CSV Dictionary

2014-12-29 Thread Tim Chase
On 2014-12-29 16:11, JC wrote: > On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote: > > > On Mon, Dec 29, 2014 at 9:35 AM, JC wrote: > >> How could I get the all the records? > > > > This should work: > > > > with open('x.csv','rb') as f: > > rdr = csv.DictReader(f,delimiter=',') > >

Re: CSV Dictionary

2014-12-29 Thread JC
On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote: > On Mon, Dec 29, 2014 at 10:11 AM, JC wrote: >> Do I have to open the file again to get 'rdr' work again? > > Yes, but if you want the number of records, just operate on the rows > list, e.g. len(rows). > > Skip Yes, I did that. But if

Re: Future of python on android

2014-12-29 Thread Anssi Saari
"Fetchinson ." writes: > So what's the future proof way of writing/deploying/installing python > programs on android? Kivy is it I believe. I've meant to look into it but haven't gotten around to it... -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV Dictionary

2014-12-29 Thread Skip Montanaro
On Mon, Dec 29, 2014 at 10:11 AM, JC wrote: > Do I have to open the file again to get 'rdr' work again? Yes, but if you want the number of records, just operate on the rows list, e.g. len(rows). Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 3:05 AM, Irmen de Jong wrote: > On 29-12-2014 15:33, Chris Angelico wrote: > >> So clearly an empty 'site' can be imported safely, but running Python >> without -S segfaults. >> >> Can anyone advise as to where I should look for the cause of the trouble? >> >> ChrisA > > Pe

Re: CSV Dictionary

2014-12-29 Thread JC
On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote: > On Mon, Dec 29, 2014 at 9:35 AM, JC wrote: >> How could I get the all the records? > > This should work: > > with open('x.csv','rb') as f: > rdr = csv.DictReader(f,delimiter=',') > rows = list(rdr) > > You will be left with a

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
On Tue, Dec 30, 2014 at 2:57 AM, Dave Angel wrote: > My gut feeling is you should check if there is another site.py* anywhere on > your system. (Use find rather than just manually checking the sys.path > locations) I used imp.find_module and it showed the one in /usr/lib/python2.7/site.py would

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Irmen de Jong
On 29-12-2014 15:33, Chris Angelico wrote: > So clearly an empty 'site' can be imported safely, but running Python > without -S segfaults. > > Can anyone advise as to where I should look for the cause of the trouble? > > ChrisA Perhaps starting python with -v provides some more info on when exa

Re: Python 2.7 segfaults on 'import site'

2014-12-29 Thread Dave Angel
On 12/29/2014 09:33 AM, Chris Angelico wrote: rosuav@sikorsky:~$ python -S Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] on linux2 rosuav@sikorsky:~$ python Segmentation fault This is the system Python on Debian Wheezy, and I haven't changed site.py at all. This broke some time in

Re: CSV Dictionary

2014-12-29 Thread Skip Montanaro
On Mon, Dec 29, 2014 at 9:35 AM, JC wrote: > How could I get the all the records? This should work: with open('x.csv','rb') as f: rdr = csv.DictReader(f,delimiter=',') rows = list(rdr) You will be left with a list of dictionaries, one dict per row, keyed by the values in the first row:

CSV Dictionary

2014-12-29 Thread JC
Hello, I have csv file like: id,name,userid,password 1,ABC,def@ghi,1234 2,DEF,ghi@jkl,asdf 3,GHI,jkl@mno,zxcv . . . I need to get that csv file into a dictionary. Here is my code: import csv with open('x.csv','rb') as f: rdr = csv.DictReader(f,delimiter=',') flds = rdr.fieldnames r

Re: suggestions for VIN parsing

2014-12-29 Thread Denis McMahon
On Sun, 28 Dec 2014 16:27:20 -0700, Vincent Davis wrote: > On Fri, Dec 26, 2014 at 12:15 PM, Denis McMahon > > wrote: > >> Note, I think the 1981 model year ran KCA - DCA prefixes, not as shown >> on the website you quoted. > ​Denis, > Regarding the KCA - DCA prefixes, do you have a source as t

Python 2.7 segfaults on 'import site'

2014-12-29 Thread Chris Angelico
rosuav@sikorsky:~$ python -S Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] on linux2 >>> rosuav@sikorsky:~$ python Segmentation fault This is the system Python on Debian Wheezy, and I haven't changed site.py at all. This broke some time in the last few days, and I'm trying to figure ou

Re: Searching through more than one file.

2014-12-29 Thread Cem Karan
On Dec 29, 2014, at 2:47 AM, Rick Johnson wrote: > On Sunday, December 28, 2014 11:29:48 AM UTC-6, Seymore4Head wrote: >> I need to search through a directory of text files for a string. >> Here is a short program I made in the past to search through a single >> text file for a line of text. >

Re: Own network protocol

2014-12-29 Thread Burak Arslan
Hi, On 12/29/14 10:18, pfranke...@gmail.com wrote: > Hello Steven! > > Thank you for your answer! > > RPyC indeed looks great! I need to deep dive into the API reference, but I > think its capabilities will suffice to do what I want. Do you know whether > non-python related clients can work wit

Re: Own network protocol

2014-12-29 Thread Tim Chase
On 2014-12-29 00:34, pfranke...@gmail.com wrote: > Am Samstag, 27. Dezember 2014 14:19:21 UTC+1 schrieb Tim Chase: > > - do clients need to know if they missed a message? (somebody > > disconnected from the LAN for a moment) > > This would be nice indeed. At least, the user should be notified >

Re: Searching through more than one file.

2014-12-29 Thread Albert-Jan Roskam
- On Sun, Dec 28, 2014 8:12 PM CET Dave Angel wrote: >On 12/28/2014 12:27 PM, Seymore4Head wrote: >> I need to search through a directory of text files for a string. >> Here is a short program I made in the past to search through a single >> text file for a line of tex

Re: Own network protocol

2014-12-29 Thread pfranken85
Hello Tim, Am Samstag, 27. Dezember 2014 14:19:21 UTC+1 schrieb Tim Chase: > The eventual solution would depend on a variety of factors: > > - how critical is synchronization? > > - do clients need to know if they missed a message? (somebody > disconnected from the LAN for a moment) This woul

Re: Own network protocol

2014-12-29 Thread pfranken85
Hello Steven! Thank you for your answer! RPyC indeed looks great! I need to deep dive into the API reference, but I think its capabilities will suffice to do what I want. Do you know whether non-python related clients can work with this as well, i.e. are their corresponding tools on the androi