Re: Simple question

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 1:19 PM, Kushal Kumaran
kushal.kuma...@gmail.com wrote:
Understandable. I currently am using two consoles (laptop at my right
hand, desktop in front of me), and every now and then I want to copy
and paste across them :) I mean, shared clipboard works just fine
across all my VM guests (and as I type that, Disney's cast is singing
Be our guest in my background music), it even works across remote
desktop, but for some reason, swinging my hands 90 degrees doesn't
transfer the clipboard. This strikes me as a major flaw in human
beings.


 You want synergy. http://synergy-foss.org/

Usually I want separate keyboard and mouse, so that I can be playing
Command  Conquer Renegade on one system while responding to emails on
the other (hold W so Havoc keeps walking, read through emails by
scrolling with right hand...); it's just the clipboard. It would, of
course, be possible to write a clipboard viewer program for whichever
platform - say, OS/2 - and have it connect via a TCP/IP socket to a
program on another system - say, a Linux box - that has a little
hidden window and puts stuff onto the clipboard. I will neither
confirm nor deny having actually done this...

*twiddles thumbs*

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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 12:51 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Converting print spam to print(spam) is the trivial part of it. The
 biggest change between Python 2.x and 3.x is the bytes to Unicode shift,
 and that is *not trivial*. Python 2.x tries very hard to make bytes and
 strings interoperate even when doing so is the wrong thing to do. So
 there is a lot of Python 2 code that is *broken* with respect to strings,
 but *seems okay* so long as you only test it using pure ASCII. Python 3
 no longer tries to hide the difference, it forces you to confront the
 fact that bytes and strings are not the same. To people raised on ASCII-
 only programming standards, that's a huge paradigm shift, and a confusing
 one. There's a lot to learn, a lot of pain if you don't learn it, and
 there can be a lot of effort needed to migrate string code to Python 3.

Has anyone ever had the same oh great, now I have to push everyone
through a paradigm shift feeling about anything else? The only one I
can think of is shifting my whole family off Windows file sharing
(just accessing files everywhere) onto wholesale use of source control
(have a local copy, and push your changes).

 (Depending on what your code actually does. It is remarkable just how
 much string code you can write that works identically in 2.x and 3.x.
 Basic string handling remains basic in both.)

With PEP 461 (slated for 3.5), that's going to get even easier. Not
only will a simple double-quoted string do the right thing on both
platforms, but both bbinary and uunicode will support the same
percent-formatting as well. But you do have to limit your definition
of 2.x; a lot of that commonality is the result of deliberate
design, and NOT just oh hey look it works, which means that 2.4 and
3.4 are very different. I respect and do not envy those who have to
support both RHEL and Arch...

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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 12:52 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 I'm actually asking a serious question. How does a distro actively hide
 something publicly available on the Internet? Note that, on Linux (when
 you talk about distributions, you probably don't mean OS X or Windows)
 all the compiler tools needed to install from source are readily
 available, so anyone who wants to install a Python version not supported
 by their distro can do so. Many people don't wish to install anything
 outside of their distro's supported packages, but that's their choice,
 not the distro imposing anything on them.

I'd say it's not so much actively hide as just abandon people to
their own devices. It's all very well to say well hey, just go and
compile it from source; this assumes two things:

1) The available source code will compile on your platform
2) The user knows how to compile code.

The first is true of the platforms supported by python.org, but that's
not the OS/distribution helping you to get Python - that's Python
helping you to get Python. The second... that's where things like
apt-get build-dep come in, but mainly there's a general
understanding among end users that compiling code is haaard. Some
cultures have this more strongly than others... sometimes for good
reason. (I had stupid amounts of trouble trying to get a C compiler
going on OS X. A non-programmer, doing the same job, might well give
up, and I wouldn't argue.) Compiling from source without a package
manager fetching all the appropriate libraries means an iterative
process of compile or build, see what the error is, figure out what's
missing, fetch it, GOTO 10. For me, that's life; that's something
I've done on a number of different systems, and I know lots of the
clues and/or the tools for figuring things out. For many
non-programmers, though, if there's no binary package, they won't use
the software.

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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread wxjmfauth



It is more than clear to me, Python did and does not
understand the unicode case.

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


Attribute error while executing python script

2014-04-16 Thread ali hanif
Hi i am a student and working on GNU..I have a python code which i want to
run in GNU radio companion but i am unable to search for the right block to
execute that code...can anyone help me with that??When I execute the same
python code(not in GNU), I get the following error:

AttributeError: 'top_block_sptr' object has no attribute 'wxgui_'

If anyone knows about this,plz send a mail to alihanif...@gmail.comthnx
in advance..the code is as shown:

#!/usr/bin/env pythonfrom gnuradio import blocksfrom gnuradio import
eng_notationfrom gnuradio import grfrom gnuradio import uhd#from
gnuradio import windowfrom gnuradio.eng_option import eng_option#from
gnuradio.gr import firdesfrom gnuradio.wxgui import formsfrom
gnuradio.wxgui import waterfallsink2from grc_gnuradio import wxgui as
grc_wxguifrom optparse import OptionParserimport wx
class top_block(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title=Top Block)
_icon_path = /usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##
# Variables
###
###
self.variable_slider_1 = variable_slider_1 = 32
self.variable_slider_0 = variable_slider_0 = 0
self.samp_rate = samp_rate = 21e6
self.gain = gain = variable_slider_1
self.delay_length = delay_length= variable_slider_0
##
# Blocks
##
self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
self.GetWin(),
baseband_freq=0,
dynamic_range=100,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=512,
fft_rate=15,
average=False,
avg_alpha=None,
title=Output Waterfall Plot,
)
self.GridAdd(self.wxgui_waterfallsink2_0_0.win, 0, 10, 10, 10)
self.wxgui_
waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
self.GetWin(),
baseband_freq=0,
dynamic_range=100,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=512,
fft_rate=15,
average=False,
avg_alpha=None,
title=Input Waterfall Plot,
)
self.GridAdd(self.wxgui_waterfallsink2_0.win, 0, 0, 10, 10)
_variable_slider_1_sizer = wx.BoxSizer(wx.VERTICAL)
self._variable_slider_1_text_box = forms.text_box(
parent=self.GetWin(),
sizer=_variable_slider_1_sizer,
value=self.variable_slider_1,
callback=self.set_variable_slider_1,
label=Output Gain,
converter=forms.float_converter(),
proportion=0,
)
self._variable_slider_1_slider = forms.slider(
parent=self.GetWin(),
sizer=_variable_slider_1_sizer,
value=self.variable_slider_1,
callback=self.set_variable_slider_1,
minimum=0,
maximum=32,
num_steps=31,
style=wx.SL_HORIZONTAL,
cast=float,
proportion=1,
)
self.GridAdd(_variable_slider_1_sizer, 12, 10, 1, 9)
_variable_sl
ider_0_sizer = wx.BoxSizer(wx.VERTICAL)
self._variable_slider_0_text_box = forms.text_box(
parent=self.GetWin(),
sizer=_variable_slider_0_sizer,
value=self.variable_slider_0,
callback=self.set_variable_slider_0,
label=Delay Length,
converter=forms.int_converter(),
proportion=0,
)
self._variable_slider_0_slider = forms.slider(
parent=self.GetWin(),
sizer=_variable_slider_0_sizer,
value=self.variable_slider_0,
callback=self.set_variable_slider_0,
minimum=0,
maximum=71,
num_steps=1000,
style=wx.SL_HORIZONTAL,
cast=int,
proportion=1,
)
self.GridAdd(_variable_slider_0_sizer, 10, 10, 1, 9)
self.uhd_usrp_source_0 = uhd.usrp_source(
device_addr=,
stream_args=uhd.stream_args(
cpu_format=fc32,
channels=range(1),
),
)
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_center_freq(2.28e9, 0)
self.uhd_usrp_source_0.set_gain(0, 0)
self.uhd_usrp_sink_0 = uhd.usrp_sink(
device_addr=,
stream_args
=uhd.stream_args(
cpu_format=fc32,
channels=range(1),
),
)
self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
self.uhd_usrp_sink_0.set_center_freq(2.28e9, 0)
self.uhd_usrp_sink_0.set_gain(gain, 0)
self.gr_file_source_0_0 = gr.file_source(
gr.sizeof_gr_complex*1,/home/ubuntu/radar-rx3.capture, True)
self.gr_file_source_0 =

Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Andrew Berg
On 2014.04.15 20:21, Steven D'Aprano wrote:
 On Tue, 15 Apr 2014 17:32:57 -0500, Andrew Berg wrote:
 
 On 2014.04.15 17:18, Ned Batchelder wrote:
 Yeah, that's the wrong way to do it, and they shouldn't have done that.
   python needs to mean Python 2.x for a long time.
 Or maybe explicit is better than implicit:
 
 # python
 zsh: command not found: python
 # which python2.7
 /usr/local/bin/python2.7
 # which python3.4
 /usr/local/bin/python3.4
 
 If you really meant that, you would have typed /usr/bin/which2.16 
 python (or whatever the location and version of which on your system).
