Re: Attribute path not in PurePosixPath ?

2016-01-24 Thread Vincent Vande Vyvre

Le 24/01/2016 08:58, Vincent Vande Vyvre a écrit :

Hi,

Refering to the doc 
https://docs.python.org/3/library/pathlib.html?highlight=pathlib#pathlib.PurePath.path


 


Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import PurePath
>>> p = PurePath('/home/vincent/Images')
>>> p.name
'Images'
>>> p.suffix
''
>>> p.parent
PurePosixPath('/home/vincent')
>>> [parent for parent in p.parents]
[PurePosixPath('/home/vincent'), PurePosixPath('/home'), 
PurePosixPath('/')]

>>> p.path
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'PurePosixPath' object has no attribute 'path'
 



Am I misunderstood the doc ?



OOps, is new in 3.4.5

Sorry for the noise.

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


[issue26188] Provide more helpful error message when `await` is called inside non-`async` method

2016-01-24 Thread SilentGhost

Changes by SilentGhost :


--
components: +asyncio
nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov

___
Python tracker 

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



Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Chris Angelico
On Sun, Jan 24, 2016 at 8:12 PM, Steve Petrie, P.Eng.
 wrote:
> I know what "upstream" means, in terms of: water flow in a river, or vehicle
> flow on a highway, or data flow over a comms link. "upstream" is where a
> moving particle was, earlier in time
>
> But my puzzlement is -- where is "upstream" in relation to an email forum,
> in the context of a thread?
>
> The fix for the mitmdump bang line bug was applied to file
> mitmdump-script.py, and according to its "Date Modified" field on my Win XP,
> this file arrived in the e:\a p p s\Python27\Scripts\ directory, when I
> installed mitmproxy. So it looks to me like file mitmdump-script.py is a
> product of the mitmproxy project.
>
> Am I correct in assuming, that "upstream" in the context of this present
> thread, means I should report the bang line bug to an mitmproxy forum?

"Upstream" normally refers to a flow of software, rather than of
discussions, but your conclusion is correct: upstream would be the
source of the software you're working with, so in this case, somewhere
specific to mitmproxy.

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


[issue26188] Provide more helpful error message when `await` is called inside non-`async` method

2016-01-24 Thread aditya gupta

Changes by aditya gupta :


--
nosy: +aditya gupta

___
Python tracker 

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



Re: import locale and print range on same line

2016-01-24 Thread eryk sun
On Sat, Jan 23, 2016 at 8:45 PM, Terry Reedy  wrote:
> On 1/23/2016 8:58 AM, Chris Angelico wrote:
>> On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano 
>> wrote:
>>> [steve@ando ~]$ python -c "for i in range(5):

  print 'hello world'
 "
>>>
>>> hello world
>>> hello world
>>> hello world
>>> hello world
>>> hello world
>>> [steve@ando ~]$
>>
>> Well, not everyone's shells are as awesome as bash...
>
> Like Windows command prompt is not.  I tried:
>
> C:\Users\Terry>python -c "for i in range(5):\n\tprint('hello world')"
>   File "", line 1
> for i in range(5):\n  print('hello world')
>  ^
> SyntaxError: unexpected character after line continuation character

cmd's parsing can be inscrutably finicky and limited, but luckily
enough this example works:

C:\>py -2 -c ^
More? "def f(n):^
More?
More? for i in range(n):^
More?
More? print 'hello world'^
More?
More? f(5)
hello world
hello world
hello world
hello world
hello world

cmd prints the "More?" prompt when a line is continued. Note that it's
necessary to hit enter again after escaping the first enter. Also, as
is usual with cmd, the closing double quote is optional, so I omitted
it after f(5).
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26190] GC memory leak using weak and cyclic references

2016-01-24 Thread Maximilian Köhl

New submission from Maximilian Köhl:

In the attached code the object initially bind to `a` is never garbage 
collected although there are no references left. The finalizer of `b` is 
executed and the weak reference to it becomes dead however the garbage 
collector does not free the object itself and it could be resurrected with 
`gc.get_objects()`.

