Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
Dear Python and Numpy Users:

My data are in the form of '32-bit unsigned integer' as follows:

myData = np.array([1073741824, 1073741877, 1073742657, 1073742709,
1073742723, 1073755137, 1073755189,1073755969],dtype=np.int32)

I want to get the index of my data where the following occurs:

Bit No. 0–1
Bit Combination: 00

How can I do it? I heard this type of problem first time, please help me.

Artur
-- 
https://mail.python.org/mailman/listinfo/python-list


Flush stdin

2014-10-18 Thread Empty Account
Hi,

I am using netcat to listen to a port and python to read stdin and print to
the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin, so I am using the termios
module.

while True:
   input = sys.stdin.readline()
   # do some parsing
   …
   sys.stdout.write(parsed_data)
   time.sleep(3)
   termios.tcflush(sys.stdin, termios.TCIOFLUSH)


I am receiving this exception
termios.error: (25, 'Inappropriate ioctl for device')


I will be using this script on Unix based systems and I wondered what
approach I could use
to flush stdin?

Many Thanks

Aidy
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 4:58 PM, Artur Bercik vbubbl...@gmail.com wrote:
 I want to get the index of my data where the following occurs:

 Bit No. 0–1
 Bit Combination: 00

So, what you want to do is look at each number in binary, and find the
ones that have two zeroes in the last two places?
1073741824: 100
1073741877: 1110101

The easiest way to do this is with simple bitwise operations:

 1073741824  3
0
 1073741877  3
1

3 is 0011 in binary, so a bitwise AND with that will tell
you about just the last two bits. The result will be an integer - 0,
1, 2, or 3, representing 00, 01, 10, or 11 for those last two bits. So
all you have to do is AND each number with 3, and when the result is
0, that's what you want.

Does that make sense?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Chris Angelico
On Fri, Oct 17, 2014 at 10:38 PM, Empty Account empty...@gmail.com wrote:
 I will be using this script on Unix based systems and I wondered what
 approach I could use
 to flush stdin?

Why exactly do you need to flush stdin? If you've written a small
amount of data to the console, it's stdout that you need to flush.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 5:42 PM, Artur Bercik vbubbl...@gmail.com wrote:
 I got some sense, but could not imagine if required Bit No. 2–5, and  Bit
 Combination .

 I hope example with the new case would make me more sense.


Just write the number in binary, with the bits you're interested in
set to 1, and everything else 0:

... 876543210
... 00000

 0b00000
60
 1073741877  0b00000
52

So this number does _not_ have all zeroes there. If it did, the result
would be zero. To look for some other pattern, just do the same thing
- suppose we want to find numbers where it's 1001, we just look for
the result to be 0b000100100, or 36.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [OT] spelling colour / color was Re: Toggle

2014-10-18 Thread giacomo boffi
duncan smith buzzard@invalid.invalid writes:

 [...] It was the top / bottom of the [TV] programme that I didn't
 immediately get, because I was thinking of a timeline running left
 to right (perhaps rather than the script used by the presenters).

is it just me that thinks of a timeline running from the wall behind
the tv set into my dinette?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Cameron Simpson

On 17Oct2014 12:38, Empty Account empty...@gmail.com wrote:

I am using netcat to listen to a port and python to read stdin and print to
the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin, so I am using the termios
module. 


You're aware that a stdio flush and a termios flush operate on two totally 
unrelated buffers?



while True: 
   input = sys.stdin.readline()
   # do some parsing 
   …  
   sys.stdout.write(parsed_data)
   time.sleep(3)
   termios.tcflush(sys.stdin, termios.TCIOFLUSH)

I am receiving this exception
termios.error: (25, 'Inappropriate ioctl for device')


That is because stdin is attached to the pipe from netcat. A pipe is not a 
terminal.



I will be using this script on Unix based systems and I wondered what
approach I could use 
to flush stdin?


Like Chris, I think you need to explain why you even want to flush stdin.  
There's probably something better you can do.


Cheers,
Cameron Simpson c...@zip.com.au

I strongly suspect so.  Practically everyone on sci.physics has a theory that
is far superior to special relativity, general relativity, quantum mechanics
*and* the standard model.  Around here, it's only a small clique of arrogant
young members of the physics establishment who fail to recognize these
revolutionary theories.  I'd explain why, but I have to go finish designing
my faster-than-light vacuum energy perpetual motion telekinetic
aether-powered time machine.- John Baez
--
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik vbubbl...@gmail.com wrote:
 So, the  Bit No. 2-5 for the following case is '1101', right?

 1073741877: 1110101

  If my required bit combination for Bit No. 2-5 is '1011', then the above
 number (1073741877) is not chosen, right??

 Look forward to know your confirmation.

(Side point: Please don't top-post. The convention on this mailing
list, and most other technical mailing lists, is what's sometimes
called interleaved style; you trim the quoted text to what's needed
for context, and put your text underneath what you're referring to.
See https://en.wikipedia.org/wiki/Posting_style#Interleaved_style for
more info.)

 107374187760
52
 bin(52)
'0b110100'

Everything I've written with the triple-angle-bracket marker can be
typed in at the Python prompt, and you'll see exactly what it does. In
this case, you can see that you're absolutely right: 1073741877 has
1101 in those positions, so if you're looking for 1011, it won't
match:

 0b101100
44

However, 1073741869 would:

 107374186960
44

The way to test would be something like this:

 (1073741877  0b00) == 0b101100
False
 (1073741869  0b00) == 0b101100
True

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 6:21 PM, Artur Bercik vbubbl...@gmail.com wrote:
 Thank you very much Chris Angelico, I have come to know it.


You're most welcome. And thank you for taking heed of the request to
not top-post. :) Hang around, you never know what weird and wonderful
things you'll learn!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
So, the  Bit No. 2-5 for the following case is '1101', right?

1073741877: 1110101

 If my required bit combination for Bit No. 2-5 is '1011', then the above
number (1073741877) is not chosen, right??

