Re: Flush stdin

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 4:38 PM, Marko Rauhamaa wrote: > Dan Stromberg : > >> On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa wrote: >>> Nagle affects the communication between the peer OS kernels and isn't >>> directly related to anything the application does. >> >> Actually, Nagle can cause two

Re: Flush stdin

2014-10-21 Thread Marko Rauhamaa
Dan Stromberg : > On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa wrote: >> Nagle affects the communication between the peer OS kernels and isn't >> directly related to anything the application does. > > Actually, Nagle can cause two or more small packets to be merged, > which is something an app

Matplotlib: getting a figure to show without plt.show()

2014-10-21 Thread Peter Pearson
I'm using Matplotlib to present a "control" window with clickable buttons, and to plot things in another window when you click buttons, in the style of the code below. I'm ashamed of the stinky way I use "first" to call plt.show the first time data are plotted but then to call fig.canvas.draw for

Re: Flush stdin

2014-10-21 Thread Dan Stromberg
On Tue, Oct 21, 2014 at 7:49 PM, Nobody wrote: > On Sat, 18 Oct 2014 18:42:00 -0700, Dan Stromberg wrote: > >> On Sat, Oct 18, 2014 at 6:34 PM, Dan Stromberg wrote: Once the "nc" process actually write()s the data to its standard output (i.e. desriptor 1, not the "stdout" FILE*) >>> I'm

Re: Flush stdin

2014-10-21 Thread Nobody
On Sat, 18 Oct 2014 18:42:00 -0700, Dan Stromberg wrote: > On Sat, Oct 18, 2014 at 6:34 PM, Dan Stromberg wrote: >>> Once the "nc" process actually write()s the data to its standard >>> output (i.e. desriptor 1, not the "stdout" FILE*) >> I'm not sure why you're excluding stdout, but even if nc i

Re: When to use assert

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 12:44 PM, Steven D'Aprano wrote: > def do_something(instance_or_id): > instance = Model.get(instance_or_id) > assert isinstance(instance, Model) > # Code that assumes that instance is an object of type Model > > > That means that the logic for what is acceptable

Re: When to use assert

2014-10-21 Thread Steven D'Aprano
Anton wrote: > I use ORM and often need to write a function that either takes an id of > the record or already loaded model object. So I end up writing a piece of > code like below: > > def do_something(instance): > if isinstance(instance_or_id, int): > instance = Model.get(instance)

Re: Flush stdin

2014-10-21 Thread Cameron Simpson
On 21Oct2014 16:16, Dan Stromberg wrote: [...snip...] This is tremendously inefficient. It demands a context switch for every character. Inefficiency isn't an issue when you generate one byte a second. Of course, but who's doing one byte per second? You and I in our tests, and perhaps some

Re: Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Ben Finney
Praveen Kumar writes: > Previously this basic server is executed using *openvt* but I thought > it would be nice to have a daemon process for it and used > python-daemon. An important difference is that a daemon process has no controlling terminal, by definition. > Issue I am facing is after so

Re: Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Dan Stromberg
On Mon, Oct 20, 2014 at 2:16 AM, Praveen Kumar wrote: > I am writing a very basic server side application[0] which get data > from a client and create a virtual machine using provided data and > also tells client about what's going on during *virt-install* command > execution. Previously this basi

Re: Flush stdin

2014-10-21 Thread Dan Stromberg
On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa wrote: > Dan Stromberg : > >> Often with TCP protocols, line buffered is preferred to character >> buffered, > > Terminal devices support line buffering on write. Yes, though that's not the only place it's useful. > Line buffering on read is an ill

Re: No Error; No Output...Nothing

2014-10-21 Thread Mark Lawrence
On 21/10/2014 23:15, ryguy7272 wrote: OK. Thanks everyone! I'm pleased to see that you have answers. In return would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us

Re: No Error; No Output...Nothing

2014-10-21 Thread ryguy7272
On Tuesday, October 21, 2014 5:44:33 PM UTC-4, ryguy7272 wrote: > Hey everyone, I'm trying to run this code. > > > > import os > > import pickle > > #import urllib2 > > from urllib.request import urlopen > > #import cookielib > > import http.cookiejar > > import re > > import time > > im

Re: No Error; No Output...Nothing

2014-10-21 Thread Matthew Ruffalo
On 10/21/2014 05:44 PM, ryguy7272 wrote: > Hey everyone, I'm trying to run this code. > > ... > > I commented out the import pylab as pl because I couldn't get the > matplotlib.pylab import working. So, anyway, I hit F5, and it seems to run, > but it doesn't really do anything. Isn't this eithe

Re: string processing - some problems whenever I have to parse a more complex string

2014-10-21 Thread Terry Reedy
On 10/21/2014 10:32 AM, CWr wrote: Hello together, currently I have to parse a string in an atomic way. Normally - in this case too - I have a counter variable to keep the current position inside the string. So far, I think this is the most flexible solution to do some lookaround's inside th

Re: No Error; No Output...Nothing