Are you sure about that?
# which which
which: shell built-in command
Unless I'm forgetting some more explicit way of calling a command built into 
the shell.

-- 
CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 5:32 PM, Andrew Berg
aberg...@my.hennepintech.edu wrote:
 If you really meant that, you would have typed /usr/bin/which2.16
 python (or whatever the location and version of which on your system).
 Are you sure about that?
 # which which
 which: shell built-in command
 Unless I'm forgetting some more explicit way of calling a command built into 
 the shell.

Hmm, interesting. That's not the case for me:

rosuav@sikorsky:~$ which which
/usr/bin/which

Debian Wheezy.

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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Rustom Mody
On Wednesday, April 16, 2014 1:02:00 PM UTC+5:30, Andrew Berg wrote:
 On 2014.04.15 20:21, Steven D'Aprano wrote:
 
  On Tue, 15 Apr 2014 17:32:57 -0500, Andrew Berg wrote:
 
  
 
  On 2014.04.15 17:18, Ned Batchelder wrote:
 
  Yeah, that's the wrong way to do it, and they shouldn't have done that.
 
python needs to mean Python 2.x for a long time.
 
  Or maybe explicit is better than implicit:
 
  
 
  # python
 
  zsh: command not found: python
 
  # which python2.7
 
  /usr/local/bin/python2.7
  # which python3.4
  /usr/local/bin/python3.4

  If you really meant that, you would have typed /usr/bin/which2.16 
  python (or whatever the location and version of which on your system).
 
 Are you sure about that?
 # which which
 which: shell built-in command
 Unless I'm forgetting some more explicit way of calling a command built into 
 the shell.

Not out here:

$ which which
/usr/bin/which
$ ls -l /usr/bin/which 
lrwxrwxrwx 1 root root 10 Jul 28  2013 /usr/bin/which - /bin/which

Though there is no evidence of which-versionitis which is what Steven is 
implying??
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Attribute error while executing python script

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 5:45 PM, ali hanif alihanif...@gmail.com wrote:
 Hi i am a student and working on GNU..I have a python code which i want to
 run in GNU radio companion but i am unable to search for the right block to
 execute that code...can anyone help me with that??When I execute the same
 python code(not in GNU), I get the following error:

 AttributeError: 'top_block_sptr' object has no attribute 'wxgui_'

 If anyone knows about this,plz send a mail to alihanif...@gmail.comthnx
 in advance..the code is as shown:

Several points. I'll get to the one that you asked about.

Firstly, please don't ask us to send you direct mail. I'm letting you
off on that one and cc'ing you, but a lot of people won't. If you want
a response, read the newsgroup/mailing list; that's what participation
means. (There are a few lists where cc'ing is the convention, so you
don't have to subscribe to hear the responses. This is not normal for
mailing lists, and definitely not for newsgroups, so it's safer to
assume you have to join.)

Secondly: GNU is a project and an operating system, not a particular
program. See http://www.gnu.org/ for more info. You're talking about
GNU Radio Companion, which may be either
http://gnuradio.org/redmine/projects/gnuradio/wiki or
http://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion
and is not really clear. Posting a link to what you're talking about
would help enormously.

Thirdly: When you get an error from Python, it comes with a full
traceback, pinpointing the failing line. Copy and paste the entire
traceback, not just the final line, as it helps us significantly. (But
in this case, I did figure out what was going on.)

Finally, you'll find it a lot easier to debug programs if you cut the
problem code down. Check out http://www.sscce.org/ for more info on
that. Often you'll find the problem yourself as you cut the code down;
if not, you can at least post a short, simple snippet, which we can
more easily debug. (Note that sometimes a problem really does depend
on the size of the code. I've had some of these. But then you can
still post your results: deleting any line from this code prevents
the bug from happening.)

 self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
 self.GetWin(),
 baseband_freq=0,
 dynamic_range=100,
 ref_level=0,
 ref_scale=2.0,
 sample_rate=samp_rate,
 fft_size=512,
 fft_rate=15,
 average=False,
 avg_alpha=None,
 title=Output Waterfall Plot,
 )

The layout here is what's tripping you up. Either your mailer has
destroyed structure, or this is almost unreadably tangled. And it
results in this next problem:

 self.wxgui_
 waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
 self.GetWin(),
 baseband_freq=0,
 dynamic_range=100,
 ref_level=0,
 ref_scale=2.0,
 sample_rate=samp_rate,
 fft_size=512,
 fft_rate=15,
 average=False,
 avg_alpha=None,
 title=Input Waterfall Plot,
 )

You've broken this in a place that doesn't work. The traceback points
you exactly to the failing line, and that's where the problem exists.

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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Steven D'Aprano
On Wed, 16 Apr 2014 02:32:00 -0500, Andrew Berg wrote:

 On 2014.04.15 20:21, Steven D'Aprano wrote:
 On Tue, 15 Apr 2014 17:32:57 -0500, Andrew Berg wrote:
 
 On 2014.04.15 17:18, Ned Batchelder wrote:
 Yeah, that's the wrong way to do it, and they shouldn't have done
 that.
   python needs to mean Python 2.x for a long time.
 Or maybe explicit is better than implicit:
 
 # python
 zsh: command not found: python
 # which python2.7
 /usr/local/bin/python2.7
 # which python3.4
 /usr/local/bin/python3.4
 
 If you really meant that, you would have typed /usr/bin/which2.16
 python (or whatever the location and version of which on your system).
 Are you sure about that?
 # which which
 which: shell built-in command
 Unless I'm forgetting some more explicit way of calling a command built
 into the shell.

I've tried it on two different systems:

steve@runes:~$ which which
/usr/bin/which


although I see you are running as root:

steve@runes:~$ su - 
Password: 
root@runes:~# which which
/usr/bin/which