Look forward to know your confirmation.

On Sat, Oct 18, 2014 at 3:50 PM, Chris Angelico ros...@gmail.com wrote:

 On Sat, Oct 18, 2014 at 5:42 PM, Artur Bercik vbubbl...@gmail.com wrote:
  I got some sense, but could not imagine if required Bit No. 2–5, and  Bit
  Combination .
 
  I hope example with the new case would make me more sense.
 

 Just write the number in binary, with the bits you're interested in
 set to 1, and everything else 0:

 ... 876543210
 ... 00000

  0b00000
 60
  1073741877  0b00000
 52

 So this number does _not_ have all zeroes there. If it did, the result
 would be zero. To look for some other pattern, just do the same thing
 - suppose we want to find numbers where it's 1001, we just look for
 the result to be 0b000100100, or 36.

 ChrisA
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
Thanks Chris Angelico for your nice answer.
I got some sense, but could not imagine if required Bit No. 2–5, and  Bit
Combination .

I hope example with the new case would make me more sense.

Artur



On Sat, Oct 18, 2014 at 3:24 PM, Chris Angelico ros...@gmail.com wrote:

 On Sat, Oct 18, 2014 at 4:58 PM, Artur Bercik vbubbl...@gmail.com wrote:
  I want to get the index of my data where the following occurs:
 
  Bit No. 0–1
  Bit Combination: 00

 So, what you want to do is look at each number in binary, and find the
 ones that have two zeroes in the last two places?
 1073741824: 100
 1073741877: 1110101

 The easiest way to do this is with simple bitwise operations:

  1073741824  3
 0
  1073741877  3
 1

 3 is 0011 in binary, so a bitwise AND with that will tell
 you about just the last two bits. The result will be an integer - 0,
 1, 2, or 3, representing 00, 01, 10, or 11 for those last two bits. So
 all you have to do is AND each number with 3, and when the result is
 0, that's what you want.

 Does that make sense?

 ChrisA
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
On Sat, Oct 18, 2014 at 4:10 PM, Chris Angelico ros...@gmail.com wrote:

 On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik vbubbl...@gmail.com wrote:
  So, the  Bit No. 2-5 for the following case is '1101', right?
 
  1073741877: 1110101
 
   If my required bit combination for Bit No. 2-5 is '1011', then the above
  number (1073741877) is not chosen, right??
 
  Look forward to know your confirmation.

 (Side point: Please don't top-post. The convention on this mailing
 list, and most other technical mailing lists, is what's sometimes
 called interleaved style; you trim the quoted text to what's needed
 for context, and put your text underneath what you're referring to.
 See https://en.wikipedia.org/wiki/Posting_style#Interleaved_style for
 more info.)

  107374187760
 52
  bin(52)
 '0b110100'

 Everything I've written with the triple-angle-bracket marker can be
 typed in at the Python prompt, and you'll see exactly what it does. In
 this case, you can see that you're absolutely right: 1073741877 has
 1101 in those positions, so if you're looking for 1011, it won't
 match:

  0b101100
 44

 However, 1073741869 would:

  107374186960
 44

 The way to test would be something like this:

  (1073741877  0b00) == 0b101100
 False
  (1073741869  0b00) == 0b101100
 True


Thank you very much Chris Angelico, I have come to know it.






 ChrisA
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Sqlite3 help

2014-10-18 Thread Sibylle Koczian

Am 14.10.2014 15:36, schrieb Chuck:

I am building a simple podcast program where I download all the data from a 
feed with feedparser and store the data in sqlite3.  I am spanking new to 
sqlite and database programming.  Should I create the database in the __init__ 
method of my class, or is that a bad idea.  I haven't done any designing that 
included databases.

Thanks!
Chuck

When I first answered this question, I sent the answer erroneously to 
the OP and not to the list. So here it is again.


On Tue, Oct 14, 2014 at 1:19 PM, Sibylle Koczian wrote:

 As I don't know anything at all about podcasts and feeds, I'll just
 answer your question about creating the database in the __init__
 method of your class:

 That would destroy the existing database and create a new one without
 any data. If you don't want to keep data from former runs of your
 application, this wouldn't be necessary, because you could just
 delete the data and keep the database. But most probably you want to
 keep your data and add to it. In this case, you certainly don't want
 to create a new database.

 The __init__ method of your class might be the right place to open
 the database, though.

 You know that the documentation for the sqlite3 module is part of the
 Python documentation? It contains links to the SQLite web page and to
 a website with beginner information about SQL itself. So that should
 help to get you started.

Am 15.10.2014 18:51, schrieb Chuck Johnson:

 I was thinking that I could fix that by using ' ' ' CREATE TABLE IF
 NOT EXISTS ' ' '   Should I make the sqlite3.connect() command a
 global variable?  I am not sure about how to design this properly.

That should work. I wouldn't make the connection a global variable. Use 
it as a parameter for every function that needs it. Roughly like this:


import sqlite3
# other imports as needed

def one_of_my_functions(myconn, my_other_parameters):
mycurs = myconn.cursor()
try:
# do things with mycurs and my_other_parameters
finally:
mycurs.close()
myconn.commit()

# more of the same ...

def main():
conn = sqlite3.connect('path/to/my/database')
try:
one_of_my_functions(conn, params)
# more of the same
finally:
conn.close()

if __name__ == __main__:
main()


Or, if your program gets bigger, you might start and stop a connection 
inside a function instead of keeping one connection open for all of the 
application.


HTH
Sibylle




--
https://mail.python.org/mailman/listinfo/python-list


pyserial on freebsd 10.10 i386

2014-10-18 Thread Nagy László Zsolt


I'm trying to open a serial port with pyserial on a Compaq Deskpro EN 
machine. Operating system is FreeBSD 10.10 RELEASE, i386.


root@merleg:~ # kldload scc
root@merleg:~ # python2.7 -m serial.tools.list_ports
no ports found
root@merleg:~ # whoami
root