2014-10-21 Thread Chris Kaynor
On Tue, Oct 21, 2014 at 2:44 PM, ryguy7272 wrote: > I commented out the import pylab as pl because I couldn't get the > matplotlib.pylab import working. So, anyway, I hit F5, and it seems to > run, but it doesn't really do anything. Isn't this either supposed to be > downloading data from the w

Re: No Error; No Output...Nothing

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 8:44 AM, ryguy7272 wrote: > So, anyway, I hit F5, and it seems to run, but it doesn't really do anything. It defines a few functions, but nothing ever calls them, so you won't see much out of it :) Try adding some code at the bottom that actually calls one of your function

No Error; No Output...Nothing

2014-10-21 Thread ryguy7272
Hey everyone, I'm trying to run this code. import os import pickle #import urllib2 from urllib.request import urlopen #import cookielib import http.cookiejar import re import time import numpy as np #import pylab as pl # symbol - USDEUR=X - problem that the server sometimes returns 0.0 def getSp

Re: Problem with Android Build

2014-10-21 Thread Cyd Haselton
On Tue, Oct 21, 2014 at 12:36 PM, Chris Angelico wrote: > On Wed, Oct 22, 2014 at 2:32 AM, Cyd Haselton wrote: >> Hello, >> If I have a problem with building Python on an Android device, would >> this be the list to post it to, or should I post it to python-help or >> python-dev? > > Hi! > > Star

Re: string processing - some problems whenever I have to parse a more complex string

2014-10-21 Thread Ned Batchelder
On 10/21/14 10:32 AM, CWr wrote: Is there any implementation like C++ StringPiece class? Or something like the following behavior: >>>s = StringSlice('abcdef') >>>s StringSlice('abcdef') at xxx >>>s[0] 'a' >>>s.chop(1) # chop the first item >>>s[0] # 'b' is the new first item 'b' >>>s[:

Pex import problems

2014-10-21 Thread Sam Raker
Hi all, I'm trying to use Pex (http://pex.readthedocs.org/en/latest/index.html) to include requests in a little script to ping a server from a machine that doesn't come with pip (or much of anything, really) installed. I'm running into problems outputting a pex file that depends on a local script.

Re: Problem with Android Build

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 2:32 AM, Cyd Haselton wrote: > Hello, > If I have a problem with building Python on an Android device, would > this be the list to post it to, or should I post it to python-help or > python-dev? Hi! Start here. If we can't help, python-dev might be the next place to ask,

Problem with Android Build

2014-10-21 Thread Cyd Haselton
Hello, If I have a problem with building Python on an Android device, would this be the list to post it to, or should I post it to python-help or python-dev? Thanks! Cyd -- https://mail.python.org/mailman/listinfo/python-list

Re: PyPy3 2.4.0 released

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 4:03 AM, Philip Jenvey wrote: > PyPy3 2.4 - Snow White Interesting choice of name. I flipped through some of the release pages for previous versions and couldn't see a pattern to the names; is there a list somewhere of the code names and why they were selected? I'm sure th

Re: Is there an easy way to control indents in Python

2014-10-21 Thread Ian Kelly
On Tue, Oct 21, 2014 at 2:45 AM, Simon Kennedy wrote: > On Monday, 20 October 2014 18:56:05 UTC+1, Ian wrote: >> Rather, I'm saying that where the blank line is should be the start of >> a new function. There would still be a blank line, just no longer >> inside the function. >> >> Now, maybe you

PyPy3 2.4.0 released

2014-10-21 Thread Philip Jenvey
= PyPy3 2.4 - Snow White = We're pleased to announce PyPy3 2.4, which contains significant performance enhancements and bug fixes. You can download the PyPy3 2.4.0 release here: http://pypy.org/do

Re: Pex import problems

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 3:36 AM, Sam Raker wrote: >> That's because that isn't the mailing list's name. Sign up here: > >> https://mail.python.org/mailman/listinfo/python-list > >> ChrisA > > Thank you for your help. No probs. Sorry I can't help with your main issue, as I'm not at all familiar wi

Re: Pex import problems

