Re: for / while else doesn't make sense

2016-05-25 Thread Jussi Piitulainen
Rustom Mody writes: > On Wednesday, May 25, 2016 at 4:18:02 PM UTC+5:30, Marko Rauhamaa wrote: ... >> instead of ASCII, national 7-bit character set variants were being >> used. For example, you might see Pascal code like this: >> >>ä return the net å >>ret := grossÄunitÅ * grossRate >>

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Steven D'Aprano
On Thursday 26 May 2016 15:47, San wrote: > Following is the code i used. > > def test_results(filename): > import csv > with open(filename,"rU") as f: > reader = csv.reader(f,delimiter="\t") > result = {} You should use more consistent indents. Can you set your editor to auto

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Rustom Mody
On Thursday, May 26, 2016 at 11:17:56 AM UTC+5:30, San wrote: > On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote: > > Hi Gorup, > > > > why i am getting "ValueError: I/O operation on closed file" this error. > > Pls let me know. > > > > Thanks in Advance. > > san > > Hello, > Followi

Re: for / while else doesn't make sense

2016-05-25 Thread Rustom Mody
On Wednesday, May 25, 2016 at 4:18:02 PM UTC+5:30, Marko Rauhamaa wrote: > Christopher Reimer: > > > Back in the early 1980's, I grew up on 8-bit processors and latin-1 was > > all we had for ASCII. > > You really were very advanced. According to https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Hist

Re: ValueError: I/O operation on closed file