Here are all the devices:

root@merleg:~ # ls /dev

acpicttyklogstdin   ttyva
ad0 cuau0   kmemstdout  ttyvb
ad0p1   cuau0.init  log sysmousettyvc
ad0p2   cuau0.lock  lpt0ttyu0   ttyvd
ad0p3   cuau1   lpt0.ctlttyu0.init  ttyve
ada0cuau1.init  mdctl   ttyu0.lock  ttyvf
ada0p1  cuau1.lock  mem ttyu1   ufssuspend
ada0p2  devctl  midistatttyu1.init  ugen0.1
ada0p3  devstat mixer0  ttyu1.lock  ugen0.2
agpgart fd  nfslock ttyv0   uhid0
apm fd0 nullttyv1   ukbd0
apmctl  fidopass0   ttyv2   urandom
atkbd0  geom.ctlpass1   ttyv3   usb
audit   gptid   pci ttyv4   usbctl
bpf io  ppi0ttyv5   xpt0
bpf0kbd0pts ttyv6   zero
cd0 kbd1random  ttyv7
console kbd2sndstat ttyv8
consolectl  kbdmux0 stderr  ttyv9


And here is what I see in dmesg:

root@merleg:~ # dmesg | grep uart

uart0: 16550 or compatible port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0

uart1: 16550 or compatible port 0x2f8-0x2ff irq 3 on acpi0

Obviously the question is: how do I open the COM port from pyserial on 
this machine?




--
https://mail.python.org/mailman/listinfo/python-list


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

2014-10-18 Thread Steven D'Aprano
Simon Kennedy wrote:

 On Wednesday, 15 October 2014 20:31:15 UTC+1, Ian  wrote:
 I agree. I very rarely use blank lines inside functions. As I see it,
 if you feel you need a blank line for separation within a function,
 that's an indication your function is overly complex and should be
 broken up.
 
 Whereas I feel that if I wanted to write code which looked like that I'd
 have learnt/learned Perl ;-)

I'm curious what aspect of idiomatic Perl code you are referring to. When
people talk about Perl code dismissively, I normally think of three things:

- excessively long one-liners;
- excessive use of symbols and sigils (line noise);
- More Than One [Thousand] Ways To Do It

Are you suggesting that Perl functions tend to be too small? What do you
consider too small?


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: your mail

2014-10-18 Thread Alain Ketterlin
Terry Reedy tjre...@udel.edu writes:

 On 10/17/2014 6:43 AM, Cameron Simpson wrote:
 On 17Oct2014 11:45, Dhananjay dhananjay.c.jo...@gmail.com wrote:

 2.1576318858 -1.8651195165 4.2333428278
 ...
 (total of 200 lines)

 Columns 1,2,3 corresponds to x,y,z axis data points.

for line in open('flooding-psiphi.dat','r'):
line = line.split()
xs.append(float(line[0]))
ys.append(float(line[1]))
zs.append(float(line[2]))

 A further refinement:
for line in open('flooding-psiphi.dat','r'):
x, y, z = map(float, line.split())
xs.append(x)
ys.append(y)
zs.append(z)

Or even:

xs,ys,zs = zip(*[ map(float,line.split())
  for line in open('flooding-psiphi.dat','r') ])

You get tuples, though. Use map(list,zip(...)) if you need lists. Easy
to update when you move to 4D data...

-- Alain.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyserial on freebsd 10.10 i386 [SOLVED]

2014-10-18 Thread Nagy László Zsolt
The port parameter of serial.Serial should be /dev/ttyu0 instead of 
COM1, and /dev/ttyu1 instead of COM2.


Strangely, pyserial will accept the number 0, but then it tries to open 
a device that exists on Linux only...


Anyway, problem solved.
--
https://mail.python.org/mailman/listinfo/python-list


Re: your mail

2014-10-18 Thread Peter Otten
Alain Ketterlin wrote:

 Terry Reedy tjre...@udel.edu writes:
 
 On 10/17/2014 6:43 AM, Cameron Simpson wrote:
 On 17Oct2014 11:45, Dhananjay dhananjay.c.jo...@gmail.com wrote:

 2.1576318858 -1.8651195165 4.2333428278
 ...
 (total of 200 lines)

 Columns 1,2,3 corresponds to x,y,z axis data points.

for line in open('flooding-psiphi.dat','r'):
line = line.split()
xs.append(float(line[0]))
ys.append(float(line[1]))
zs.append(float(line[2]))

 A further refinement:
for line in open('flooding-psiphi.dat','r'):
x, y, z = map(float, line.split())
xs.append(x)
ys.append(y)
zs.append(z)
 
 Or even:
 
 xs,ys,zs = zip(*[ map(float,line.split())
   for line in open('flooding-psiphi.dat','r') ])
 
 You get tuples, though. Use map(list,zip(...)) if you need lists. Easy
 to update when you move to 4D data...

Given the context (the script uses numpy) there is another option:

xs, ys, zs = numpy.loadtxt('flooding-psiphi.dat').T

There may also be a way to feed the array to matplotlib without breaking it 
into the three columns...

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Nobody
On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:

 I am using netcat to listen to a port and python to read stdin and print
 to the console.
 
 nc -l 2003 | python print_metrics.py
 
 sys.stdin.flush() doesn’t seem to flush stdin,

You can't flush an input stream.

 so I am using the termios module.

 I am receiving this exception
 termios.error: (25, 'Inappropriate ioctl for device')

termios only works on terminals, not pipes.