Nope, that makes no difference. In any case, you're missing my point, 
which is not *where* the which binary lives, but the fact that you're 
calling some specific version, located in some specific place (even if 
that place is a virtual place inside the shell) implicitly rather than 
explicitly. Which is usually (but not always!) what we want for an 
interactive shell. Who wants to be typing out explicit paths to versioned 
binaries *all the time*?



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


Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Andrew Berg
On 2014.04.16 03:02, Chris Angelico wrote:
 Hmm, interesting. That's not the case for me:
 
 rosuav@sikorsky:~$ which which
 /usr/bin/which
That's because bash either does not have a builtin which or it is not enabled 
by default. I switched to zsh a while ago. I do still, of
course, have a system which, which is at /usr/bin/which, and which is the which 
that a shell which does not have a builtin which will use.

-- 
CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0
-- 
https://mail.python.org/mailman/listinfo/python-list


Web Designing Training Institutes in Hyderabad-Acewebacademy

2014-04-16 Thread Ace Webacademy
For professional courses in web designing and development at an affordable 
price choose Ace web academy one of the best web designing institutes in 
Hyderabad. Call: 7660-966-660.
-- 
https://mail.python.org/mailman/listinfo/python-list


subprocess help

2014-04-16 Thread Влатко Станковиќ
Hello,
I'm having some sort of 'problem' when using subprocess calls.
This is the code snipet that i am using:

capture_server1 = '''xvfb-run --auto-servernum ... '''
server1_download =
subprocess.Popen(shlex.split(capture_server1),stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)

out_s1, err_s1 = server1_download.communicate()

time.sleep(2)

capture_server2 = '''xvfb-run --auto-servernum  '''
server2_download = subprocess.Popen(shlex.split(capture_server2),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)

out_s2, err_s2 = server2_download.communicate()

The problem is the following:
- The program runs in a loop, where subprocess is called
- It runs for X days, sometimes 3 days, sometimes 5 days
- After that i get the following exception:

File /usr/lib/python2.7/subprocess.py, line 1091, in pipe_cloexec
r, w = os.pipe()
OSError: [Errno 24] Too many open files


How can i reproduce this on a local machine, and how to make sure that i
wont have any errors like this?

P.S. Version 2.7 is used with this program
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: subprocess help

2014-04-16 Thread Chris Angelico
On Wed, Apr 16, 2014 at 8:47 PM, Влатко Станковиќ l...@linuxmail.org wrote:
 capture_server1 = '''xvfb-run --auto-servernum ... '''
 server1_download = subprocess.Popen(shlex.split(capture_server1)

Separate to your actual problem: Is there a reason for splitting like
that, rather than simply using a list of separate arguments? That
would be a lot safer and easier; no going through the hassles of
quoting and splitting.

Your exact problem is likely to be due to unclosed files. I don't know
enough about .communicate() to know whether it closes everything
immediately or not, but it looks like you're progressively opening
more and more and more pipes.

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


Re: subprocess help

2014-04-16 Thread Steven D'Aprano
On Wed, 16 Apr 2014 12:47:03 +0200, Влатко Станковиќ wrote:

 Hello,
 I'm having some sort of 'problem' when using subprocess calls. This is
 the code snipet that i am using:
 
 capture_server1 = '''xvfb-run --auto-servernum ... '''
 server1_download = subprocess.Popen(shlex.split(capture_server1),
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
 
 out_s1, err_s1 = server1_download.communicate()
 time.sleep(2)

What's the difference between the server1 code (shown above) and the 
server2 code (not shown, but identical as far as I can tell)?

[...]
 The problem is the following:
 - The program runs in a loop, where subprocess is called - It runs for X
 days, sometimes 3 days, sometimes 5 days - After that i get the
 following exception:
 
 File /usr/lib/python2.7/subprocess.py, line 1091, in pipe_cloexec r, w
 = os.pipe()
 OSError: [Errno 24] Too many open files


You have to identify what files are remaining open. What does the xvfb-
run process do? What are the rest of the arguments?

My guess is that, depending on the arguments, sometimes xvfb-run leaves 
files open even after the process terminates. You should monitor the open 
files with lsof which is available on most Linux systems. I don't know 
how to do that on other operating systems.




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


Tutorials for Reorganizing Spreadsheet Data

2014-04-16 Thread josephlkremer
Hello, I'm a high school physics teacher and while I've played with Python 
enough to make a rock paper scissors program or animation of a bouncing ball 
(with air resistance!), I've never used it to work with data from a spreadsheet.

I have a large spreadsheet with a number of different student responses to a 
weekly prompt in various cells depending on which question they chose to 
answer. I'd like to organize these responses into something that make it easy 
for students to look back through their responses over time, and see how 
they've changed.

This is obviously possible in Python, but I don't know where to begin learning 
the details of what I'll need to know to build it. Can anyone give me a 
specific recommendation of tutorials where I might begin?

Thanks!

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


Re: Tutorials for Reorganizing Spreadsheet Data

2014-04-16 Thread Joel Goldstick
On Apr 16, 2014 9:55 AM, josephlkre...@gmail.com wrote:

 Hello, I'm a high school physics teacher and while I've played with
Python enough to make a rock paper scissors program or animation of a
bouncing ball (with air resistance!), I've never used it to work with data
from a spreadsheet.

 I have a large spreadsheet with a number of different student responses
to a weekly prompt in various cells depending on which question they chose
to answer. I'd like to organize these responses into something that make it
easy for students to look back through their responses over time, and see
how they've changed.

 This is obviously possible in Python, but I don't know where to begin
learning the details of what I'll need to know to build it. Can anyone give
me a specific recommendation of tutorials where I might begin?


The package xlrd will read your Excel files
 Thanks!

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


Re: Tutorials for Reorganizing Spreadsheet Data

2014-04-16 Thread Terry Reedy

On 4/16/2014 9:50 AM, josephlkre...@gmail.com wrote:

Hello, I'm a high school physics teacher and while I've played with Python 
enough to make a rock paper scissors program or animation of a bouncing ball 
(with air resistance!), I've never used it to work with data from a spreadsheet.

I have a large spreadsheet with a number of different student responses to a 
weekly prompt in various cells depending on which question they chose to 
answer. I'd like to organize these responses into something that make it easy 
for students to look back through their responses over time, and see how 
they've changed.

This is obviously possible in Python, but I don't know where to begin learning 
the details of what I'll need to know to build it. Can anyone give me a 
specific recommendation of tutorials where I might begin?


Is your spreadsheet actually on sheets (paper) or in a program? If the 
latter, you should be about to output the data as a 'comma-separated 
variable' (csv) file and read it in python with the csv module. If you 
want to work with the data directly in the spreadsheet file, the details 
depend on the OS and program.



--
Terry Jan Reedy

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


import serial failure

2014-04-16 Thread J W Burton
I have installed both Python 2.7 AND Python 3.3 and the corresponding pyserial 
files from

ihttps://pypi.python.org/packages/any/p/pyserial/pyserial-2.7.win32.exe#md5=21555387937eeb79126cde25abee4b35n
 my 

for 2.7

When I look in my Python27/Lib/site-packages/serial folder I see
package files

but when I run a program using import serial, I get an error
 Traceback (most recent call last):
  File C:\Users\Jahree\serial.py, line 2, in module
import serial
  File C:\Users\Jahree\serial.py, line 5, in module
ser = serial.Serial(
AttributeError: 'module' object has no attribute 'Serial'

I'm guessing there is a path not set correctly - I'M STUCK

Please help.

Thanks

ps: the following is serial.py file I'm using for testing.

import time
import serial

# configure the serial connections (the parameters differs on the device you 
are connecting to)
ser = serial.Serial(
port='/dev/ttyUSB1',
baudrate=19200,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)

ser.open()
ser.isOpen()

print('Enter your commands below.\r\nInsert exit to leave the application.')

input=1
while 1 :
# get keyboard input
input = raw_input( )
input = input( )
if input == 'exit':
ser.close()
exit()
else:
# send the character to the device
# (note that I happend a \r\n carriage return and line feed to the 
characters - this is requested by my device)
ser.write(input + '\r\n')
out = ''
# let's wait one second before reading output (let's give device time 
to answer)
time.sleep(2)
while ser.inWaiting()  0:
out += ser.read(4)