2016-05-25 Thread San
On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. > > Thanks in Advance. > san Hello, Following is the code i used. def test_results(filename): import csv with open(fil

Re: Format a timedelta object

2016-05-25 Thread Marko Rauhamaa
Steven D'Aprano : > I have a timedelta object, and I want to display it in a nice > human-readable format like 03:45:17 for "three hours, forty five > minutes, 17 seconds". > > Is there a standard way to do this? >>> import datetime >>> td = datetime.timedelta(hours=3, minutes=45, seconds=1

Re: Format a timedelta object

2016-05-25 Thread Zachary Ware
On Thu, May 26, 2016 at 12:16 AM, Steven D'Aprano wrote: > I have a timedelta object, and I want to display it in a nice human-readable > format like 03:45:17 for "three hours, forty five minutes, 17 seconds". > > Is there a standard way to do this? >>> timedelta(100) datetime.timedelta(100

Format a timedelta object

2016-05-25 Thread Steven D'Aprano
I have a timedelta object, and I want to display it in a nice human-readable format like 03:45:17 for "three hours, forty five minutes, 17 seconds". Is there a standard way to do this? -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-25 Thread Erik
On 25/05/16 11:19, Steven D'Aprano wrote: On Wednesday 25 May 2016 19:10, Christopher Reimer wrote: Back in the early 1980's, I grew up on 8-bit processors and latin-1 was all we had for ASCII. It really, truly wasn't. But you can be forgiven for not knowing that, since until the rise of the

Re: Do you think a DB based on Coroutine and AsyncIO is a good idea? I have written a demo on GitHub.

2016-05-25 Thread jimzuolin
On Wednesday, 25 May 2016 19:15:38 UTC+1, Ian wrote: > On Wed, May 25, 2016 at 10:52 AM, wrote: > > Link: https://github.com/JimChengLin/AsyncDB > > > > I always wonder why people do not make an async DB, when they are crazy > > with async web framework. Hard disks are faster than the Internet,

Re: Do you think a DB based on Coroutine and AsyncIO is a good idea? I have written a demo on GitHub.

2016-05-25 Thread Ian Kelly
On Wed, May 25, 2016 at 10:52 AM, wrote: > Link: https://github.com/JimChengLin/AsyncDB > > I always wonder why people do not make an async DB, when they are crazy with > async web framework. Hard disks are faster than the Internet, but still > pretty slow compared to CPU/RAM. In-process dbm-s

Do you think a DB based on Coroutine and AsyncIO is a good idea? I have written a demo on GitHub.

2016-05-25 Thread jimzuolin
Link: https://github.com/JimChengLin/AsyncDB I always wonder why people do not make an async DB, when they are crazy with async web framework. Hard disks are faster than the Internet, but still pretty slow compared to CPU/RAM. Due to my limited English skill, I may be not able to explain how it

Re: IndexError for using pandas dataframe values

2016-05-25 Thread Peter Otten
Daiyue Weng wrote: > Hi, I tried to use DataFrame.values to convert a list of columns in a > dataframe to a numpy ndarray/matrix, > > matrix = df.values[:, list_of_cols] > > but got an error, > > IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis > (None) and integer or boolea

Re: html & python connection problem with hyperlinks

2016-05-25 Thread justin walters
On Wed, May 25, 2016 at 3:24 AM, wrote: > Why not created the field title, that located on the template > BusinessList.html as a link to go to Business_Detail.html..? please check > > Code: > > models. py: > > from django.db import models > > > REGIONS = ( > ('ΘΕΣ', 'ΘΕΣΣΑΛΟΝΙΚΗ'), > ('ΣΕΡ', 'ΣΕΡ

Re: Find the max number of elements in lists as value in a dictionary

2016-05-25 Thread Jon Ribbens
On 2016-05-25, Daiyue Weng wrote: > I want to find the maximal number of elements contained in a nested > dictionary, e.g. > > data = { > 'violations': > { > 'col1': {'err': [elem1, elem2, elem3]}, > 'col2': {'err': [elem1, elem2]} > } > }

Re: Find the max number of elements in lists as value in a dictionary

2016-05-25 Thread Jussi Piitulainen
Daiyue Weng writes: > I want to find the maximal number of elements contained in a nested > dictionary, e.g. > > data = { > 'violations': > { > 'col1': {'err': [elem1, elem2, elem3]}, > 'col2': {'err': [elem1, elem2]} > } > } > > so to find

IndexError for using pandas dataframe values

2016-05-25 Thread Daiyue Weng
Hi, I tried to use DataFrame.values to convert a list of columns in a dataframe to a numpy ndarray/matrix, matrix = df.values[:, list_of_cols] but got an error, IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices so what's

Re: ValueError: I/O operation on closed file

2016-05-25 Thread alister
On Wed, 25 May 2016 05:29:53 -0700, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. > > Thanks in Advance. > san because you are trying to do something with a file that has been closed the error message is quite explanatory

Find the max number of elements in lists as value in a dictionary

2016-05-25 Thread Daiyue Weng
I want to find the maximal number of elements contained in a nested dictionary, e.g. data = { 'violations': { 'col1': {'err': [elem1, elem2, elem3]}, 'col2': {'err': [elem1, elem2]} } } so to find the maximal number of elements in the list

Re: ValueError: I/O operation on closed file

2016-05-25 Thread Joel Goldstick
On Wed, May 25, 2016 at 8:29 AM, San wrote: > Hi Gorup, > > why i am getting "ValueError: I/O operation on closed file" this error. > Pls let me know. Because your program is incorrect? Why not list your code, so that someone might be able to help you? > > Thanks in Advance. > san > -- > https

ValueError: I/O operation on closed file

2016-05-25 Thread San
Hi Gorup, why i am getting "ValueError: I/O operation on closed file" this error. Pls let me know. Thanks in Advance. san -- https://mail.python.org/mailman/listinfo/python-list

Re: Spurious issue in CPython 2.7.5

2016-05-25 Thread thomas povtal.org
Hi! Thanks. It was an example... I get the very same exception text (the one that appears to be cut off) in this line in our own code: if Foo == False: (where Foo is global Foo = False.) :) T Den 25. maj 2016 klokken 14:13 skrev Tim Golden : On 25/05/2016 13:04, th

Re: for / while else doesn't make sense

2016-05-25 Thread Christopher Reimer
> On May 25, 2016, at 3:47 AM, Marko Rauhamaa wrote: > > Christopher Reimer : > >> Back in the early 1980's, I grew up on 8-bit processors and latin-1 was >> all we had for ASCII. > > You really were very advanced. According to https://en.wikipedia.org/wiki/ISO/IEC_8859-1#History>, ISO 8859-1

Re: Spurious issue in CPython 2.7.5

2016-05-25 Thread Tim Golden
On 25/05/2016 13:04, thomas povtal.org wrote: > 2016-05-24_08:15:40.84187 File "checkrc.pxd", line 14, in > zmq.core.checkrc._check_rc (zmq/core/socket.c:5932) > 2016-05-24_08:15:40.84187 OverflowError: long too big to convert That exception is arising from ZeroMQ's own code, by the look of it. (O

Re: Spurious issue in CPython 2.7.5

2016-05-25 Thread thomas povtal.org
Hi! Thanks. Replies in-line > Den 24. maj 2016 klokken 19:12 skrev Steven D'Aprano : > > On Tue, 24 May 2016 08:22 pm, thomas povtal.org wrote: > > > Hi, > > > > Please excuse me if this is not the right place, but I have some issues > > with CPython on a NUMA machine. > > Do you mean a Non-Un

Re: for / while else doesn't make sense

2016-05-25 Thread Marko Rauhamaa
Christopher Reimer : > Back in the early 1980's, I grew up on 8-bit processors and latin-1 was > all we had for ASCII. You really were very advanced. According to https://en.wikipedia.org/wiki/ISO/IEC_8859-1#History>, ISO 8859-1 was standardized in 1985. "Eight-bit-cleanness" became a thing in th

Re: Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-25 Thread Chris Angelico
On Wed, May 25, 2016 at 8:19 PM, Steven D'Aprano wrote: > While the code page system was necessary at > the time, the legacy of them today continues to plague computer users, causing > moji-bake, errors on file systems[1], and holding back the adoption of > Unicode. > > [1] I'm speaking from expe

html & python connection problem with hyperlinks

2016-05-25 Thread litssa2005
Why not created the field title, that located on the template BusinessList.html as a link to go to Business_Detail.html..? please check Code: models. py: from django.db import models REGIONS = ( ('ΘΕΣ', 'ΘΕΣΣΑΛΟΝΙΚΗ'), ('ΣΕΡ', 'ΣΕΡΡΕΣ'), ( 'ΑΘΗ', 'ΑΘΗΝΑ'), TYPEOFBUSINESS = ( ('ΕΣΤ', 'ΕΣΤΙΑ

Exended ASCII and code pages [was Re: for / while else doesn't make sense]

2016-05-25 Thread Steven D'Aprano
On Wednesday 25 May 2016 19:10, Christopher Reimer wrote: > Back in the early 1980's, I grew up on 8-bit processors and latin-1 was all > we had for ASCII. It really, truly wasn't. But you can be forgiven for not knowing that, since until the rise of the public Internet most people weren't expos

Re: for / while else doesn't make sense

2016-05-25 Thread Christopher Reimer
> On May 24, 2016, at 11:38 PM, Gregory Ewing > wrote: > > Christopher Reimer wrote: >> Nope. I meant 8-bit ASCII (0-255). >> http://www.ascii-code.com > > That page is talking about latin-1, which is just one of many > possible 8-bit extensions of ascii. Back in the early 1980's, I grew up o

Re: Question about imports and packages

2016-05-25 Thread Chris Angelico
On Wed, May 25, 2016 at 6:27 PM, Steven D'Aprano wrote: > I don't think this is that much different from the way other scripting > languages handle it. E.g. bash. If I have a set of (say) shell scripts: > > fnord/ > +-- foo.sh > +-- bar.sh > > > where foo.sh runs bar.sh, but fnord is *not* on the

Re: Question about imports and packages

2016-05-25 Thread Steven D'Aprano
On Wednesday 25 May 2016 14:39, Ben Finney wrote: > What the Python import system expects you to do is:: > > cd ../ > python3 -m fnord.foo I don't think you even need to do the cd provided the fnord directory is inside a directory on the path. It only gets complicated if fnord cannot be found b

Re: [smtplib] how to assure login was succesful?

2016-05-25 Thread dieter
maurice writes: > Once my python script reaches the point where I login in my email account > with: server.login(username,password) (where server server = > smtplib.SMTP('smtp.office365.com:587')), it returns a tuple like this: > > (235, > '2.7.0 Authentication successful target host [address h

Extended ASCII [was Re: for / while else doesn't make sense]

2016-05-25 Thread Steven D'Aprano
On Wednesday 25 May 2016 16:38, Gregory Ewing wrote: > Christopher Reimer wrote: >> Nope. I meant 8-bit ASCII (0-255). >> >> http://www.ascii-code.com > > That page is talking about latin-1, which is just one of many > possible 8-bit extensions of ascii. Yes. It even says "There are *several*