It's a safe bet that your problem is that nc isn't flushing its stdout
after each line (this is the default behaviour for stdio streams which
don't correspond to a terminal).

Check whether nc has a flag to line-buffer its output. If it doesn't,
the simplest solution is probably to write a Python script which creates a
pseudo-tty (using the pty module) and executes nc with its stdout
associated with the pty.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Tim Chase
On 2014-10-18 17:55, Nobody wrote:
 On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:
 
  I am using netcat to listen to a port and python to read stdin
  and print to the console.
  
  nc -l 2003 | python print_metrics.py
  
  sys.stdin.flush() doesn’t seem to flush stdin,
 
 You can't flush an input stream.

You can't flush it, but you can make it unbuffered.  You can either
force python to use unbuffered stdio:

  python -u myfile.py

or you can get an unbuffered handle to the file

 import os, sys
 buffer_size = 1
 new_stdin = os.fdopen(sys.stdin.fileno(), 'r', buffer_size)
 for c in new_stdin:
   do_something(c)

though based on my reading, the first method works with both Py2
and Py3k while the second method doesn't reliably work in Py3k.

-tkc




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread MRAB

On 2014-10-18 17:55, Nobody wrote:

On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:


I am using netcat to listen to a port and python to read stdin and print
to the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin,


You can't flush an input stream.


[snip]

Flushing an input stream means (or could mean) discarding any data
that's currently in the buffer.

--
https://mail.python.org/mailman/listinfo/python-list


Quick Question About Setting Up Pytz

2014-10-18 Thread ryguy7272
I downloaded PYTZ and put it here.
C:\Python27\pytz

Now, in the cmd window, I typed this:
C:\Python27\pytz\setup.py

A text file opens and nothing else happens.  I thought it was supposed to 
install the PYTZ library.  

What am I doing wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Joel Goldstick
On Sat, Oct 18, 2014 at 3:54 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I downloaded PYTZ and put it here.
 C:\Python27\pytz

 Now, in the cmd window, I typed this:
 C:\Python27\pytz\setup.py

 A text file opens and nothing else happens.  I thought it was supposed to 
 install the PYTZ library.

 What am I doing wrong?
 --
 https://mail.python.org/mailman/listinfo/python-list

have you tried:

python c:\Python27/pytz/setup.py




-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Question about PANDAS

2014-10-18 Thread ryguy7272
I'm trying to install Pandas.  I went to this link.
https://pypi.python.org/pypi/pandas/0.14.1/#downloads

I downloaded this:  pandas-0.14.1.win32-py2.7.exe (md5) 
I have Python27 installed.

So, I run the executable and re-run my Python script and I get the same error 
as before.


Traceback (most recent call last):
  File C:/Python27/stock_data.py, line 3, in module
import pandas as pd
ImportError: No module named pandas

I thought I just installed it!  Isn't that what the executable is for?  It 
seems like 100% of my errors are with uninstalled libraries.  I don't 
understand why there are so, so, so many dependencies running Python.  Also, I 
don't understand why something isn't installed, right after I just installed 
it.  

Can someone please explain the logic to me?

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Mark Lawrence

On 18/10/2014 20:54, ryguy7272 wrote:

I downloaded PYTZ and put it here.
C:\Python27\pytz

Now, in the cmd window, I typed this:
C:\Python27\pytz\setup.py

A text file opens and nothing else happens.  I thought it was supposed to 
install the PYTZ library.

What am I doing wrong?



You will end up confusing yourself very quickly if you insist on placing 
files in c:\Python27.  Please put them anywhere except that spot, say in 
downloads or on the desktop.  Let's assume your desktop is here 
c:\Users\ryguy7272\Desktop.  Open a cmd window then


cd c:\Users\ryguy7272\Desktop
setup.py install

should work if and only if you have the file types and file associations 
correctly set, please see 
https://docs.python.org/2/using/windows.html#executing-scripts


Better still take the hard work out of it by getting pip by following 
the instructions here http://pip.readthedocs.org/en/latest/installing.html


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Cameron Simpson

On 18Oct2014 17:55, Nobody nobody@nowhere.invalid wrote:

On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:

I am using netcat to listen to a port and python to read stdin and print
to the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin,


You can't flush an input stream.


Sure you can. Most streams are read through an API which buffers. That buffer 
can be discarded.


I'm not sure it is what the OP needs, but it is not a nonsensical idea.

Cheers,
Cameron Simpson c...@zip.com.au

I've seen things you people wouldn't believe.  Attack ships on fire off the
shoulder of Orion. I've watched C-beams glitter in the dark near the
Tannhauser Gate.  All these memories will be lost in time, like tears in rain.
- Roy Baty, _Blade Runner_
--
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Terry Reedy

On 10/18/2014 5:01 PM, Cameron Simpson wrote:

On 18Oct2014 17:55, Nobody nobody@nowhere.invalid wrote:

On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:

I am using netcat to listen to a port and python to read stdin and print
to the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin,


You can't flush an input stream.



Sure you can.


You are collectively confusing three different meaning of 'flush'. 
Python and its docs are the best authority on what python can and cannot 
do.  One can call .flush() on an imput stream (meaning 1).


 import sys
 sys.stdin.flush()


However, one cannot empty the steam buffer by calling .flush() 
(meaning 2).


 class IOBase
...
flush()
Flush the write buffers of the stream if applicable. This does 
nothing for read-only and non-blocking streams.



Most streams are read through an API which buffers. That
buffer can be discarded.


But one can empty and discard the buffer (meaning 3) with
stream.read()

And, of course, an 'input stream' 'down here' is an 'output stream' 'up 
there, where ever' and one can 'flush' pending output into the stream so 
that it can be read here.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Nobody
On Sat, 18 Oct 2014 12:32:07 -0500, Tim Chase wrote:

 On 2014-10-18 17:55, Nobody wrote:
 On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:
 
  I am using netcat to listen to a port and python to read stdin and
  print to the console.
  
  nc -l 2003 | python print_metrics.py
  
  sys.stdin.flush() doesn’t seem to flush stdin,
 
 You can't flush an input stream.
 
 You can't flush it, but you can make it unbuffered.  You can either force
 python to use unbuffered stdio:

[snipped]

None of this helps in any way, as it's not the behaviour of the Python
script which is causing the problem, but that nc is (probably) buffering
its output, so the data isn't passed to the OS (let alone to the Python
script) in a timely manner.