if out != '':
print( ,out)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: import serial failure

2014-04-16 Thread Zachary Ware
On Wed, Apr 16, 2014 at 12:56 PM, J W Burton jahree1...@gmail.com wrote:
 I have installed both Python 2.7 AND Python 3.3 and the corresponding 
 pyserial files from

 ihttps://pypi.python.org/packages/any/p/pyserial/pyserial-2.7.win32.exe#md5=21555387937eeb79126cde25abee4b35n
  my

 for 2.7

 When I look in my Python27/Lib/site-packages/serial folder I see
 package files

 but when I run a program using import serial, I get an error
  Traceback (most recent call last):
   File C:\Users\Jahree\serial.py, line 2, in module
 import serial
   File C:\Users\Jahree\serial.py, line 5, in module
 ser = serial.Serial(
 AttributeError: 'module' object has no attribute 'Serial'

 I'm guessing there is a path not set correctly - I'M STUCK

 Please help.

 Thanks

 ps: the following is serial.py file I'm using for testing.

 import time
 import serial

Your file is named serial.py, so import serial in that file will try
to import itself.  You can see this in the traceback you posted,
everything is coming from C:\Users\Jahree\serial.py.  Rename your
serial.py and things should work as expected.

Hope this helps,
-- 
Zach
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: import serial failure

2014-04-16 Thread Peter Otten
J W Burton wrote:

 I have installed both Python 2.7 AND Python 3.3 and the corresponding
 pyserial files from
 
 
ihttps://pypi.python.org/packages/any/p/pyserial/pyserial-2.7.win32.exe#md5=21555387937eeb79126cde25abee4b35n
 my
 
 for 2.7
 
 When I look in my Python27/Lib/site-packages/serial folder I see
 package files
 
 but when I run a program using import serial, I get an error
  Traceback (most recent call last):
   File C:\Users\Jahree\serial.py, line 2, in module
 import serial
   File C:\Users\Jahree\serial.py, line 5, in module
 ser = serial.Serial(
 AttributeError: 'module' object has no attribute 'Serial'
 
 I'm guessing there is a path not set correctly - I'M STUCK
 
 Please help.
 
 Thanks
 
 ps: the following is serial.py file I'm using for testing.

Your choice of filename is unfortunate ;)
 
 import time
 import serial

The file is importing itself here. Rename your

C:\Users\Jahree\serial.py

to something unique, say

C:\Users\Jahree\myserial.py

delete 

C:\Users\Jahree\serial.pyc

and everything should be OK.


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


[ANN] JOSE

2014-04-16 Thread Demian Brecht
Hi all,

jose is a Python Javascript Object Signing and Encryption (JOSE,
https://datatracker.ietf.org/wg/jose/charter/) implementation,
intended to support token-based authentication. This library
implements JWS and JWEs along with a subset of the
encryption/authentication algorithms recommended by the JOSE framework.

Code: https://github.com/Demonware/jose
Docs: http://jose.readthedocs.org/en/latest
PyPI: https://pypi.python.org/pypi/jose

-- 
Demian Brecht
http://demianbrecht.github.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21069] test_fileno of test_urllibnet intermittently fails when using www.example.com

2014-04-16 Thread Ned Deily

Ned Deily added the comment:

Senthil, thanks for looking into this.  Since it is turning out to be more of a 
urllib design issue, I'm going to deassign myself from it.

--
assignee: ned.deily - 

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



[issue21199] Python on 64-bit Windows uses signed 32-bit type for read length

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

 On Windows, the type of the size parameter of read() is an unsigned int, not 
 long nor size_t (...)

Oh, I read the wrong function. In fact, file_read() of Python 2.7 calls fread() 
and fread() uses size_t types, even on Windows.

To make sure that we are talking about the same thing, I wrote the attached 
file_read_size_t.patch file which replaces l with n in file_read().

Note: os.read() uses int types, even on Python 3.5, whereas read() uses a 
size_t type for the number of bytes on Linux.

--
keywords: +patch
Added file: http://bugs.python.org/file34906/file_read_size_t.patch

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



[issue21199] Python on 64-bit Windows uses signed 32-bit type for read length

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

If you want to announce that Python 2.7.x supports large objects on Windows 64 
bits, be prepared to have to fix Python in various different places.

You can compare which modules define PY_SSIZE_T_CLEAN in Python 2.7 and 3.x. 
For example, it looks like bz2 and zlib modules handle correctly 64-bit lengths 
in Python 3, but don't in Python 2.

By the way, BZ2File_read() in Python 2.7 uses also the l format to parse the 
input length. It looks like the code was copied from fileobject.c.

--

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



[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

It was also discussed to replace pymalloc with Windows Low Fragementation Heap 
(LFH) allocator on Windows:
http://bugs.python.org/issue13483#msg148605

--
nosy: +haypo

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



[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

It would also be interesting to compare fragmentation and performances of 
Python with and without pymalloc, maybe with other heap allocators like FreeBSD 
jemalloc and Google TCMalloc.

--

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



[issue21075] fileinput should use stdin.buffer for rb mode

2014-04-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue1191964] asynchronous Subprocess

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

I suggest to change the title of the issue to: subprocess: add non-blocking 
read and write methods to avoid the confusion with asyncio subprocess module 
which runs read and write in the background for you.

--
nosy: +haypo

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



[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 In Python 3, arenas are allocated using mmap(), so wherever the arena ends up 
 in the address space shouldn't matter, should it?

Indeed, although the effect on cache locality isn't clear.
Also, I don't think this solves the problem of having a single object
allocated inside a high address arena preventing the heap from
shrinking (which was the original reason for having the arenas
allocated by mmap).

Anyway, we can only go that far with reference counting (I mean that
you'd need a proper moving garbage collector for this).

--

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



[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 So what is the point of _PyObject_GC_Calloc ?

 It calls calloc(size) instead of malloc(size), calloc() which can be faster 
 than malloc()+memset(), see:
 https://mail.python.org/pipermail/python-dev/2014-April/133985.html

It will only make a difference if the allocated region is large enough
to be allocated by mmap (so not for 90% of objects).

--

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



[issue1191964] asynchronous Subprocess

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

I started to review the patch 5:
http://bugs.python.org/review/1191964/#ps11598

When I read unit tests, I realized that I don't like write_nonblocking name. 
It's too generic. A process has many files (more than just stdin, stdout, 
stderr: see pass_fds parameter of Popen). I would like an explicit 
write_stdin_nonblocking and read_stdout_nonblocking.

--

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



[issue21207] urandom persistent fd - not re-openned after fd close

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

 I agree in part, but it's quite common to close fd's in some cases like in a 
 child process after using os.fork()

Which project or Python module does that? Can you show me the code?

--
nosy: +haypo

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



[issue21111] Add a new PyLong_AsUnsignedLongAndOverflow function

2014-04-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: PyLong_AsUnsignedLongAndOverflow does not exist - Add a new 
PyLong_AsUnsignedLongAndOverflow function

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




[issue20434] Fix error handler of _PyString_Resize() on allocation failure

2014-04-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: Process crashes if not enough memory to import module - Fix error 
handler of _PyString_Resize() on allocation failure

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



[issue21180] Efficiently create empty array.array, consistent with bytearray

2014-04-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue21216] getaddrinfo is wrongly considered thread safe on linux

2014-04-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue21216] getaddrinfo is wrongly considered thread safe on linux

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

 It may only be reproductible when your getaddrinfo use a NETLINK to get 
 informations about your interfaces before doing the DNS query.

What is your operation system? Name and version. What is your version of the C 
library? What is your Python version? Can you provide an example to reproduce 
the issue?

--

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



[issue21250] sqlite3 doesn't have unit tests for 'insert or [algorithm]' functionality.

2014-04-16 Thread Alex Lord

New submission from Alex Lord:

In Lib/sqlite3/tests/dbapi.py there are no unit tests which test out sqlite3's 
'insert or [algorithm].' These algorithms are also referred to as SQL 'insert 
on conflict.'

More details at,
https://www.sqlite.org/lang_conflict.html

Not having unit tests for these features, especially 'insert or rollback,' 
seems like an easy way for timing and threading bugs to get lost in the 
database api.

--
components: Tests
messages: 216448
nosy: Alex.Lord
priority: normal
severity: normal
status: open
title: sqlite3 doesn't have unit tests for 'insert or [algorithm]' 
functionality.
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21216] getaddrinfo is wrongly considered thread safe on linux

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

test_getaddrinfo.c: C program to run getaddrinfo() concurrently in different 
threads, it comes from the Debian issue.

I ran this program with 10 threads, I stopped it after between 3000 and 5000 
tries (depending on the thread). I'm running Fedora 20: Linux kernel 
3.13.9-200.fc20.x86_64 and glibc 2.18.

--
Added file: http://bugs.python.org/file34907/test_getaddrinfo.c

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



[issue21216] getaddrinfo is wrongly considered thread safe on linux

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

Can you provide the C and Python backtrace of all threads of your program?

--

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



[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

 So what is the point of _PyObject_GC_Calloc ?

 It calls calloc(size) instead of malloc(size)

 No, the question is why you didn't simply change _PyObject_GC_Malloc
 (which is a private function).

Oh ok, I didn't understand. I don't like changing the behaviour of
functions, but it's maybe fine if the function is private.

--

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



[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-16 Thread STINNER Victor

STINNER Victor added the comment:

2014-04-16 3:18 GMT-04:00 Charles-François Natali rep...@bugs.python.org:
 It calls calloc(size) instead of malloc(size), calloc() which can be faster 
 than malloc()+memset(), see:
 https://mail.python.org/pipermail/python-dev/2014-April/133985.html

 It will only make a difference if the allocated region is large enough
 to be allocated by mmap (so not for 90% of objects).

Even if there are only 10% of cases where it may be faster, I think
that it's interesting to use calloc() to allocate Python objects. You
may create large Python objects ;-)

I didn't check which objects use (indirectly) _PyObject_GC_Calloc().

--

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



[issue21234] __contains__ and friends should check is for all elements first

2014-04-16 Thread Wolfgang Maier

Wolfgang Maier added the comment:



I don't even know where to start with this.

a) this recipe is not working
b) it's hardly readable
c) it is pointless