Output:
gc: collecting generation 2...
gc: objects in each generation: 27 0 5795
gc: collectable 
gc: collectable 
finalize: b <__main__.A object at 0x7f158796acc0>
gc: done, 3 unreachable, 0 uncollectable, 0.0005s elapsed
gc: collecting generation 2...
gc: objects in each generation: 1 0 5812
gc: done, 0.0005s elapsed
gc: collecting generation 2...
gc: objects in each generation: 1 0 5812
gc: done, 0.0005s elapsed
[...]

--
components: Interpreter Core
files: gc_test_code.py
messages: 258886
nosy: koehlma
priority: normal
severity: normal
status: open
title: GC memory leak using weak and cyclic references
type: resource usage
versions: Python 3.5
Added file: http://bugs.python.org/file41704/gc_test_code.py

___
Python tracker 

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



Attribute path not in PurePosixPath ?

2016-01-24 Thread Vincent Vande Vyvre

Hi,

Refering to the doc 
https://docs.python.org/3/library/pathlib.html?highlight=pathlib#pathlib.PurePath.path



Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import PurePath
>>> p = PurePath('/home/vincent/Images')
>>> p.name
'Images'
>>> p.suffix
''
>>> p.parent
PurePosixPath('/home/vincent')
>>> [parent for parent in p.parents]
[PurePosixPath('/home/vincent'), PurePosixPath('/home'), PurePosixPath('/')]
>>> p.path
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'PurePosixPath' object has no attribute 'path'


Am I misunderstood the doc ?
--
https://mail.python.org/mailman/listinfo/python-list


[issue26195] Windows frozen .exe multiprocessing.Queue access is denied exception

2016-01-24 Thread Alex Robinson

New submission from Alex Robinson:

A pyinstaller 3.0 frozen .exe Python 2.7.10 program under Windows 7 that uses a 
multiprocessing.Queue to send things to a multiprocessing.Process leads to the 
process getting access-is-denied exceptions on every q.get() call.

And, when the program can't exit. Or leaves a dangling process for every 
Process.

An unsatisfying fix for this is to put the following code somewhere in the 
program:

"""
Do what must be done to make multiprocessing work in .exe files.

This involves monkey patching multiprocessing.forking under Windows
so when the a program using a multiprocessing.Process exits,
there won't be processes left running.

Hint from   
http://stackoverflow.com/questions/33764448/pathos-multiprocessing-pipe-and-queue-on-windows

.   The bottom line is we get "access is denied" when trying
.   to get from the multiprocessing.Queue when we're an .exe file.

.   So, in multiprocessing.forking.duplicate(),
.   we change 'inheritable' to default to True
.   from the normal code's False.

"""

import  sys
import  multiprocessing
import  multiprocessing.forking


#
#
#
#
def duplicate(handle, target_process = None, inheritable = True) :
return(multiprocessing.forking.kludge_to_fix_dangling_processes(handle, 
target_process, inheritable))

if  (not hasattr(multiprocessing.forking, 'kludge_to_fix_dangling_processes')) 
and (sys.platform == 'win32') :
multiprocessing.forking.kludge_to_fix_dangling_processes= 
multiprocessing.forking.duplicate
multiprocessing.forking.duplicate   = duplicate

--
components: Library (Lib)
messages: 258895
nosy: alex_python_org
priority: normal
severity: normal
status: open
title: Windows frozen .exe multiprocessing.Queue access is denied exception
type: behavior
versions: Python 2.7

___
Python tracker 

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



Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Terry Reedy

On 1/24/2016 5:35 PM, Larry Hudson via Python-list wrote:


If the path string is typed directly into Windows where it is parsed by
(whatever is the current equivalent of) command.com, forward slashes are
NOT accepted.


More specifically, / is not accepted in paths to be executed. It seems 
to be generally accepted in path arguments, as in cd path, or


C:\Users\Terry>C:\programs\python35\python.exe C:/programs/python34/tem.py

--
Terry Jan Reedy

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


[issue25296] Simple End-of-life guide covering all unsupported versions

2016-01-24 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



tkinter newbie question

2016-01-24 Thread KP
See my code below (which works). I'd like to have the 2nd window as a class in 
a separate unit. How do I code that unit and how do I call it from my first 
unit?

As always, thanks for all help!




#!/usr/bin/env python
"""
""" 
from tkinter import *
from settings import *

class window1():

def open_window2(self):
t = Toplevel(self.root)
t.title('New window')
t.geometry('262x65+200+250')
t.transient(self.root)