2014-10-21 Thread Sam Raker
On Tuesday, October 21, 2014 12:05:00 PM UTC-4, Chris Angelico wrote: > On Wed, Oct 22, 2014 at 2:34 AM, Sam Raker wrote: > > > (Also: anyone who's planning on chewing me out about formatting: I TRIED > > posting by email to comp.lang.pyt...@googlegroups.com, but it wouldn't let > > me. Sorry f

Re: Pex import problems

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 2:34 AM, Sam Raker wrote: > (Also: anyone who's planning on chewing me out about formatting: I TRIED > posting by email to comp.lang.pyt...@googlegroups.com, but it wouldn't let > me. Sorry for the extra whitespace.) That's because that isn't the mailing list's name. Sig

Pex import problems

2014-10-21 Thread Sam Raker
Hi all, I'm trying to use Pex (http://pex.readthedocs.org/en/latest/index.html) to include requests in a little script to ping a server from a machine that doesn't come with pip (or much of anything, really) installed. I'm running into problems outputting a pex file that depends on a local scrip

string processing - some problems whenever I have to parse a more complex string

2014-10-21 Thread CWr
Hello together, currently I have to parse a string in an atomic way. Normally - in this case too - I have a counter variable to keep the current position inside the string. So far, I think this is the most flexible solution to do some lookaround's inside the string if necessary. Subroutines wi

Re: Is there an easy way to control indents in Python

2014-10-21 Thread jumppanen . jussi
On Wednesday, October 15, 2014 12:13:51 PM UTC+10, ryguy7272 wrote: > I'm just learning Python. One of the best ways to learn any language is to type in the example code by hand. As you type in the code you will make mistakes, you will learn from your mistakes and that will help you learn the l

Re: Py2App - Could not import Tkinter error from resulting app

2014-10-21 Thread Skip Montanaro
On Tue, Oct 21, 2014 at 8:20 AM, Noble Bell wrote: > I realized this problem shortly after I posted the question and tried to > go back to google groups and delete my post before anyone had seen it. In general, that won't work, as lots of people use email ( python-list@python.org) or Usenet (co

Re: Py2App - Could not import Tkinter error from resulting app

2014-10-21 Thread Noble Bell
On Monday, October 20, 2014 11:07:51 PM UTC-5, Terry Reedy wrote: > tkinter imports _tkinter > > _tkinter connects with tclx.dll and tkx.dll (x is variable) > > So one possibility is no accessible tcl/tx. I have no idea how py2app > > is supposed to handle this on your undisclosed system. >

Re: Building lists

2014-10-21 Thread Seymore4Head
On Mon, 20 Oct 2014 21:31:05 -0400, Dennis Lee Bieber wrote: >On Mon, 20 Oct 2014 17:25:31 -0400, Seymore4Head > declaimed the following: > > >> >>The thing is I am not really sure what I want. I do know I need more >>practice to find out. Since I am taking a course now, I can't really >>ask a

Re: Building lists

2014-10-21 Thread Seymore4Head
On Tue, 21 Oct 2014 00:40:06 -0700, Larry Hudson wrote: >On 10/20/2014 12:49 PM, Seymore4Head wrote: >> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB >> wrote: >> > > >> Do you have to know the number of items the list will have before >> making it? >> > >No. Lists are NOT the same as arrays i

Re: Building lists

2014-10-21 Thread Seymore4Head
On Tue, 21 Oct 2014 00:11:38 -0700, Larry Hudson wrote: >On 10/20/2014 12:49 PM, Seymore4Head wrote: >> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB >> wrote: > > > >> Do you have to know the number of items the list will have before >> making it? >> > >No, it is not necessary, lists are NOT the sam

Re: real-life example LC_CTYPE effects?

2014-10-21 Thread random832
On Mon, Oct 20, 2014, at 16:33, Albert-Jan Roskam wrote: > Hi, > > The locale category LC_CTYPE may affect character classification and case > conversion. > > That's the theory. Can you give a practical example where this locale > setting matters? Eg.: > locale.setlocale(locale.LC_CTYPE, loc) > m

Re: OS X Menubar in Tkinter

2014-10-21 Thread Noble Bell
On Tuesday, October 21, 2014 12:59:08 AM UTC-5, Mark Lawrence wrote: > On 21/10/2014 02:34, Noble Bell wrote: > I'm pleased to see that you have an answer. In return would you please > > access this list via > > https://mail.python.org/mailman/listinfo/python-list or read and action > > th

Re: Is there an easy way to control indents in Python

2014-10-21 Thread Simon Kennedy
On Monday, 20 October 2014 18:56:05 UTC+1, Ian wrote: > Rather, I'm saying that where the blank line is should be the start of > a new function. There would still be a blank line, just no longer > inside the function. > > Now, maybe you think there should be more blank lines in the above, in > wh

Re: When to use assert

2014-10-21 Thread Anton
On Saturday, November 16, 2013 11:35:50 PM UTC-8, Steven D'Aprano wrote: > The question of when to use the assert statement comes up occasionally, > > usually in response to somebody misusing it, so I thought I'd write a > > post describing when and why to use assertions, and when not to. > >

Re: Building lists

2014-10-21 Thread Larry Hudson
On 10/20/2014 12:49 PM, Seymore4Head wrote: On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote: Do you have to know the number of items the list will have before making it? No. Lists are NOT the same as arrays in other languages. But it IS possible to create an initial list of a spec

Re: Building lists

2014-10-21 Thread Larry Hudson
On 10/20/2014 12:49 PM, Seymore4Head wrote: On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote: Do you have to know the number of items the list will have before making it? No, it is not necessary, lists are NOT the same as arrays in other languages. But it IS possible to create an initial

real-life example LC_CTYPE effects?

2014-10-21 Thread Albert-Jan Roskam
Hi, The locale category LC_CTYPE may affect character classification and case conversion. That's the theory. Can you give a practical example where this locale setting matters? Eg.: locale.setlocale(locale.LC_CTYPE, loc) m = re.match("\d+", s, re.I | re.L) So with two different values for loc

Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Praveen Kumar
Hi, I am writing a very basic server side application[0] which get data from a client and create a virtual machine using provided data and also tells client about what's going on during *virt-install* command execution. Previously this basic server is executed using *openvt* but I thought it would