Why are you complicating things by testing for != ?
What advantage does this offer over == ?

You do not need class methods at all to achieve what you want (in fact the 
__ne__ as a method of the container is just wrong), instead use the one-liner:

any(element == value for element in container)

to find out if any element of your container equals value without doing the 
identity check, but then:
the identity check is anyway the fast part compared to the equality check (at 
least you assumed that in your first post).

and in fact with:
 l=list(range(2000))

 2000 in l
False

is much faster than:

 any(e == 2000 for e in l)
False

despite checking identity AND equality, simply because it isn't doing things in 
Python.

So while the current docs say this about the in operator:


For container types such as list, tuple, set, frozenset, dict, or 
collections.deque, the expression x in y is equivalent to any(x is e or x == e 
for e in y).


I guess, that doesn't mean it is actually implemented like that, but only that 
the result is equivalent.

--

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



[issue21167] float('nan') returns 0.0 on Python compiled with icc

2014-04-16 Thread Hrvoje Nikšić

Hrvoje Nikšić added the comment:

Using -fp-model strict (or other appropriate icc flag) seems like a reasonable 
resolution.

It should likely also be applied to Python 3.x, despite the version field of 
this issue. (Even if float('nan') happens to work in current 3.x, internal code 
that returns Py_NAN can and will break.)

--

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



[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

I left a Rietveld comment, which probably did not get mailed.

--

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

In case anyone wonders why the FreeBSD bot works again: I've
installed OpenSSL from source.

--

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



[issue21234] __contains__ and friends should check is for all elements first

2014-04-16 Thread Jurjen N.E. Bos

Jurjen N.E. Bos added the comment:

Oops. That was a hard lesson: 1) don't haste when posting 2) always run what 
you post.

The point was the trick to define a custom __ne__ and not an __eq__ for an 
object (not for the container it is in!) so you can use in at full speed. Then
not all(map(ne, repeat(obj), container))
or
not all(map(obj.__ne__, container))
can be used if you really what to check for equality. This does make a 
difference in my case, where I only sometimes check for a non-identical object 
in the container, and I know when I do that.

--

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



[issue20752] Difflib should provide the option of overriding the SequenceMatcher

2014-04-16 Thread Chris Rose

Changes by Chris Rose off...@offby1.net:


--
nosy: +r.david.murray

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



[issue21237] Update Python 2/3 porting HOWTO's suggestion for dealing with map()

2014-04-16 Thread Josh Rosenberg

Josh Rosenberg added the comment:

I think the suggestion is intended for how do I keep Python 2 semantics in 
Python 3?, not how can I write my Python 2 code so it will run equivalently 
in Python 3?

It wouldn't be a bad idea to point out that you can adopt Py3 semantics 
initially so as to avoid surprises later on; sadly, unlike a __future__ import, 
if you want cross compatible code you have to do stupid stuff like:

try:
from future_builtins import *
except ImportError:
# Py3 is already the future
pass

--
nosy: +josh.rosenberg

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-04-16 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue21251] Standard library trace module crashes with exception

2014-04-16 Thread Martin Kolman

New submission from Martin Kolman:

We are currently working on adding tracing support to Anaconda, the Fedora/Red 
Hat Enterprise Linux installer and we have encountered some pretty strange 
behavior of the trace module. Anaconda (or to be concrete the Blivet storage 
library used by Anaconda) uses the pyblock module, but just importing it 
crashes the trace module with a strange exception.

It can be reproduced like this:
0. install pyblock (on Fedora is is provided by the python-pyblock package)

1. write some python code that imports the block module provided by pyblock

echo import block  pyblock_trace.py

2. try to trace the code

python -m trace -t pyblock_trace.py

The trace module starts tracing but after a few seconds it crashes with the 
following traceback:


Traceback (most recent call last):
  File /usr/lib64/python2.7/runpy.py, line 162, in _run_module_as_main
__main__, fname, loader, pkg_name)
  File /usr/lib64/python2.7/runpy.py, line 72, in _run_code
exec code in run_globals
  File /usr/lib64/python2.7/trace.py, line 830, in module
main()
  File /usr/lib64/python2.7/trace.py, line 818, in main
t.runctx(code, globs, globs)
  File /usr/lib64/python2.7/trace.py, line 513, in runctx