def setup_menu(self):
self.menubar = Menu(self.root)
self.menu1 = Menu(self.menubar, tearoff=0 ) 
self.menu1.add_command(label="Settings",   accelerator='Ctrl+S', 
command=self.open_window2)
self.menubar.add_cascade(label="Menu 1", menu=self.menu1)  
self.root.config(menu=self.menubar)

def __init__(self):
self.root = Tk()
self.root.title('Window #1')
self.setup_menu()
self.root.geometry('800x600+200+200')
#
self.root.mainloop()

if __name__ == '__main__':

w1 = window1()
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26190] GC memory leak using weak and cyclic references

2016-01-24 Thread Maximilian Köhl

Changes by Maximilian Köhl :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26192] python3 k1om dissociation permanence: libffi

2016-01-24 Thread ƦOB COASTN

New submission from ƦOB COASTN:

initial patch attached for Python-3.4.4
This patch requires rework.

I am willing to implement the __MIC__ or __KNC__ into a new patch if this is in 
fact the route forward that seems optimal.

Thanks,
Rob


> Enabling the build system for Intel MIC k1om is non-trivial using
> Python-3.4.4
> Using Python2 for the k1om is very popular, but I require Python3
> support on k1om.
>
> The first requirement to complete this build involved the download and
> extraction of pre-built MPSS RPM's.
> Then built required host python bins using GCC.
> Lastly, build MIC bins using ICC.
> The exacts are appended to the end of this message.
>
> I would like to discuss a few change requirements that trial and error
> has revealed.
>
> 1.) libffi requires the University OF Cantabria patch because the k1om
> is not binary compatible with x86_64. [attached]
>
> These libffi changes could be implemented using the __MIC__ or __KNC__
> macros.
> *see https://software.intel.com/en-us/node/514528

--
files: 0001-k1om-libffi.patch
keywords: patch
messages: 25
nosy: ƦOB COASTN
priority: normal
severity: normal
status: open
title: python3 k1om dissociation permanence: libffi
type: compile error
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41705/0001-k1om-libffi.patch

___
Python tracker 

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



[issue26191] pip on Windows doesn't honor Case

2016-01-24 Thread Donald Stufft

Donald Stufft added the comment:

If you're trying to use PyCrypto then you need to install PyCrypto, crypto is a 
different package. Try ``pip install PyCrypto``.

--
nosy: +dstufft

___
Python tracker 

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



[issue26191] pip on Windows doesn't honor Case

2016-01-24 Thread Anders Rundgren

New submission from Anders Rundgren:

pip install Crypto

Terminates correctly and the package is there as well.
Unfortunately the directory is named "crypto" rather than "Crypto" so when I 
perform

>>>import Crypto

the interpreter fails.

>>>import crypto 

seems to work but is incompatible over platforms.

If this is a problem with pycrypto or pip is beyond my knowledge of python.

--
components: Installation
messages: 258887
nosy: anders.rundgren@gmail.com
priority: normal
severity: normal
status: open
title: pip on Windows doesn't honor Case
type: compile error
versions: Python 3.5

___
Python tracker 

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



[issue26192] python3 k1om dissociation permanence: libffi

2016-01-24 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +doko
versions:  -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



Re: Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-24 Thread Grant Edwards
On 2016-01-24, Robert James Liguori  wrote:

> Is there a python library to calculate longitudinal acceleration,
> lateral acceleration and normal acceleration?

Yes.

> Thanks.

You're Welcome.


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


[issue26193] python3 k1om dissociation permanence: readelf

2016-01-24 Thread ƦOB COASTN

New submission from ƦOB COASTN:

> 2.) ./configure script halts during failure to locate readelf for the host.
>
> I simply commented out these lines in the ./configure file:
>  #if test "$cross_compiling" = yes; then
> #case "$READELF" in
> #readelf|:)
> #as_fn_error $? "readelf for the host is required for cross
> builds" "$LINENO" 5
> #;;
> #esac
> #fi
>
> Ideally, ./configure would support ICC and k1om.
> Am I missing something in the configure/make commands below?
> Is it possible to bypass the readelf requirement when cross-compiling for
> k1om?
>
> Additionally, are any of the command line parameters below unnecessary?
> PKG_CONFIG_LIBDIR
> PKG_CONFIG_PATH
> PYTHON_FOR_BUILD
> _PYTHON_HOST_PLATFORM
> HOSTPGEN
> HOSTARCH
> BUILDARCH
>
>
> Thanks,
> Rob
>
>
>
>
> #copy/unpack the k1om bins tarball
> cd /home/
> wget mpss-3.4.6-k1om.tar
> tar xvf mpss-3.4.6-k1om.tar
> cd /home/mpss-3.4.6/k1om/
> for rpm in *.rpm; do rpm2cpio $rpm | cpio -idm; done
>
> #vars
> PythonVersion=Python-3.4.4
> k1om_rpm=/home/mpss-3.4.6/k1om/
> INSTALLPREFIX=/home/Python/release/$PythonVersion-mic
> SRC=/home/Python/$PythonVersion
>
> echo "Compiling host Python"
> cd $SRC && make distclean
> cd $SRC && ./configure
> cd $SRC && make python Parser/pgen
> rm -f $SRC/hostpython
> mv $SRC/python $SRC/hostpython
> rm -f $SRC/Parser/hostpgen
> mv $SRC/Parser/pgen $SRC/Parser/hostpgen
> cd $SRC && make distclean
>
> echo "Configuring Python for MIC..."
> cd $SRC && CONFIG_SITE=config.site \
> ./configure \
> CC="icc -mmic" \
> CFLAGS="-I$k1om_rpm/include -I$k1om_rpm/usr/include -wd10006" \
> CXX="icpc -mmic" \
> CPPFLAGS="-I$k1om_rpm/include -I$k1om_rpm/usr/include -wd10006" \
> PKG_CONFIG_LIBDIR="$k1om_rpm/usr/lib64/pkgconfig" \
> PKG_CONFIG_PATH="$k1om_rpm/usr/lib64/pkgconfig" \
> --host=x86_64-k1om-linux \
> --build=x86_64-linux-gnu \
> --with-cxx-main="icpc -mmic" \
> --disable-ipv6
> echo "done"
>
> echo "Compiling Python for MIC..."
> cd $SRC && make \
> PYTHON_FOR_BUILD=./hostpython \
> _PYTHON_HOST_PLATFORM=x86_64-k1om-linux \
> HOSTPGEN=./Parser/hostpgen \
> HOSTARCH=x86_64-k1om-linux \
> BUILDARCH=x86_64-linux-gnu \
> EXTRA_CFLAGS="-fp-model precise -shared -fPIC" \
> LDFLAGS="-L$k1om_rpm/lib64 -L$k1om_rpm/usr/lib64"
> echo "done"
>
> echo "Installing Python for MIC"
> mkdir -p $INSTALLPREFIX
> cd $SRC && make install \
> PYTHON_FOR_BUILD=./hostpython \
> _PYTHON_HOST_PLATFORM=x86_64-k1om-linux \
> prefix=$INSTALLPREFIX
> echo "done"

--
components: Cross-Build
messages: 258889
nosy: ƦOB COASTN
priority: normal
severity: normal
status: open
title: python3 k1om dissociation permanence: readelf
type: compile error
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26191] pip on Windows doesn't honor Case

2016-01-24 Thread SilentGhost

SilentGhost added the comment:

Assuming that you're talking about https://pypi.python.org/pypi/crypto/ - it is 
unfortunate that pip is so lax with capitalisation rules when installing a 
package, but as far as I can see there isn't a "Crypto" package anywhere and 
you're never encouraged to use such a capitalisation in their docs.

Feel free to submit an issue on pip tracker, but this doesn't at all seem 
suitable for this one.

--
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Steve Petrie, P.Eng.

Chris,

Thanks for your response -- much appreciated.

Please see my remarks embedded below.

- Original Message - 
From: "Chris Angelico" 

To: "Steve Petrie, P.Eng." 
Cc: 
Sent: Saturday, January 23, 2016 10:14 AM
Subject: Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with 
"Permission denied" error (Python 2.7.11 on Win XP SP3);




On Fri, Jan 22, 2016 at 3:40 AM, Steve Petrie, P.Eng.
 wrote:
In both failure cases, it looks to me like there is a bug in the pip 
logic,
that is using a *nix forward slash "/" instead of a double backslash 
"\\"

before the file name "make.bat".