Once the nc process actually write()s the data to its standard
output (i.e. desriptor 1, not the stdout FILE*), it will be available to
the Python script immediately thereafter without requiring any low-level
tweaks.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Chris Angelico
On Fri, Oct 17, 2014 at 10:38 PM, Empty Account empty...@gmail.com wrote:
 I am using netcat to listen to a port and python to read stdin and print to
 the console.

 nc -l 2003 | python print_metrics.py

After lengthy discussion about what it means to flush stdin, I think
it's high time someone asked the question: Why not skip nc altogether,
and have your Python program do its own socket work? Then you don't
have to worry about stream flushing at all.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Dan Stromberg
On Sat, Oct 18, 2014 at 6:11 PM, Nobody nobody@nowhere.invalid wrote:
 On Sat, 18 Oct 2014 12:32:07 -0500, Tim Chase wrote:

 On 2014-10-18 17:55, Nobody wrote:
 On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote:

  I am using netcat to listen to a port and python to read stdin and
  print to the console.
 
  nc -l 2003 | python print_metrics.py
 
  sys.stdin.flush() doesn’t seem to flush stdin,

 You can't flush an input stream.

 You can't flush it, but you can make it unbuffered.  You can either force
 python to use unbuffered stdio:

 [snipped]

 None of this helps in any way, as it's not the behaviour of the Python
 script which is causing the problem, but that nc is (probably) buffering
 its output, so the data isn't passed to the OS (let alone to the Python
 script) in a timely manner.

Agreed.

 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 is using
filedes 1 instead of FILE * stdout, isn't it kind of irrelevant?

 it will be available to
 the Python script immediately thereafter without requiring any low-level
 tweaks.
Which, on a pipe, generally means either the buffer filled and needed
to be passed along to make room, or the process exited.

I'd probably rewrite just enough nc in Python to make it so you don't
need to depend on a pipe (example:
http://stromberg.dnsalias.org/~strombrg/pnetcat.html), but if you're
on *ix you could try
http://ftp.sunet.se/pub/usenet/ftp.uu.net/comp.sources.unix/volume23/pty/
in an effort to persuade nc to think that it's on a tty and hence
should output line buffered data instead of block buffered - despite
being on a pipe in reality.

HTH.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flush stdin

2014-10-18 Thread Dan Stromberg
On Sat, Oct 18, 2014 at 6:34 PM, Dan Stromberg drsali...@gmail.com 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 is using
 filedes 1 instead of FILE * stdout, isn't it kind of irrelevant?

On further reflection, isn't it stdio that does the varied buffering,
and filedes 1 that's always unbuffered?  IOW, the OP might wish nc was
using 1, but it probably can't be given what they're seeing.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread ryguy7272
On Saturday, October 18, 2014 3:55:02 PM UTC-4, ryguy7272 wrote:
 I downloaded PYTZ and put it here.
 
 C:\Python27\pytz
 
 
 
 Now, in the cmd window, I typed this:
 
 C:\Python27\pytz\setup.py
 
 
 
 A text file opens and nothing else happens.  I thought it was supposed to 
 install the PYTZ library.  
 
 
 
 What am I doing wrong?


Thanks Mark. That makes sense.  I moved the folder to the desktop and I just 
tried that:
C:\Users\Ryan\Desktop\pytzsetup.py install

So, when I run it, the setup.py text file opens.  Nothing runs; nothing 
installs.  This makes no sense whatsoever.  If I tell a program to install 
something, it should install something.  It should not pop open a text file.  

I'll probably give it until the end of the year, and start learning Chinese.  
There's other things I want to do with my time.  I know 10 programming 
languages.  I thought it would be fun to learn Python, but after 2 months, I 
still can't run a single line of code.  This language makes no sense 
whatsoever, and it never does anything that you tell it to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Chris Angelico
On Sun, Oct 19, 2014 at 1:44 PM, ryguy7272 ryanshu...@gmail.com wrote:
 I'll probably give it until the end of the year, and start learning Chinese.  
 There's other things I want to do with my time.  I know 10 programming 
 languages.  I thought it would be fun to learn Python, but after 2 months, I 
 still can't run a single line of code.  This language makes no sense 
 whatsoever, and it never does anything that you tell it to do.


Try learning Python itself, rather than playing around with extension
packages like pytz. You're having trouble installing add-ons - that's
like saying Computers are total rubbish, I bought this fancy new ISA
card and I can't make it work!. Start with what you have, and worry
about the extra complexities later.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Ben Finney
ryguy7272 ryanshu...@gmail.com writes:

 So, when I run it, the setup.py text file opens. Nothing runs; nothing
 installs.

You have somehow (either manually, or by answering a question to some
program) associated the ‘.py’ suffix with “Open this file in my text
editor”.

That's fine, but it means that if you don't want to edit the file but
instead want to execute it, you need to *explicitly* start Python:

python /whatever/path/to/setup.py install

 This makes no sense whatsoever.

This is an issue with your operating system, so I would hope you can
learn more about that to distinguish what is causing your frustration
:-)

-- 
 \  “I got an answering machine for my phone. Now when someone |
  `\  calls me up and I'm not home, they get a recording of a busy |
_o__)  signal.” —Steven Wright |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Ben Finney
Chris Angelico ros...@gmail.com writes:

 Try learning Python itself, rather than playing around with extension
 packages like pytz.

To be fair, “You need to install ‘pytz’ to work correctly with date and
time values” is correct advice. If the OP doesn't install it early, then
works with timestamps, problems are inevitable — at which point “oh, you
needed to do that first” will be inevitable. It's lose–lose.

It's a sad fact that MS Windows has completely useless timezone support,
and this “install a third-party package” hurdle is a cost that is paid
by all people trying to set up Python on MS Windows.

-- 
 \  “Nothing is more sacred than the facts.” —Sam Harris, _The End |
  `\   of Faith_, 2004 |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Chris Angelico