exec cmd in globals, locals
  File pyblock_trace.py, line 1, in module
import block
  File /usr/lib64/python2.7/site-packages/block/__init__.py, line 47, in 
module
import dmraid
  File string, line 1, in module
  File /usr/lib64/python2.7/trace.py, line 609, in globaltrace_lt
filename = frame.f_globals.get('__file__', None)
AttributeError: 'module' object has no attribute 'get'


The dmraid module is written in C and we have looked though its source[1] code 
but have found nothing extraordinary. Most importantly there is no code 
touching the globals, but it still fails.

When looking what actually is in frame.f_globals we found that in all 
successful calls it has the globals dictionary but for the dmraid module it for 
some reason contains the module instance instead. Module instance is not a 
dictionary, so it doesn't have the get method and this leads to the exception 
above.

This is not the only C module we use, but this is the only one that triggers 
the crash in trace.


Additional information
Python version: 2.7.5
architecture: X86_64
OS: Fedora 20


[1] https://git.fedorahosted.org/cgit/pyblock.git/tree/dmraid.c

--
components: Library (Lib)
files: trace.log
messages: 216459
nosy: mkolman
priority: normal
severity: normal
status: open
title: Standard library trace module crashes with exception
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file34908/trace.log

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



[issue21211] pkgutil.find_loader() raises ImportError instead of returning None

2014-04-16 Thread Eric Snow

Eric Snow added the comment:

Ah, it's ValueError rather than ImportError that causes the problem.  
Regardless, handling it would be necessary.

--

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



[issue6490] os.popen documentation is probably wrong

2014-04-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3417a95df7e2 by Andrew Kuchling in branch 'default':
#6490: Expand documentation for os.popen().
http://hg.python.org/cpython/rev/3417a95df7e2

--
nosy: +python-dev

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



[issue6490] os.popen documentation is probably wrong

2014-04-16 Thread A.M. Kuchling

A.M. Kuchling added the comment:

Thanks for your patch!

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
title: os.popen documentation  is probably wrong - os.popen documentation is 
probably wrong

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



[issue21234] __contains__ and friends should check is for all elements first

2014-04-16 Thread Wolfgang Maier

Wolfgang Maier added the comment:

that clarifies things, thanks.

I would still not usually go that way though as it means defining __ne__ with 
no accompanying __eq__, which means that, in a simple case, you can't use == on 
instances of your class and, in the case that your class inherits __eq__ from a 
parent, that == and != give inconsistent answers.

A much simpler solution is to not use the x in y idiom if you know it is slowed 
down by expensive equality checks in the elements of y and you're only 
interested in the identity check.
Simply replace it with

any(element is x for element in y)

, which will run at decent speed.

A quick illustration:

class myObj(object):
def __eq__(self, other):
for i in range(1): pass # simulate an expensive check
return False

l=[myObj() for x in range(1)]

now compare:

 1 in m # slowed down by myObj.__eq__
False

 any(e is 1 for e in m) # identity checks only
False

= no class-level hacking required, but still a good performance gain.
Of course, if you really need bets performance with identity *and* equality 
checks, then your solution may make sense, but that looks like a pretty special 
requirement.
(and even then I would replace the ugly

not all(map(ne, repeat(obj), container)) # requires 2 imports to be so hard to 
read

with:

not all(element != obj for element in container)
)

--

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



[issue21234] __contains__ and friends should check is for all elements first

2014-04-16 Thread Wolfgang Maier

Wolfgang Maier added the comment:

 l=[myObj() for x in range(1)]
 
 now compare:
 
  1 in m # slowed down by myObj.__eq__
 False
 
  any(e is 1 for e in m) # identity checks only
 False

oops, sorry for the inconsistency here.

the first line should read:

m = [myObj() for x in range(1)]

for this to work, of course.

--

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2014-04-16 Thread Christian Theune

Christian Theune added the comment:

Looking into this. 

It seems that it doesn't happen for all servers, I can download large files 
reliably from other sources.

I'll make another wireshark recording to get more details for me to analyze.

--
nosy: +ctheune

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2014-04-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

 I'll make another wireshark recording to get more details for me to analyze.

Thank you! That will be useful. Please test it against 3.x version as it has 
seen cleanups recently.

--

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



[issue21121] -Werror=declaration-after-statement is added even for extension modules through setup.py

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

Here is a patch.  I do not see a really nice way to deal with the problem.
The cleanest way I found was to introduce a new Makefile variable CFLAGS_NODIST
and use that in the interpreter and stdlib build.

--
keywords: +patch
nosy: +skrah
Added file: http://bugs.python.org/file34909/issue21121.diff

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



[issue21167] float('nan') returns 0.0 on Python compiled with icc

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

Mark, if you agree that fp-model strict should not show up in
the distutils CFLAGS once Python is installed, the issue now depends
on #21121.

--
dependencies: +-Werror=declaration-after-statement is added even for extension 
modules through setup.py

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



[issue12916] Add inspect.splitdoc

2014-04-16 Thread R. David Murray

R. David Murray added the comment:

Well, perhaps inspect needs a get_doc_synopsis method :)

Actually, I'm not sure that should be a smiley.

I don't really have a strong opinion on this myself (say I'm +0 for inspect), 
so I asked a couple other core devs here at the sprint (Eric Smith and Eric 
Snow), and they both thought it should be in inspect rather than pydoc.  
(Eric's Snow reason is that pydoc is not really a user facing library (actually 
what he said is it's a mess), and both thought it was more appropriate for 
inspect anyway).

--

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



[issue12916] Add inspect.splitdoc

2014-04-16 Thread Eric Snow

Eric Snow added the comment:

I agree with Éric that exposing splidoc publicly in the inspect module is the 
right thing.  inspect already has other similar functions.  If it doesn't land 
in inspect then the only other place that makes real sense to me would be a new 
module (docstring?).  However, that seems like overkill to me.

Furthermore, pydoc doesn't seem like a good place to expose the function (or 
perhaps any function wink).  It isn't a module relating explicitly to 
docstrings so much as to exposing API documentation.  The use of splitdoc there 
is an implementation detail while splitdoc itself is generally useful.  That 
said, I would still expect splitdoc to be exposed in pydoc for backward 
compatibility (via from inspect import splitdoc).

--
nosy: +eric.snow

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



[issue12523] 'str' object has no attribute 'more' [/usr/lib/python3.2/asynchat.py|initiate_send|245]

2014-04-16 Thread Caelyn McAulay

Caelyn McAulay added the comment:

Here is a small script that runs fine under 2.7 but demonstrates the error when 
run at 3.5.

If, at all the points annotated with '#not bytes :-(', the unicode strings are 
replaced with bytes objects, the example then successfully runs at 3.5.

--
nosy: +math_foo
Added file: http://bugs.python.org/file34910/asynchat_example.py

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2014-04-16 Thread Christian Theune

Christian Theune added the comment:

This is actually the same problem as #18879.

Changing the sample to keep a reference to the addinfourl object avoids this 
issue.

This is even worse than #18879 in the sense that the error goes undetected and 
just leaves you with partial data.

Looking at the solution in #18879 I think we can reuse that, maybe even better 
by refactoring that to a common file proxy object.

--

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 In case anyone wonders why the FreeBSD bot works again: I've
 installed OpenSSL from source.

Did you install the same version?

--

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

Antoine Pitrou rep...@bugs.python.org wrote:
 Did you install the same version?

No, I used the latest version + FIPS. Since FreeBSD 9.0 is EOL, I did not
feel like investigating too much. :)

--

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