I'm not sure what your exact problem is, but I can say that it isn't
this; the Unix-style forward slash is perfectly legal under Windows
(and it's even legal to mix and match).

ChrisA


I never knew that the forward slash is legal under Windows -- thanks for 
the tip :)


After further research, I got mitmproxy installed under Windows XP. Now 
mitmdump starts ok (with one "warning").


* * *
* * *

In case other Windows XP "orphans" want to use mitmdump, here's what I 
learned (via Google):


1. There was a bug in pip-8.0.0 (bug fixed recently in pip-8.0.2) that 
caused the "Permission denied" error:


I did another upgrade of pip, and this time the upgrade installed 
pip-8.0.2 (instead of pip-8.0.0).


And pip-8.0.2 successfully installed mitmproxy.

2. But then mitmdump wouldn't start (can't use mitmproxy under 
Windows -- there's no GUI port):


  C:\Documents and Settings\SteveP>mitmdump --help
  failed to create process.

This "failed to create process" problem, was caused by whitespace, in 
the pathname to the python directory, in the bang line in file 
mitmdump-script.py:


I changed the bang line (wrapping the pathname in double quotes) in file 
mitmdump-script.py:


  from: #!e:\a p p s\python27\python.exe
 to: #!"e:\a p p s\python27\python.exe"

and now mitmdump starts ok with one warning:

  C:\Documents and Settings\SteveP>mitmdump --help
  e:\a p p 