On Sun, Oct 19, 2014 at 1:54 PM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Chris Angelico ros...@gmail.com writes:

 Try learning Python itself, rather than playing around with extension
 packages like pytz.

 To be fair, “You need to install ‘pytz’ to work correctly with date and
 time values” is correct advice. If the OP doesn't install it early, then
 works with timestamps, problems are inevitable — at which point “oh, you
 needed to do that first” will be inevitable. It's lose–lose.

 It's a sad fact that MS Windows has completely useless timezone support,
 and this “install a third-party package” hurdle is a cost that is paid
 by all people trying to set up Python on MS Windows.

That's a rough business to be in... I mean... that's unfortunate.
However, I'd still advise anyone to learn the language itself first,
even if that means a rule like avoid working with international or
historical time. There are plenty of other things Python can do, even
just with a basic Windows installation.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Rustom Mody
On Sunday, October 19, 2014 8:25:53 AM UTC+5:30, Ben Finney wrote:
 Chris Angelico writes:

  Try learning Python itself, rather than playing around with extension
  packages like pytz.

 To be fair, You need to install 'pytz' to work correctly with date and
 time values is correct advice. If the OP doesn't install it early, then
 works with timestamps, problems are inevitable -- at which point oh, you
 needed to do that first will be inevitable. It's lose-lose.

Yes

 It's a sad fact that MS Windows has completely useless timezone support,
 and this install a third-party package hurdle is a cost that is paid
 by all people trying to set up Python on MS Windows.

About MS-lacunae Ive nothing to say

[Just head over to a debian list like users or vote or.. and witness the
riot going on over systemd... Hard to believe all's right in Linux-land]

As for this OP and similar problems -- yes python is in a peculiar position.
Because of 'batteries included' beginners can do powerful stuff.
However sometimes the batteries need to be supplemented.
And then there's a problem -- its not clear whether
- the beginner is having classic noob problems.
  Expert just needs to tweak a command a bit and he's sailing
- the beginner is in somewhat uncharted (research-needed) land -- charting
  the route between mutually complementary AND competing setup tools
  
  I believe python must be some sort of record setter in this that
o pip is a replacement for easy_install
o you install pip with easy_install

!!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Pierre Boulanger

Pierre Boulanger added the comment:

the result of log is:
=== Verbose logging started: 18-10-14  08:42:21  Build type: SHIP UNICODE 
5.00.9600.00  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (C4:34) [08:42:21:518]: Font created.  Charset: Req=0, Ret=0, Font: 
Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (C4:34) [08:42:21:518]: Font created.  Charset: Req=0, Ret=0, Font: 
Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (C4:24) [08:42:21:550]: Resetting cached policy values
MSI (c) (C4:24) [08:42:21:565]: Machine policy value 'Debug' is 0
MSI (c) (C4:24) [08:42:21:565]: *** RunEngine:
   *** Product: C:\Users\pierre\Doocuments\python-3.4.2.amd64.msi
   *** Action: 
   *** CommandLine: **
MSI (c) (C4:24) [08:42:21:565]: Note: 1: 2203 2: 
C:\Users\pierre\Doocuments\python-3.4.2.amd64.msi 3: -2147287037 
MSI (c) (C4:24) [08:42:21:565]: MainEngineThread is returning 3
=== Verbose logging stopped: 18-10-14  08:42:21 ===

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22645] Unable to install Python 3.4.2 amd64 on Windows 8.1 Update 1

2014-10-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I had no trouble ungrading 3.4.1 to 3.4.2 with win7 up to date with 'required' 
updates and most recommendedupdates.

--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21228] Missing enumeration of HTTPResponse Objects methods of urllib.request.urlopen's http.client.HTTPResponse?

2014-10-18 Thread Martin Panter

Martin Panter added the comment:

Is there anything else that needs doing to get this committed and resolved? My 
patch is just a trivial reordering of Evens’s, with about one sentence deleted.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21228
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21991] The new email API should use MappingProxyType instead of returning new dicts.

2014-10-18 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Thanks David,

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21991
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17095] Modules/Setup *shared* support broken

2014-10-18 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Ned,

For the first point, maybe close this issue and open a new bug for the second.

What do you think?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17095
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17095] Shared modules built with Modules/Setup are not found when run from build directory

2014-10-18 Thread Ned Deily

Ned Deily added the comment:

Sorry, I don't see the point of opening another issue, especially since most of 
the discussion in this issue has been about the second problem.  I have updated 
the issue title to be more specific, though.

--
title: Modules/Setup *shared* support broken - Shared modules built with 
Modules/Setup are not found when run from build directory

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17095
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17095] Shared modules built with Modules/Setup are not found when run from build directory

2014-10-18 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Thanks Ned

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17095
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22666] email.Header no encoding of unicode strings containing newlines

2014-10-18 Thread Flavio Grossi

New submission from Flavio Grossi:

When trying to encode an email header with a newline in it, correct encoding is 
done only for strings and not for unicode strings.
In fact, for unicode strings, encoding is only done if a non ascii character is 
contained in it.

The attached patch should fix the problem.

Simple example to reproduce the problem:
 from email.Header import Header as H

# correctly encoded
 H('two\r\nlines', 'utf-8').encode()
'=?utf-8?q?two=0D=0Alines?='

# unicode string not encoded
 H(u'two\r\nlines', 'utf-8').encode()
'two\r\nlines'

# unicode string with non ascii chars, correctly encoded
 H(u'two\r\nlines and \xe0', 'utf-8').encode()
'=?utf-8?b?dHdvDQpsaW5lcyBhbmQgw6A=?='

--
components: email
files: fix_email_header_encoding_uses_ascii_before_selected_charset.diff
keywords: patch
messages: 229640
nosy: barry, flavio, r.david.murray
priority: normal
severity: normal
status: open
title: email.Header no encoding of unicode strings containing newlines
type: behavior
versions: Python 2.7
Added file: 
http://bugs.python.org/file36959/fix_email_header_encoding_uses_ascii_before_selected_charset.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22666
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2014-10-18 Thread Cédric Krier