[issue21246] test_ssl handshake failure

2014-04-16 Thread ddve...@ucar.edu

ddve...@ucar.edu added the comment:

Despite this being Red Hat, this is not at all the case!

OpenSSL 1.0.1f has been released on Jan 6th, 2014 at 15:39:19 -- see 
https://www.openssl.org/source/

--

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



[issue21121] -Werror=declaration-after-statement is added even for extension modules through setup.py

2014-04-16 Thread Wolfgang Maier

Wolfgang Maier added the comment:

I ran into this issue right after 3.4 got released.

I solved it by adding

extra_compile_args=[-Wno-error=declaration-after-statement]

as an argument to the Extension() call in the package's setup.py .

--
nosy: +wolma

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



[issue21246] test_ssl handshake failure

2014-04-16 Thread ddve...@ucar.edu

ddve...@ucar.edu added the comment:

Just to make sure I'm using the right version:

Python 2.7.6 (default, Apr 14 2014, 15:12:21)
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
  import ssl
  ssl.OPENSSL_VERSION
'OpenSSL 1.0.1f 6 Jan 2014'
 

On 04/16/2014 08:49 AM, Davide Del Vento wrote:

 ddve...@ucar.edu added the comment:

 Despite this being Red Hat, this is not at all the case!

 OpenSSL 1.0.1f has been released on Jan 6th, 2014 at 15:39:19 -- see
 https://www.openssl.org/source/

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue21246
 ___


--

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



[issue15414] os.path.join behavior on Windows (ntpath.join) is unexpected and not well documented

2014-04-16 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue1669539] Improve Windows os.path.join (ntpath.join) smart joining

2014-04-16 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-04-16 Thread Alex Gaynor

New submission from Alex Gaynor:

It would be nice if these said something useful. 
(http://hg.python.org/cpython/file/default/Lib/asyncio/events.py)

--
components: Library (Lib)
messages: 216478
nosy: alex
priority: normal
severity: normal
status: open
title: Lib/asyncio/events.py has tons of docstrings which are just XXX
versions: Python 3.4, Python 3.5

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



[issue21253] Difflib

2014-04-16 Thread Nina Zakharenko

New submission from Nina Zakharenko:

When difflib.compare() is used on two moderately large sequences with little or 
no common elements, a RuntimeError: maximum recursion depth exceeded occurs. 

This error became apparent when testing another bug (see: issue 19217) in the 
AssertEquals() method of the unit test library.

A sample program to reproduce this issue in 3.4 is attached. To repo in 2.7 
remove the list() wrapper from the range call.

--
components: Library (Lib)
files: diff_bug34.py
messages: 216479
nosy: gregory.p.smith, nnja, r.david.murray
priority: normal
severity: normal
status: open
title: Difflib
type: crash
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file34911/diff_bug34.py

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



[issue21253] Difflib.compare() crashes when sequences contain little or no common elements

2014-04-16 Thread Nina Zakharenko

Changes by Nina Zakharenko nzakhare...@gmail.com:


--
title: Difflib - Difflib.compare() crashes when sequences contain little or no 
common elements

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



[issue19217] Calling assertEquals for moderately long list takes too long

2014-04-16 Thread Nina Zakharenko

Nina Zakharenko added the comment:

The cause of this has been identified as a bug in libdiff.compare(). See issue 
21253 for more information.

--
nosy: +nnja

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



[issue21238] unittest.mock.Mock should not allow you to use non-existent assert methods

2014-04-16 Thread Kushal Das

Kushal Das added the comment:

Patch with docs and test changes.

--
keywords: +patch
Added file: http://bugs.python.org/file34912/issue21238.patch

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-04-16 Thread Yury Selivanov

Yury Selivanov added the comment:

I had plans to copy some documentation from python docs to asyncio docstrings. 
I'll try to do this sometime this week. Thanks for reminding us about the issue!

--
assignee:  - yselivanov
nosy: +gvanrossum, haypo, yselivanov

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-04-16 Thread Guido van Rossum

Guido van Rossum added the comment:

My bad. But I think docstrings should NOT be just copies of the separate
docs.
On Apr 16, 2014 9:01 AM, Yury Selivanov rep...@bugs.python.org wrote:


 Yury Selivanov added the comment:

 I had plans to copy some documentation from python docs to asyncio
 docstrings. I'll try to do this sometime this week. Thanks for reminding us
 about the issue!

 --
 assignee:  - yselivanov
 nosy: +gvanrossum, haypo, yselivanov

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue21252
 ___


--

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



[issue21252] Lib/asyncio/events.py has tons of docstrings which are just XXX

2014-04-16 Thread Yury Selivanov

Yury Selivanov added the comment:

 My bad. But I think docstrings should NOT be just copies of the separate
docs.

I agree. I didn't want to blindly copy them, but rather use existing 
documentation as guidance  baseline.

--

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



[issue12523] 'str' object has no attribute 'more' [/usr/lib/python3.2/asynchat.py|initiate_send|245]

2014-04-16 Thread Caelyn McAulay

Caelyn McAulay added the comment:

I was unable to locate a point in the code where we could be certain that the 
error was ultimately caused by trying to use (unicode) strings instead of bytes 
object.

The patch adds a logging statement suggesting what the trouble is when the 
error is (probably) encountered.

Someone with more experience than me will need to make the call about whether 
this is a useful addition or not.

--
keywords: +patch
Added file: http://bugs.python.org/file34913/issue12523.patch

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



[issue12916] Add inspect.splitdoc

2014-04-16 Thread Yury Selivanov

Yury Selivanov added the comment:

OK, since it's two-and-a-half votes against one, let's do this. I'll do the 
final review of the patch and commit it.

--

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



[issue21254] PropertyMock refuses to raise AttributeErrror as a side effect

2014-04-16 Thread Michael Foord

New submission from Michael Foord:

What steps will reproduce the problem?

 import mock
 a_mock = mock.MagicMock()
 no_attribute = mock.PropertyMock(side_effect=AttributeError)
 type(a_mock).property = no_attribute



What is the expected output? What do you see instead?

I would expect the above to raise an AttributeError. Instead it returns a 
MagicMock instance.

 a_mock.property
MagicMock name='mock.property' id='140165240345424'

I would expect it to have the same effect as calling a PropertyMock with any 
other exception as a side effect:

 mock_value_error = mock.PropertyMock(side_effect=ValueError)
 type(a_mock).other_property = mock_value_error
 a_mock.other_property
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 2365, in 
__get__
return self()
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 955, in 
__call__
return _mock_self._mock_call(*args, **kwargs)
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 1010, in 
_mock_call
raise effect
ValueError



What version of the product are you using? On what operating system?

Using version mock-1.0.1-py2.6 on CentOS 6.4



Please provide any additional information below.

PropertyMock objects apparently won't raise sublcasses of AttributeError either:

 class MockAttributeError(AttributeError): pass
... 
 no_attr = mock.PropertyMock(side_effect=MockAttributeError)
 type(a_mock).property = no_attr
 a_mock.property
MagicMock name='mock.property' id='140165240345424'

Works fine for subclasses of other Exceptions:

 class MockKeyError(KeyError): pass
... 
 no_key = mock.PropertyMock(side_effect=MockKeyError)
 type(a_mock).property = no_key
 a_mock.property
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 2365, in 
__get__
return self()
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 955, in 
__call__
return _mock_self._mock_call(*args, **kwargs)
  File /home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py, line 1010, in 
_mock_call
raise effect
__main__.MockKeyError

--
assignee: michael.foord
keywords: easy
messages: 216487
nosy: kushal.das, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: PropertyMock refuses to raise AttributeErrror as a side effect
type: behavior
versions: Python 3.4, Python 3.5

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



[issue21255] Attaching a PropertyMock records calls

2014-04-16 Thread Michael Foord

New submission from Michael Foord:

What steps will reproduce the problem?

 foo = Mock(name='foo')
 prop = PropertyMock(name='prop')
 type(foo).prop = prop
 foo.attach_mock(prop, 'prop')
 foo.mock_calls
[call.prop(PropertyMock name='foo.prop' id='4300017296')]

Expected:

 foo.mock_calls
[]

What version of the product are you using? On what operating system?

% pip freeze | grep mock
mock==1.0.1

OS X 10.8.4

Please provide any additional information below.

It would be even cooler if attaching a property mock made calls to the 
property appear in the mock_calls for the hosting mock without having to attach 
it, the way it does with a non-property method :)