s\python27\lib\site-packages\watchdog\observers\__init__.py:89: 
UserWarning: Failed to import read_directory_changes. Fall back to 
polling.
warnings.warn("Failed to import read_directory_changes. Fall back 
to polling.")

  usage: mitmdump-script.py [options] [filter]
  ...

I tried to fix the warning, but so far no success (due to my Python 
ignorance).


However, mitmdump does start (with the same warning) and it creates an 
empty output file:


  C:\Documents and Settings\SteveP>mitmdump -w mitmdump_20160123.txt
  e:\a p p 
s\python27\lib\site-packages\watchdog\observers\__init__.py:89: 
UserWarning: Failed to import read_directory_changes. Fall back to 
polling.
warnings.warn("Failed to import read_directory_changes. Fall back 
to polling.")


I haven't yet got mitmdump to actually write anything to the output 
file, but I expect that's just a matter of studying the mitmdump docs.


* * *
* * *

Thanks again for the response.

Best Regards,

Steve

P.S. Be assured -- I will soon be moving away from Windows XP to a new 
computer running Debian Linux.



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


Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Steve Petrie, P.Eng.
- Original Message - 
From: "Chris Angelico" 

To: "Steve Petrie, P.Eng." 
Cc: 
Sent: Saturday, January 23, 2016 2:56 PM
Subject: Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with 
"Permission denied" error (Python 2.7.11 on Win XP SP3);



In case other Windows XP "orphans" want to use mitmdump, here's what 
I

learned (via Google):

I changed the bang line (wrapping the pathname in double quotes) in 
file

mitmdump-script.py:

  from: #!e:\a p p s\python27\python.exe
 to: #!"e:\a p p s\python27\python.exe"


Spaces in names are often a pain. I'd raise this upstream as a bug
report - it should be fixed properly rather than depending on manual
editing.



I'd like to raise the bug report you suggest, but I'm not clear on the 
meaning of the word "upstream" in relation to Python-list. (I've seen 
"upstream" used by participants in another forum 
 and always wondered what "upstream" meant 
there.)


I know what "upstream" means, in terms of: water flow in a river, or 
vehicle flow on a highway, or data flow over a comms link. "upstream" is 
where a moving particle was, earlier in time


But my puzzlement is -- where is "upstream" in relation to an email 
forum, in the context of a thread?


The fix for the mitmdump bang line bug was applied to file 
mitmdump-script.py, and according to its "Date Modified" field on my Win 
XP, this file arrived in the e:\a p p s\Python27\Scripts\ directory, 
when I installed mitmproxy. So it looks to me like file 
mitmdump-script.py is a product of the mitmproxy project.


Am I correct in assuming, that "upstream" in the context of this present 
thread, means I should report the bang line bug to an mitmproxy forum?


Steve

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


.format won't display my value with 2 decimal places: Why?

2016-01-24 Thread Michael Sullivan
Hi.  I'm very very new to python.  I have been working my way through a 
free python pdf file I found (python3handson.pdf) and I'm having trouble 
with one of my programs:



'''discount.py

Exercise 1.14.3.1. * Write a program, discount.py, that prompts the user 
for an original price and
for a discount percentage and prints out the new price to the nearest 
cent. For example if the user enters
2.89 for the price and 20 for the discount percentage, the value would 
be (1- 20/100)*2.89, rounded to two
decimal places, 2.31. For price .65 with a 25 percent discount, the 
value would be (1- 25/100)*.65, rounded
to two decimal places, .49. 10 Write the general calculation code 
following the pattern of the calculations

illustrated in the two concrete examples.

'''

oPrice = 0
newPrice = 0
discount = 0

oPrice = input('What is the original price?  ')
discount = input('How much is this item discounted?  ')

oPrice = float(oPrice)
discount = float(discount)
newPrice = oPrice - (oPrice * discount)

print('The new price is {}' .format(newPrice, '.2f'))


When I run this thing, and I enter 5.00 for original price and .2 for 
the discount, it always results in 4.0.  When I entered my format 
function call directly into the shell, it comes out like I would expect:




>>> format(4.0, '.2f')
'4.00'


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


Please Unsubscribe

2016-01-24 Thread Dave Tan

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


Inform 1.1 - Printing and logging for command-line programs

2016-01-24 Thread Ken Kundert
Inform is a printing and logging package intended to manage the
communication to the user for command-line programs.  It allows the
simple creation of specialized print functions (informants) that
communicate messages to the user through stdout, stderr, or a logfile as
appropriate. Simply sprinkle these informants though out your code and
at start up indicate to inform how verbose the users wishes it to be and
it manages the informants accordingly.

URL: http://nurdletech.com/linux-utilities/inform
License: GPLv3+

Ken Kundert
inf...@nurdletech.com

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: scipy 0.17.0 release

2016-01-24 Thread Evgeni Burovski
Hi,

On behalf of the Scipy development team I am pleased to announce the
availability of Scipy 0.17.0. This release contains several new features,
detailed in the release notes below. 101 people contributed to this
release over the course of six months.

This release requires Python 2.6, 2.7 or 3.2-3.4 and NumPy 1.6.2 or
greater. Source tarballs and release notes can be found at
https://github.com/scipy/scipy/releases/tag/v0.17.0.

Thanks to everyone who contributed to this release.

Cheers,

Evgeni


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

==
SciPy 0.17.0 Release Notes
==

.. contents::

SciPy 0.17.0 is the culmination of 6 months of hard work. It contains
many new features, numerous bug-fixes, improved test coverage and
better documentation.  There have been a number of deprecations and
API changes in this release, which are documented below.  All users
are encouraged to upgrade to this release, as there are a large number
of bug-fixes and optimizations.  Moreover, our development attention
will now shift to bug-fix releases on the 0.17.x branch, and on adding
new features on the master branch.

This release requires Python 2.6, 2.7 or 3.2-3.5 and NumPy 1.6.2 or greater.

Release highlights:

- New functions for linear and nonlinear least squares optimization with
  constraints: `scipy.optimize.lsq_linear` and
  `scipy.optimize.least_squares`
- Support for fitting with bounds in `scipy.optimize.curve_fit`.
- Significant improvements to `scipy.stats`, providing many functions with
  better handing of inputs which have NaNs or are empty, improved
  documentation, and consistent behavior between `scipy.stats` and
  `scipy.stats.mstats`.
- Significant performance improvements and new functionality in
  `scipy.spatial.cKDTree`.


New features


`scipy.cluster` improvements
- 

A new function `scipy.cluster.hierarchy.cut_tree`, which determines a cut tree
from a linkage matrix, was added.

`scipy.io` improvements
- ---

`scipy.io.mmwrite` gained support for symmetric sparse matrices.

`scipy.io.netcdf` gained support for masking and scaling data based on data
attributes.

`scipy.optimize` improvements
- -

Linear assignment problem solver


`scipy.optimize.linear_sum_assignment` is a new function for solving the
linear sum assignment problem.  It uses the Hungarian algorithm (Kuhn-Munkres).

Least squares optimization
~~

A new function for *nonlinear* least squares optimization with constraints was
added: `scipy.optimize.least_squares`.  It provides several methods:
Levenberg-Marquardt for unconstrained problems, and two trust-region methods
for constrained ones.  Furthermore it provides different loss functions.
New trust-region methods also handle sparse Jacobians.

A new function for *linear* least squares optimization with constraints was
added: `scipy.optimize.lsq_linear`.  It provides a trust-region method as well
as an implementation of the Bounded-Variable Least-Squares (BVLS) algorithm.

`scipy.optimize.curve_fit` now supports fitting with bounds.

`scipy.signal` improvements
- ---

A ``mode`` keyword was added to `scipy.signal.spectrogram`, to let it return
other spectrograms than power spectral density.

`scipy.stats` improvements
- --

Many functions in `scipy.stats` have gained a ``nan_policy`` keyword, which
allows specifying how to treat input with NaNs in them: propagate the NaNs,
raise an error, or omit the NaNs.

Many functions in `scipy.stats` have been improved to correctly handle input
arrays that are empty or contain infs/nans.

A number of functions with the same name in `scipy.stats` and
`scipy.stats.mstats` were changed to have matching signature and behavior.
See `gh-5474 `__ for details.

`scipy.stats.binom_test` and `scipy.stats.mannwhitneyu` gained a keyword
``alternative``, which allows specifying the hypothesis to test for.
Eventually all hypothesis testing functions will get this keyword.

For methods of many continuous distributions, complex input is now accepted.

Matrix normal distribution has been implemented as `scipy.stats.matrix_normal`.

`scipy.sparse` improvements
- ---

The `axis` keyword was added to sparse norms, `scipy.sparse.linalg.norm`.

`scipy.spatial` improvements
- 

`scipy.spatial.cKDTree` was partly rewritten for improved performance and
several new features were added to it:

- - the ``query_ball_point`` method became significantly faster
- - ``query`` and ``query_ball_point`` gained an ``n_jobs`` keyword for parallel
  execution
- - build and query methods now release the GIL
- - full pickling support
- - support for periodic spaces
- - the ``sparse_distance_matrix`` method can 

pytest 2.8.6 released

2016-01-24 Thread Bruno Oliveira
Hey everyone,

I'm happy to announce pytest 2.8.6 has been released.

pytest is a widely used mature test runner both for unit and functional
tests in Python.
See http://pytest.org for documentation and examples.

Here are the fixes for this release:

- fix #1259: allow for double nodeids in junitxml,
  this was a regression failing plugins combinations
  like pytest-pep8 + pytest-flakes

- Workaround for exception that occurs in pyreadline when using
  ``--pdb`` with standard I/O capture enabled.
  Thanks Erik M. Bray for the PR.

- fix #900: Better error message in case the target of a ``monkeypatch``
call
  raises an ``ImportError``.

- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
  Thanks David R. MacIver for the report and Bruno Oliveira for the PR.

- fix #1223: captured stdout and stderr are now properly displayed before
  entering pdb when ``--pdb`` is used instead of being thrown away.
  Thanks Cal Leeming for the PR.

- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are
now
  properly displayed.
  Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.

- fix #628: fixed internal UnicodeDecodeError when doctests contain unicode.
  Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR.

- fix #1334: Add captured stdout to jUnit XML report on setup error.
  Thanks Georgy Dyuldin for the PR.

Thanks to all who contributed to this release, among them:

AMiT Kumar
Bruno Oliveira
Erik M. Bray
Florian Bruhin
Georgy Dyuldin
Jeff Widman
Kartik Singhal
Loïc Estève
Manu Phatak
Peter Demin
Rick van Hattem
Ronny Pfannschmidt
Ulrich Petri
foxx

Thanks for using pytest, enjoy the new release!

Cheers,
Bruno.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Sphinx 1.3.5 released

2016-01-24 Thread Takayuki Shimizukawa
Hi all,

I'm delighted to announce the release of Sphinx 1.3.5, now available on
the Python package index at .

It includes about 12 bug fixes for the 1.3 release series, among them a
regression in 1.3.4.

For the full changelog, go to <
http://www.sphinx-doc.org/en/1.3.5/changes.html>.
Thanks to all coraborators and contributers!


What is it?
===

Sphinx is a tool that makes it easy to create intelligent and beautiful
documentation for Python projects (or other documents consisting of
multiple reStructuredText source files).

Website: http://www.sphinx-doc.org/
IRC: #sphinx-doc on irc.freenode.net

Enjoy!
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: .format won't display my value with 2 decimal places: Why?

2016-01-24 Thread MRAB

On 2016-01-22 04:57:03, "Michael Sullivan"  wrote:

Hi.  I'm very very new to python.  I have been working my way through a 
free python pdf file I found (python3handson.pdf) and I'm having 
trouble with one of my programs:



'''discount.py

Exercise 1.14.3.1. * Write a program, discount.py, that prompts the 
user for an original price and
for a discount percentage and prints out the new price to the nearest 
cent. For example if the user enters
2.89 for the price and 20 for the discount percentage, the value would 
be (1- 20/100)*2.89, rounded to two
decimal places, 2.31. For price .65 with a 25 percent discount, the 
value would be (1- 25/100)*.65, rounded
to two decimal places, .49. 10 Write the general calculation code 
following the pattern of the calculations

illustrated in the two concrete examples.

'''

oPrice = 0
newPrice = 0
discount = 0

oPrice = input('What is the original price?  ')
discount = input('How much is this item discounted?  ')

oPrice = float(oPrice)
discount = float(discount)
newPrice = oPrice - (oPrice * discount)

print('The new price is {}' .format(newPrice, '.2f'))


When I run this thing, and I enter 5.00 for original price and .2 for 
the discount, it always results in 4.0.  When I entered my format 
function call directly into the shell, it comes out like I would 
expect:




>>> format(4.0, '.2f')
'4.00'


What exactly am I doing wrong here?

You're confusing the builtin 'format' function with the 'format' method 
of the 'str' class.


The format function accepts a value and a format:

>>> format(4.0, '.2f')
'4.00'
The format method, on the other hand, belongs to the format string it's 
attached to. In this example:


'The new price is {}' .format(newPrice, '.2f')

the format string is 'The new price is {}' and you're calling its 
'format' method with 2 values for that string, the first being 4.0 
(used) and the second on being '.2f' (unused).


What you want is:

print('The new price is {:.2f}'.format(newPrice))

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


Re: Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-24 Thread Pete Dowdell

On 24/01/16 07:27, Robert James Liguori wrote:

Is there a python library to calculate longitudinal acceleration, lateral 
acceleration and normal acceleration?


Might be rocket science...

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


PyDev 4.5.3 Released

2016-01-24 Thread Fabio Zadrozny
Release Highlights:
---

* Debugger

* Fixed issue in set next statement (#PyDev 651).

* pydevd.settrace was stopping inside the debugger and not in user code
(#PyDev 648).

* subprocess.Popen could crash when running non python executable (#PyDev
650).

* PyUnit view

* The last pinned test suite appears as the first entry in the history.

* More information is shown on the test run history.

* A string representation of the test suite can be saved in the clipboard
(last item in the test run history).

* Indexing: fixed issue where the indexing and code-analysis could race
with each other and one could become corrupt.


What is PyDev?
---

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com


What is LiClipse?
---

LiClipse is a PyDev standalone with goodies such as support for Multiple
cursors, theming, TextMate bundles and a number of other languages such as
Django Templates, Jinja2, Kivy Language, Mako Templates, Html, Javascript,
etc.

It's also a commercial counterpart which helps supporting the development
of PyDev.

Details on LiClipse: http://www.liclipse.com/



Cheers,

--
Fabio Zadrozny
--
Software Developer

LiClipse
http://www.liclipse.com

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com

PyVmMonitor - Python Profiler
http://www.pyvmmonitor.com/
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Larry Hudson via Python-list

On 01/23/2016 11:43 AM, Steve Petrie, P.Eng. wrote:
[snip]

I'm not sure what your exact problem is, but I can say that it isn't
this; the Unix-style forward slash is perfectly legal under Windows
(and it's even legal to mix and match).

ChrisA


I never knew that the forward slash is legal under Windows -- thanks for the 
tip :)


A minor clarification...

If the path string is typed directly into Windows where it is parsed by (whatever is the current 
equivalent of) command.com, forward slashes are NOT accepted.  Because there it is used to 
indicate command-line options.


But if this string comes from a program where it is parsed by an API, it IS accepted.  And this 
has been the case even since MSDOS prior to Windows.


 -=- Larry -=-

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