Cédric Krier added the comment:

A new version with unittest.

--
Added file: http://bugs.python.org/file36960/delocalize.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Steve Dower

Steve Dower added the comment:

Hmm, I'm used to seeing far more detail in verbose logs than that (normally 
they'd be a few hundred KB).

I'm sorry, I don't know how to diagnose this issue. Have you tried clearing 
your internet cache and downloading it again? Maybe try the 32-bit version 
(just to rule out some system configuration issues).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22645] Unable to install Python 3.4.2 amd64 on Windows 8.1 Update 1

2014-10-18 Thread Steve Dower

Changes by Steve Dower steve.do...@microsoft.com:


--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Martin v . Löwis

Martin v. Löwis added the comment:

2203 is Cannot open database file. System error [3]., with -2147287037 being 
0x80030003, which in turn is  STG_E_PATHNOTFOUND. Could it be that 
C:\Users\pierre\Doocuments\python-3.4.2.amd64.msi is on a SUBSTed drive? 
Installer does not support installing from that location.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22664] IDLE: Standard output and error from multiprocessing vanishes

2014-10-18 Thread ppperry

Changes by ppperry maprea...@olum.org:


--
nosy: +kbk, roger.serwy, terry.reedy -ppperry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22664
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2014-10-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for the updated patch, Cédric. Just some remarks:

- the documentation should mention that the return value is still a string
- the documentation needs a versionadded marker next to the new function
- have you already signed the contributor's agreement? otherwise you should 
sign it at https://www.python.org/psf/contrib/contrib-form/

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22664] IDLE: Standard output and error from multiprocessing vanishes

2014-10-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue11820.

--
nosy: +serhiy.storchaka
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - idle3 shell os.system swallows shell command output

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22664
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread eryksun

eryksun added the comment:

 MSI (c) (C4:24) [08:42:21:565]: Note: 1: 2203 2: 
 C:\Users\pierre\Doocuments\python-3.4.2.amd64.msi 3: 
 -2147287037 

Doocuments is probably a typo. Try again using Documents.

--
nosy: +eryksun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12020] Attribute error with flush on stdout,stderr

2014-10-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since 29ba6c399090 stdout and stderr flush upon exit. But any errors on 
flushing were swallowed. Since 4ca497f4819c (issue5319) an error is printed if 
stdout flushing fails.

FlushFile doesn't provide all methods and attributes of io.TextIOBase. But it 
is not required that sys.stdout should be an instance of io.TextIOBase or 
provide the flush() method. I suppose this is either not a bug or documentation 
issue.

--
components:  -Windows
nosy: +pitrou, serhiy.storchaka
versions: +Python 3.4, Python 3.5 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12020
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22645] Unable to install Python 3.4.2 amd64 on Windows 8.1 Update 1

2014-10-18 Thread Matthew Barnett

Matthew Barnett added the comment:

@Terry: Just to clarify, I didn't have a problem installing over Python 3.4.1, 
only with uninstalling Python 3.4.1 (with other stuff installed there) and then 
installing Python 3.4.2.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11820] idle3 shell os.system swallows shell command output

2014-10-18 Thread ppperry

ppperry added the comment:

The same lack of output occurs from processes started via the multiprocessing 
module.

--
nosy: +ppperry
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11820
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22638] ssl module: the SSLv3 protocol is vulnerable (POODLE attack)

2014-10-18 Thread Alex Gaynor

Alex Gaynor added the comment:

Benjamin, do you have an opinion on backporting this to 2.7?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22638
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11820] idle3 shell os.system swallows shell command output

2014-10-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

#22664 (closed as duplicate of this) has ppperry's multiprocessing test example.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11820
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22660] Review ssl docs for security recommendations

2014-10-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file36961/ssldoc.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22660
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22667] Incorrect evaluation of variables with names containing supplementary characters

2014-10-18 Thread Drekin

New submission from Drekin:

 eval(\N{mathematical double-struck capital a})
NameError: name 'A' is not defined
 A = 2
 eval(\N{mathematical double-struck capital a})
2
 \N{mathematical double-struck capital a} == A
False

--
components: Interpreter Core, Unicode
messages: 229653
nosy: Drekin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Incorrect evaluation of variables with names containing supplementary 
characters
versions: Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22667
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22667] Incorrect evaluation of variables with names containing supplementary characters

2014-10-18 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Identifier names are normalized.

 unicodedata.normalize(NFKC, \N{mathematical double-struck capital a}) 
 == A
True

--
nosy: +benjamin.peterson
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22667
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
Removed message: http://bugs.python.org/msg229654

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Georg Brandl

Georg Brandl added the comment:

Removed the message containing the log. It is making it very clumsy to view 
this issue. Please resubmit as a file attachment.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
Removed message: http://bugs.python.org/msg229655

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22648] Unable to install Python 3.4.2 amd64 on Windows 8.1

2014-10-18 Thread Pierre Boulanger

Pierre Boulanger added the comment:

Here is the right log...

--
Added file: http://bugs.python.org/file36962/log.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22648
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22524] PEP 471 implementation: os.scandir() directory scanning function

2014-10-18 Thread Ben Hoyt

Ben Hoyt added the comment:

Attaching updated patch (scandir-2.patch) per Victor's code review here: 
http://bugs.python.org/review/22524/diff/13005/Modules/posixmodule.c

Note that I haven't included test_scandir.py this time, as I haven't made any 
changes there, and it's not really ready for Python 3.5 yet.

--
Added file: http://bugs.python.org/file36963/scandir-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22524
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2014-10-18 Thread Cédric Krier

Cédric Krier added the comment:

Add return value is string in doc
Add versionadded
And yes I signed the agreement.

--
Added file: http://bugs.python.org/file36964/delocalize.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-10-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ffa43e8ab47 by Terry Jan Reedy in branch '2.7':
Issue #20155: Fix non-buildbot test failure on Windows.  Patch by Claudiu Popa,
https://hg.python.org/cpython/rev/3ffa43e8ab47