I use mock every day now and am firmly of the opinion it is far, far more 
awesome than sliced bread. Thanks for making it available to the Python 
community :)

--
assignee: michael.foord
components: Library (Lib)
messages: 216488
nosy: kushal.das, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: Attaching a PropertyMock records calls
type: behavior
versions: Python 3.4, Python 3.5

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



[issue5420] Queue deprecation warning patch

2014-04-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Martin von Löwis successfully lobbied to keep these methods.

--
resolution:  - rejected
status: open - closed

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d6501421b86b by Antoine Pitrou in branch '3.4':
Try to fix buildbot failures on old OpenSSLs ( 1.0.0) - followup to issue 
#21015
http://hg.python.org/cpython/rev/d6501421b86b

New changeset 1305410bff2d by Antoine Pitrou in branch 'default':
Try to fix buildbot failures on old OpenSSLs ( 1.0.0) - followup to issue 
#21015
http://hg.python.org/cpython/rev/1305410bff2d

--

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



[issue21234] __contains__ and friends should check is for all elements first

2014-04-16 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue21256] Sort keyword arguments in mock _format_call_signature

2014-04-16 Thread Michael Foord

New submission from Michael Foord:

Printing call args produces non-deterministic results, making them more or less 
useless in doctests.

kwargs_string = ', '.join([
'%s=%r' % (key, value) for key, value in kwargs.items()
])

should be:

kwargs_string = ', '.join([
'%s=%r' % (key, value) for key, value in sorted(kwargs.items())
])

--
assignee: michael.foord
keywords: easy
messages: 216491
nosy: kushal.das, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: Sort keyword arguments in mock _format_call_signature
type: behavior
versions: Python 3.5

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



[issue21227] Decimal class error messages for integer division aren't good

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

It is hard to get fine grained error messages in _decimal, since
the errors come from libmpdec.  A clean solution would require
changes to libmpdec, and I'm reluctant to do that right now.

It is certainly possible to document DivisionImpossible etc.

--

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

So, I think I've found the issue. On OpenSSL  1.0.0, the ECDH ciphers exist 
but the ECDH cipher alias doesn't. I've committed a patch which should fix 
the issue, although the set_ciphers() call may be entirely useless given our 
current default cipher list.

--

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



[issue21257] Document parse_headers function of http.client

2014-04-16 Thread Senthil Kumaran

New submission from Senthil Kumaran:

It is undocumented. While fixing a doc issue issue18229 for http.server I 
noticed that I referenced that function and when I looked up for the 
documentation, it was lacking.

--
assignee: orsenthil
messages: 216494
nosy: orsenthil
priority: normal
severity: normal
status: open
title: Document parse_headers function of http.client
type: behavior
versions: Python 3.3, Python 3.4

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Ned Deily

Ned Deily added the comment:

That does indeed make the test now pass on OS X 10.9:

test_default_ecdh_curve (test.test_ssl.ThreadedTests) ...  server:  new 
connection from ('127.0.0.1', 60758)
 server: connection cipher is now ('AECDH-AES256-SHA', 'TLSv1/SSLv3', 256)
 server: selected protocol is now None
ok

Thsnks, Antoine!

--

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



[issue21227] Decimal class error messages for integer division aren't good

2014-04-16 Thread Stefan Krah

Stefan Krah added the comment:

Meanwhile, the pure Python decimal versions prior to Python 3.2
have better error messages.

Right now in Python 3.3+ it is hard to import the Python version
without going into contortions, but that may be fixed in #19232.

--
dependencies: +Speed up _decimal import

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



[issue21192] Idle: Print filename when running a file from editor

2014-04-16 Thread Adnan Umer

Adnan Umer added the comment:

I tried to replace RESTART by doing these little changing

# PyShell.Py
class ModifiedInterpreter(InteractiveInterpreter):
def restart_subprocess(self, with_cwd=False, with_msg=True):
...
if with_msg:
halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar)

def runcode(self, code):
with_msg = True
if code.co_filename[0] != '':
self.tkconsole.write('Executing ' + code.co_filename + '\n')
with_msg = False

if self.tkconsole.executing:
self.interp.restart_subprocess(with_msg)

# ScriptBinding.Py
class ScriptBinding:
def _run_module_event(self, event):
filename = self.getfilename()
if not filename:
return 'break'
code = self.checksyntax(filename)
if not code:
return 'break'
if not self.tabnanny(filename):
return 'break'
interp = self.shell.interp
if PyShell.use_subprocess:
interp.restart_subprocess(with_cwd=False, with_msg=False)

This works fine and replaces RESTART with Execute filename when file is 
executed in Python Shell.

Also instead of this

halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar)

my recomemdation is:
console.write('[SHELL RESTART]')

--

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



[issue21246] test_ssl handshake failure

2014-04-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This was fixed in #20896 by a certain Benjamin Peterson.

--
nosy: +pitrou
resolution:  - duplicate
status: open - closed
superseder:  - test_ssl.test_get_server_certificate() should use 
PROTOCOL_SSLv23, not PROTOCOL_SSLv3

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



[issue21015] support SSL_CTX_set_ecdh_auto on newer OpenSSLs

2014-04-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The buildbots seem happy as well, so I'm closing this.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue21247] test_asyncio: test_subprocess_send_signal hangs on Fedora builders

2014-04-16 Thread Orion Poplawski

Orion Poplawski added the comment:

We have determined that the koji builder is indeed setting the SIGHUP sigaction 
to SIG_IGN, which the python test is inheriting, and are working on trying to 
get that fixed.  However, it may be worth considering something like 
https://github.com/pexpect/pexpect/commit/1fbfddf33d196fd1f211fb95efdaa810b8b5dad3
 in the python tests to ensure that the test run properly in situations like 
this (I can imagine someone running them under nohup).

--

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



[issue21256] Sort keyword arguments in mock _format_call_signature

2014-04-16 Thread Eric Snow

Eric Snow added the comment:

Ordered kwargs anyone? :)

--
nosy: +eric.snow

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



[issue20896] test_ssl.test_get_server_certificate() should use PROTOCOL_SSLv23, not PROTOCOL_SSLv3

2014-04-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 55f62fa5bebc by Antoine Pitrou in branch 'default':
Issue #20896: ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not 
PROTOCOL_SSLv3, for maximum compatibility.
http://hg.python.org/cpython/rev/55f62fa5bebc

--

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



[issue20896] test_ssl.test_get_server_certificate() should use PROTOCOL_SSLv23, not PROTOCOL_SSLv3

2014-04-16 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
resolution:  - fixed
status: open - closed

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



  1   2   3   >