New changeset 5c0f17063fb8 by Terry Jan Reedy in branch '3.4':
Issue #20155: Fix non-buildbot test failure on Windows.  Patch by Claudiu Popa,
https://hg.python.org/cpython/rev/5c0f17063fb8

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20155
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-10-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Patch fixes failures for me.  Let's hope that change does not fail on other 
systems or buildbots (starting at 21:17 bb time). I will check bbs later.

There seems to be a 2.7 speed issue which looks like a hang until running with 
-v.  On my machine, 2.7 runs 34 tests 40 seconds (consistently), with test_get 
taking 6 seconds.  3.4 runs 45 tests in under 3 seconds, a 15x speedup. I 
attached difflib.Differ output.  David, can you see anything responsible for 
the slowdown.  Should this be ignored?

--
stage: needs patch - resolved

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20155
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20689] socket.AddressFamily is absent in pydoc output

2014-10-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8a8ddf0b070 by Ethan Furman in branch '3.4':
Issue20689: add missing API pieces to __all__
https://hg.python.org/cpython/rev/f8a8ddf0b070

New changeset 7266562c2bb3 by Ethan Furman in branch 'default':
Issue20689: add missing API pieces to __all__
https://hg.python.org/cpython/rev/7266562c2bb3

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20689
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20689] socket.AddressFamily is absent in pydoc output

2014-10-18 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20689
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22668] memoryview.format is corrupted due to dangling shared pointer

2014-10-18 Thread Tom Flanagan

New submission from Tom Flanagan:

When slicing or cloning a memoryview object that has been previously cast to 
change its format string, the new memoryview's format shares a pointer to the 
parent's format string, which may be deleted at any time.

This manifests as a corrupt format when using the new memoryview object, 
causing crashes or unexpected behavior.

Tested on:
Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit 
(AMD64)] on win32
Python 3.5.0a0 (default:cb8606fc84df, Oct 18 2014, 14:55:44) [GCC 4.8.2] on 
linux

--
components: Interpreter Core
files: memoryview_bug.py
messages: 229664
nosy: Knio, pitrou, skrah
priority: normal
severity: normal
status: open
title: memoryview.format is corrupted due to dangling shared pointer
type: crash
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file36965/memoryview_bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22668
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22668] memoryview.format is corrupted due to dangling shared pointer

2014-10-18 Thread Tom Flanagan

Tom Flanagan added the comment:

Fix memoryview object allocations to copy format string

--
keywords: +patch
Added file: http://bugs.python.org/file36966/22668patch.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22668
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20155] Regression test test_httpservers fails, hangs on Windows

2014-10-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I copied the example profile code at the top and bottom of test_get and nearly 
all (7.155 / 7.210) of the time is in _socket.socket.connect, which takes .5 
sec per call.
   147.1550.5117.1550.511 {method 'connect' of _socket.socket' 
objects}
I am guessing that socket, and thence _socket, is imported in HTTPServer. I 
tested whether this diff in class TestServerThread is responsible
- self.server = HTTPServer(('', 0), self.request_handler)
+ self.server = HTTPServer(('localhost', 0), self.request_handler)
but it is not.  Anyone else have other ideas?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20155
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22669] Test_venv fails when _ctypes is not available.

2014-10-18 Thread Terry J. Reedy

New submission from Terry J. Reedy:

For whatever reason, AMD 64 Open Indiana ('stable' buildbot #3) is not building 
ctypes. test_venv fails with
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
--
Traceback (most recent call last):
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/test/test_venv.py,
 line 356, in test_with_pip
with_pip=True)
subprocess.CalledProcessError: Command '['/tmp/tmp644tt7bi/bin/python', '-Im', 
'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/test/test_venv.py,
 line 362, in test_with_pip
self.fail(msg.format(exc, details))
AssertionError: Command '['/tmp/tmp644tt7bi/bin/python', '-Im', 'ensurepip', 
'--upgrade', '--default-pip']' returned non-zero exit status 1

**Subprocess Output**
Traceback (most recent call last):
  File /export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/runpy.py, 
line 170, in _run_module_as_main
__main__, mod_spec)
  File /export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/runpy.py, 
line 85, in _run_code
exec(code, run_globals)
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/ensurepip/__main__.py,
 line 4, in module
ensurepip._main()
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/ensurepip/__init__.py,
 line 209, in _main
default_pip=args.default_pip,
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/ensurepip/__init__.py,
 line 116, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/ensurepip/__init__.py,
 line 40, in _run_pip
import pip
  File /tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/__init__.py, line 
9, in module
  File /tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/log.py, line 9, in 
module
  File 
/tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/__init__.py,
 line 2, in module
  File 
/tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/initialise.py,
 line 5, in module
  File 
/tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/ansitowin32.py,
 line 6, in module
  File 
/tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/winterm.py,
 line 2, in module
  File 
/tmp/tmp7od_thjv/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/win32.py,
 line 7, in module
  File 
/export/home/buildbot/64bits/3.4.cea-indiana-amd64/build/Lib/ctypes/__init__.py,
 line 7, in module
from _ctypes import Union, Structure, Array
ImportError: No module named '_ctypes'

Since this is not a failure of ensurepip, I think this should instead be a test 
skip.  The easiest thing would be to do what you did with ssl.

--
assignee: vinay.sajip
components: Library (Lib), Tests
messages: 229667
nosy: terry.reedy, vinay.sajip
priority: normal
severity: normal
stage: needs patch
status: open
title: Test_venv fails when _ctypes is not available.
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22669
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22669] Test_venv fails when _ctypes is not available.

2014-10-18 Thread Ned Deily

Ned Deily added the comment:

This is a duplicate of Issue22611.

--
nosy: +dstufft, ned.deily
resolution:  - duplicate
stage: needs patch - resolved
status: open - closed
superseder:  - pip needs ctypes

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22669
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com