Re:

2015-12-21 Thread eryk sun
On Mon, Dec 21, 2015 at 3:08 AM, Animesh Srivastava  wrote:
> While installin python3.5.1 i m getting 0xc07b error

0xC07B is STATUS_INVALID_IMAGE_FORMAT, so there's something wrong
with the executable. Try clearing your browser cache and download the
installer again.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ignore error with non-zero exit status

2015-12-21 Thread Ian Kelly
On Sun, Dec 20, 2015 at 3:46 PM, Thomas 'PointedEars' Lahn
 wrote:
> Chris Angelico wrote:
>
>> On Mon, Dec 21, 2015 at 8:22 AM, Thomas 'PointedEars' Lahn
>>  wrote:
>
> It is supposed to be an attribution *line*, _not_ an attribution novel.
> Also, the “(was: …)” part is to be removed from the Subject header field
> value to complete the change of subject in a thread.

Better yet, please don't change the Subject header for trivial reasons
in the first place. This isn't just a Usenet group; it's also a
mailing list, and many MUAs rely on the Subject header for proper
threading.
-- 
https://mail.python.org/mailman/listinfo/python-list


Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Ben Finney
Ian Kelly  writes:

> Better yet, please don't change the Subject header for trivial reasons
> in the first place.

When the subject of the ongoing discussion changes, it's normal to
change the Subject field accordingly.

I agree with your admonition against trivial alterations to that field;
I hope you agree with me that it is not trivial, but rather is normal
and helpful, to update the Subject field to track significant changes in
the subject of the discussion.

> This isn't just a Usenet group; it's also a mailing list, and many
> MUAs rely on the Subject header for proper threading.

If such MUAs do that, they're misinterpreting the Subject field. Other
fields are available with the explicit meaning of relating messages to
each other regardless of what they discuss.

If the correct fields are being mangled, then the correct place to apply
pressure is on those who can fix that error. Let's not overload the
Subject field to make up the lack.

-- 
 \   “Self-respect: The secure feeling that no one, as yet, is |
  `\suspicious.” —Henry L. Mencken |
_o__)  |
Ben Finney

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


Re: What could cause a plot fail in my code?

2015-12-21 Thread Peter Otten
Robert wrote:

> Hi,
> 
> I find a useful code snippet on link:
> 
> http://stackoverflow.com/questions/25126444/logistic-regression-in-pymc/34400966#34400966
> 
> but it has error on plot function. The error message is as following:
> -
> %run "C:\Users\rj\pyprj\logic_regression0.py"
> [-100%-] 1 of 1 complete in 12.6  
> [secPlotting beta0
> Plotting tau
> Plotting betaSalad
> Plotting sigma
> 
---
> UnboundLocalError Traceback (most recent call
> last) C:\Users\pyprj\logic_regression0.py in ()
>  34 #m.sample(10, 5, 50)
>  35 m.sample(1, 5000, 50)
> ---> 36 pm.Matplot.plot(m)
>  37 import matplotlib.pyplot as plt
>  38 #plt.plot(m)
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
> packages\pymc\Matplot.pyc in wrapper(pymc_obj, *args, **kwargs)
> 339 if args:
> 340 name = '%s_%s' % (args[0],
> variable.__name__)
> --> 341 f(data, name, *args, **kwargs)
> 342 return
> 343 except AttributeError:
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\pymc\Matplot.pyc
> in plot(data, name, format, suffix, path,  common_scale, datarange, new,
> last, rows, num, fontmap, verbose)
> 453 num=num * 2,
> 454 last=last,
> --> 455 fontmap=fontmap)
> 456
> 457 if last:
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\pymc\Matplot.pyc
> in wrapper(pymc_obj, *args, **kwargs)
> 375
> 376 # If others fail, assume that raw data is passed
> --> 377 f(pymc_obj, *args, **kwargs)
> 378
> 379 wrapper.__doc__ = f.__doc__
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\pymc\Matplot.pyc
> in histogram(data, name, bins, datarange, format, suffix, path, rows,
> columns, num, last, fontmap, verbose)
> 576
> 577 # Generate histogram
> --> 578 hist(data.tolist(), bins, histtype='stepfilled')
> 579
> 580 xlim(datarange)
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\matplotlib\pyplot.py
> in hist(x, bins, range, normed, weights, cumulative, bottom, histtype,
> align, orientation, rwidth, log, color, label, stacked, hold, data,
> **kwargs)
>2956   histtype=histtype, align=align,
>orientation=orientation,
>2957   rwidth=rwidth, log=log, color=color,
>label=label,
> -> 2958   stacked=stacked, data=data, **kwargs)
>2959 finally:
>2960 ax.hold(washold)
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\matplotlib\__init__.py
> in inner(ax, *args, **kwargs)
>1809 warnings.warn(msg % (label_namer,
>func.__name__),
>1810   RuntimeWarning, stacklevel=2)
> -> 1811 return func(ax, *args, **kwargs)
>1812 pre_doc = inner.__doc__
>1813 if pre_doc is None:
> 
> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-
packages\matplotlib\axes\_axes.py
> in hist(self, x, bins, range, normed, weights, cumulative, bottom,
> histtype, align, orientation, rwidth, log, color, label, stacked,
> **kwargs)
>6192 ymin = np.amin(m[m != 0])
>6193 # filter out the 0 height bins
> -> 6194 ymin = max(ymin*0.9, minimum) if not input_empty
> else minimum
>6195 ymin = min(ymin0, ymin)
>6196 self.dataLim.intervaly = (ymin, ymax)
> 
> UnboundLocalError: local variable 'ymin' referenced before assignment
> /
> 
> I have no clue at all on debug it. Could you help me?

To me that looks like a bug in matplotlib. ymin is not properly initialised 
before the loop

"""
for m in n:
if np.sum(m) > 0:  # make sure there are counts
ymin = np.amin(m[m != 0])
# filter out the 0 height bins
ymin = max(ymin*0.9, minimum) if not input_empty else 
minimum
"""

so if for there aren't any m with np.sum(m) > 0 (i. e. all bins are empty) 
you get the error. Here's a made-up example for illustration:

>>> def last_positive_item(items):
... for item in items:
... if item > 0:
... last = item
... return last
... 

As long as you pass at least one positive item everything seems OK:

>>> last_positive_item([1, 2, -3, 3])
3

But if you don't you get the error:

>>> last_positive_item([-1, -2, -3, 0])
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 5, in last_positive_item
UnboundLocalError: local variable 'last' referenced before assignment

Please file a bug report if there isn't one already.

-- 

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread Марк Коренберг

Марк Коренберг added the comment:

So, I'm required to re-implement NamedTemporaryFile by hand like that:


fd, name = tempfile.mkstemp(...)
try:
with io.open(fd, ...) as fff:
fff.write('hello')
fff.flush()
os.fdatasync(fff)
os.rename(name, ...)
except:
os.unlink(name)
raise


This is sad to see...

--

___
Python tracker 

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



Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Ian Kelly
On Mon, Dec 21, 2015 at 1:58 PM, Ben Finney  wrote:
> Ian Kelly  writes:
>> This isn't just a Usenet group; it's also a mailing list, and many
>> MUAs rely on the Subject header for proper threading.
>
> If such MUAs do that, they're misinterpreting the Subject field. Other
> fields are available with the explicit meaning of relating messages to
> each other regardless of what they discuss.
>
> If the correct fields are being mangled, then the correct place to apply
> pressure is on those who can fix that error. Let's not overload the
> Subject field to make up the lack.

It might just be Gmail.

http://webapps.stackexchange.com/questions/965/how-does-gmail-decide-to-thread-email-messages

I can't specifically recall if I've used any MUA other than Gmail that
even attempts threading email messages.
-- 
https://mail.python.org/mailman/listinfo/python-list


How can I produce ARFF files using word2vec-toolkit

2015-12-21 Thread saurabhtiwaririshi
I am doing a machine learning project and I need ARFF files to feed my data to 
Weka. 
How can I use word2-vec to produce ARFF files.
An example would be much helpful.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25919] htp.client PUT method ignores error responses sent immediatly after headers

2015-12-21 Thread R. David Murray

R. David Murray added the comment:

Perhaps by doing non-blocking reads between the writes[*]? I suppose it is 
possible, but it might complicate the code considerably.

[*] or re-write it using asyncio, but that is definitely out of scope :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread R. David Murray

R. David Murray added the comment:

You'd have to do that anyway if we implemented a delete=False constructor 
argument, since you want it deleted if there are any errors, and that's not 
what a delete=False API would do.  

If it were me, I'd write it (untested)

  @contextlib.contextmanager
  def open_for_atomic_replace(fn):
try:
fd, name = tempfile.mkstemp()
with io.open(fd) as fff:
yield fff
fff.flush()
os.fdatasync(fff)
os.rename(name, fn)
except BaseException:
os.unlink(name)
raise

which would make your code simpler than it is now.

Naming it 'open_for_atomic_replace' reminded me of issue 8604, which is what 
you really want, not delete=False.

--

___
Python tracker 

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



[issue25919] htp.client PUT method ignores error responses sent immediatly after headers

2015-12-21 Thread SilentGhost

Changes by SilentGhost :


--
components: +Library (Lib) -IO
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue25919] htp.client PUT method ignores error responses sent immediatly after headers

2015-12-21 Thread Wiktor Niesiobedzki

New submission from Wiktor Niesiobedzki:

It looks like, when doing PUT together with a file-like object to send, 
http.client will try to send the whole file before analysing the response from 
the server.

If you do the following:
$ dd if=/dev/zero of=/tmp/300mb.zero bs=1M count=300

And then run following code in Python 3.4 (tested 3.4.3 on Linux and FreeBSD):
import http.client
conn = http.client.HTTPSConnection('api.onedrive.com')
req = conn.request(
method='PUT',
url='https://api.onedrive.com/v1.0/drives/me/root:/test.file:/content',
body=open("/tmp/300mb.zero", "rb"))
resp = conn.getresponse()

You'll notice the hang. After some time, it will aborted with BrokenPipeError: 
[Errno 32] Broken pipe. If you run the following code within pdb debugger, and 
interrupt, you'll probably interrupt somewhere within write loop. You can call 
self.read() and see, that HTTP 413 is waiting to be interpreted.

Doing similar action with curl:
$ $ curl -v -T /tmp/300mb.zero 
https://api.onedrive.com/v1.0/drives/me/root:/test.file:/content

Gives you immediate HTTP 413 error. Can we have the same behaviour in 
http.client library?

--
components: IO
messages: 256808
nosy: Wiktor Niesiobedzki
priority: normal
severity: normal
status: open
title: htp.client PUT method ignores error responses sent immediatly after 
headers
type: behavior
versions: 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: IDLE 3.5.1 quits unexpectedly (portuguese keyboard)

2015-12-21 Thread eryk sun
On Fri, Dec 18, 2015 at 9:15 PM, Osvaldo Dias dos Santos
 wrote:
>
> Pressing the tilde key my iMac portuguese keyboard quits IDLE
> unexpectedly (along with any associated files I may be working
> on, including code).
>
> The keyboard image is attached. The tilde key is the second
> orange one from the top.

There's no file attached. Attachments are unreliable on a list. This
should suffice:

https://en.wikipedia.org/wiki/Portuguese_keyboard_layout

> This key is very important in this language, because pressing
> it together with the shift key, the caret ( ^ ) symbol is
> entered. So, if I try to enter a caret and press the shift and
> the tilde key to do it, IDLE quits and any unsaved file
> information (even code) is lost. Then Apple crash report window
> opens, but if I click the reopen button nothing happens, IDLE
> does not reopen.

I know on Linux, Tk 8.6 has a problem with dead keys when using an
international keyboard layout (see issue 25356 [1]). This crash could
be related to whatever causes the problem on Linux. Try running a
simple test.tcl script via wish:

text .t
pack .t

Does wish crash when you press tilde in the window?

[1]: http://bugs.python.org/issue25356
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: (Execution) Termination bit, Alternation bit.

2015-12-21 Thread Grant Edwards
On 2015-12-21, Dennis Lee Bieber  wrote:
> On Mon, 21 Dec 2015 13:40:21 +0100, "Skybuck Flying"
> declaimed the following:
>
>>The original idea I posted is less about sending a signal to another 
>>processor.
>>
>>It is more about how to break out of an instruction sequence.
>>
>>Example of problem:
>>
>>Main:
>>while Condition1 do
>>begin
>>while Condition2 do
>>begin
>>while Condition3 do
>>begin
>>Routine1
>>end
>>end;
>>end;
>>
>   I do hope this is the result of over simplification for the example, as
> otherwise I'd turn it into
>
> while C1 and  C2 and C3:
>   R1

That's not equivalent to what Skybuck posted.  Think about what
happens when Routine1 causes Condition1 and Condition2 to become false
but Condition3 remains true.

Not that this means that all rest of what Skyhawk posted makes any
sense at all.  I've spent a lot of time programming on "bare metal",
in assembly, Pascal, PL/M, and C (including using coroutines and
various other "multi-thread" constructs with no OS support), and I
really don't see the utility of his initial suggestion.

-- 
Grant Edwards   grant.b.edwardsYow! What a COINCIDENCE!
  at   I'm an authorized "SNOOTS
  gmail.comOF THE STARS" dealer!!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25827] Support ICC in configure

2015-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d7b5c2f99a99 by Zachary Ware in branch '2.7':
Issue #25827: Add support for ICC to configure
https://hg.python.org/cpython/rev/d7b5c2f99a99

New changeset c5e419464585 by Zachary Ware in branch '3.5':
Issue #25827: Add support for ICC to configure
https://hg.python.org/cpython/rev/c5e419464585

New changeset 29ea3827cfaa by Zachary Ware in branch 'default':
Issue #25827: Merge with 3.5
https://hg.python.org/cpython/rev/29ea3827cfaa

--
nosy: +python-dev

___
Python tracker 

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



In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron
Hello,

I am trying to figure out how to populate a shelve file with a nested 
dictionary.

These are my requirements:

-Create shelve file called people.db
-Append the shelve file with new people (person_1, person_2, etc.).
-Use a for loop to iterate through 'attributes' so that I do not need to write 
out the lengthy code line by line to populate to the shelve file.
-Need to reference shelve file data for future use

Here is the key/value format that I would like to append to the shelve file.

person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
[{'game': 'basketball', 'high score': '100', 'time': '3.34'},
{'game': 'bridge', 'high score': '10', 'time': '30.34'},
{'game': 'foosball', 'high score': '2', 'time': '24'}]
'''
50+ other attributes
'''
}

# Example: s['person_1]['attributes'][2]['time'] would call out '24'.
# 's' is from 's = shelve.open('people')'
I have a dictionary dictPeople.py file (created using pprint() that contains 
the information of person_1, etc. And I am extracting only a small percentage 
of the data that is needed.

I have tried the following, but I get an invalid key error.

import shelve, dictPeople
s = shelve.open('people')
person = 'person_1'
s[person]['name'] = dictPeople.person_1['name']
s[person]['type'] = dictPeople.person_1['type']
# I need to use this for loop because there are 50+ attributes.
for attribute in range(0, len(dictPeople['attributes'][attribute])):
s[person]['attributes'][attribute]['game'] = \
dictPeople['attributes'][attribute]['game']
s[person]['attributes'][attribute]['high score'] = \
dictPeople['attributes'][attribute]['high score']
s[person]['attributes'][attribute]['time'] = \
dictPeople['attributes'][attribute]['time']
It turns out, I get the key error because I am not allowed to reference a 
key/value pair the same way that I can with a dictionary. However, the crazy 
thing is that I can call values in the db file using the same exact format when 
trying to write.

For example: I can read data from the .db file using:

x = s['person_1']['name']
print(x)
BUT! I cannot write to that .db file using that exact format or I get an 
invalid key error. Makes no sense!

s['person_1']['name'] = 'Bob'
# Returns invalid key entry.  Makes no sense.
Therefore, I tried to extract data and populate the db file using the following:

s[person] = {   'name': dictPeople.person_1['name'],
'type': dictPeople.person_1['type'],
for attribute in range(0, len(dictPeople['attributes'][attribute])):
['game':  dictPeople['attributes'][attribute]['game'],
'high score': dictPeople['attributes'][attribute]['high score'],
'time': dictPeople['attributes'][attribute]['time']]

}
But, this obvously doesn't work because of the for loop. How can I do this?

-I am trying to figure out how to extract data from the dictionary 
dictPeople.py file and store it in the people.db file.
-I am trying to add new people to the people.db file as more people become 
available.
-I need to use the for loop because of the 50+ attributes I need to add.
-My future steps would be to modify some of the data values that I extract and 
used to populate the people.db file, but my first step is to, at least, 
extract, and then populate the people.db file.

Any help or guidance is greatly appreciated.  Thank you for your time and 
reading my question.

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


[issue25914] Fix OrderedDict.__sizeof__

2015-12-21 Thread Eric Snow

Eric Snow added the comment:

LGTM

Thanks for doing that.  It's definitely cleaner. :)

--
stage: patch review -> commit review

___
Python tracker 

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



Re: Ignore error with non-zero exit status

2015-12-21 Thread Ian Kelly
On Dec 21, 2015 4:55 PM, "Terry Reedy"  wrote:
>
> Nothing has changed since except for
> https://www.python.org/dev/peps/pep-0498/
> already added to 3.6.

https://xkcd.com/927/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread R. David Murray

R. David Murray added the comment:

Oh, you are right of course.  I thought I was looking at _mkstemp_inner but in 
fact my edit window was over NamedTemporaryFile...I just wasn't paying 
attention.

I have no opinion myself as to whether it is worth the effort/code complexity 
to implement this behavior cross platform.

--

___
Python tracker 

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



Re: Ignore error with non-zero exit status

2015-12-21 Thread Chris Angelico
On Tue, Dec 22, 2015 at 11:17 AM, Ian Kelly  wrote:
> On Dec 21, 2015 4:55 PM, "Terry Reedy"  wrote:
>>
>> Nothing has changed since except for
>> https://www.python.org/dev/peps/pep-0498/
>> already added to 3.6.
>
> https://xkcd.com/927/

The 927ness of it was discussed at length prior to implementation. PEP
498 isn't really another competing string format operation; it's more
like an alternative expression format. It's more in competition with
this:

msg = "The sum of " + str(x) + " and " + str(y) + " is " + str(x+y) + "."

which puts the interpolated expressions at the "correct place" in the
string - but at the cost of being verbose, messy, and error-prone.
Compare:

msg = f"The sum of {x} and {y} is {x+y}."

(Yes, there's a slight semantic difference; the latter uses format()
rather than str(). But otherwise, it's compiled to the "".join(...)
equivalent of the repeated concatenation example.)

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


In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron Christensen
Hello,

I am trying to figure out how to populate a shelve file with a nested
dictionary.

These are my requirements:

-Create shelve file called people.db
-Append the shelve file with new people (person_1, person_2, etc.).
-Use a for loop to iterate through 'attributes' so that I do not need to
write out the lengthy code line by line to populate to the shelve file.
-Need to reference shelve file data for future use

Here is the key/value format that I would like to append to the shelve
file.

person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
[{'game': 'basketball', 'high score': '100', 'time': '3.34'},
{'game': 'bridge', 'high score': '10', 'time': '30.34'},
{'game': 'foosball', 'high score': '2', 'time': '24'}]
'''
50+ other attributes
'''
}

# Example: s['person_1]['attributes'][2]['time'] would call out '24'.
# 's' is from 's = shelve.open('people')'
I have a dictionary dictPeople.py file (created using pprint() that
contains the information of person_1, etc. And I am extracting only a small
percentage of the data that is needed.

I have tried the following, but I get an invalid key error.

import shelve, dictPeople
s = shelve.open('people')
person = 'person_1'
s[person]['name'] = dictPeople.person_1['name']
s[person]['type'] = dictPeople.person_1['type']
# I need to use this for loop because there are 50+ attributes.
for attribute in range(0, len(dictPeople['attributes'][attribute])):
s[person]['attributes'][attribute]['game'] = \
dictPeople['attributes'][attribute]['game']
s[person]['attributes'][attribute]['high score'] = \
dictPeople['attributes'][attribute]['high score']
s[person]['attributes'][attribute]['time'] = \
dictPeople['attributes'][attribute]['time']
It turns out, I get the key error because I am not allowed to reference a
key/value pair the same way that I can with a dictionary. However, the
crazy thing is that I can call values in the db file using the same exact
format when trying to write.

For example: I can read data from the .db file using:

x = s['person_1']['name']
print(x)
BUT! I cannot write to that .db file using that exact format or I get an
invalid key error. Makes no sense!

s['person_1']['name'] = 'Bob'
# Returns invalid key entry.  Makes no sense.
Therefore, I tried to extract data and populate the db file using the
following:

s[person] = {   'name': dictPeople.person_1['name'],
'type': dictPeople.person_1['type'],
for attribute in range(0, len(dictPeople['attributes'][attribute])):
['game':  dictPeople['attributes'][attribute]['game'],
'high score': dictPeople['attributes'][attribute]['high score'],
'time': dictPeople['attributes'][attribute]['time']]

}
But, this obvously doesn't work because of the for loop. How can I do this?

-I am trying to figure out how to extract data from the dictionary
dictPeople.py file and store it in the people.db file.
-I am trying to add new people to the people.db file as more people become
available.
-I need to use the for loop because of the 50+ attributes I need to add.
-My future steps would be to modify some of the data values that I extract
and used to populate the people.db file, but my first step is to, at least,
extract, and then populate the people.db file.

Any help or guidance is greatly appreciated.  Thank you for your time and
reading my question.

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


Re: Ignore error with non-zero exit status

2015-12-21 Thread Steven D'Aprano
On Tue, 22 Dec 2015 09:27 am, Thomas 'PointedEars' Lahn wrote:

[...]
> No, it is not.  Your logic is flawed, too, pseudonymous nobody with the
> unreadable posting style.

If its unreadable, how do you know what it says?

"PointedEars", you're doing a marvellous job of acting like a self-righteous
and hypocritical buffoon who constantly complains about the most trivial
matters when committed by others, while ignoring that you do the same sort
of things.

You whinge about others using "fake names", whatever that means, when you
yourself go by a fake name "PointedEars".

You whinge about people's attribution lines extending over two virtual
lines, as if that matters, while ignoring the fact that your sig is twice
as long as is polite.

You whinge about people posting "dumb questions", while continuing to post
dumb answers.

When you make an error of logic, your response is never to accept that you
were wrong, but you just compound the error by insisting that the other
party is the one with flawed logic.

So, Thomas, if that is your real name, get over yourself. I don't know what
small pond you have come from, but you're in the big ocean of the Internet
now, and you're no longer the smartest person around. Admit it when you
make a mistake, and stop being such so whiny, prissy and unhelpful.

Or, if you can't do that, just go away and whine on some other newsgroup
where they might be impressed by your astonishing lack of social know-how.

Thank you.


-- 
Steven

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


Re: Library function to encode data to multipart/form-data format?

2015-12-21 Thread Laura Creighton
In a message of Mon, 21 Dec 2015 17:51:00 +, Grant Edwards writes:
>Is there a standard library function that can be used to encode data
>into multipart/form-data format?  IIRC, I looked for this once before
>and didn't find anything in the library. 
>
>[I don't want to actually send an HTTP POST or an email message, I
>just need to generate sets of data for test purposes.]
>
>-- 
>Grant Edwards   grant.b.edwardsYow! -- I love KATRINKA
>  at   because she drives a
>  gmail.comPONTIAC.  We're going
>   away now.  I fed the cat.
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Cannibalise this:
http://code.activestate.com/recipes/146306/
which just uses standard library things.

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


[issue25920] PyOS_AfterFork should reset socketmodule's lock

2015-12-21 Thread A. Jesse Jiryu Davis

New submission from A. Jesse Jiryu Davis:

On some platforms there's an exclusive lock in socketmodule, used for 
getaddrinfo, gethostbyname, gethostbyaddr. A thread can hold this lock while 
another forks, leaving it locked forever in the child process. Calls to these 
functions in the child process will hang.

(I wrote some more details here: 
https://emptysqua.re/blog/getaddrinfo-deadlock/ )

I propose that this is a bug, and that it can be fixed in PyOS_AfterFork, where 
a few similar locks are already reset.

--
messages: 256815
nosy: emptysquare
priority: normal
severity: normal
status: open
title: PyOS_AfterFork should reset socketmodule's lock

___
Python tracker 

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



[issue25920] PyOS_AfterFork should reset socketmodule's lock

2015-12-21 Thread Ionel Cristian Mărieș

Changes by Ionel Cristian Mărieș :


--
nosy: +ionelmc

___
Python tracker 

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



[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread Eryk Sun

Eryk Sun added the comment:

> To extend support for this to Windows, we can add a 
> feature to mkstmp to not use O_TEMPORARY

O_TEMPORARY is only used for NamedTemporaryFile, not mkstemp. 

Regarding NamedTemporaryFile, that can be worked around to keep Windows from 
deleting the file. Just open a second handle with DELETE (0x0001) access 
before closing the first one. Then close the first handle. Finally, use the 
second handle to call SetFileInformationByHandle [1] to remove the delete 
disposition. 

Since using O_TEMPORARY opens the file with DELETE access, you have to open the 
new handle with delete sharing. Unfortunately the CRT only provides O_TEMPORARY 
for opening a file with delete access and delete sharing, so just call 
CreateFile [2] directly instead. For example:

>>> import os, tempfile, msvcrt, ctypes
>>> kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
>>> f1 = tempfile.NamedTemporaryFile()
>>> f1.write(b'spam')
4
>>> h = kernel32.CreateFileW(f1.name, 0xC001, 7,
...  None, 3, 0x80, None)
>>> f1.close()
>>> os.path.exists(f1.name) # really, it does exist
False
>>> info = (ctypes.c_int * 1)(0)
>>> kernel32.SetFileInformationByHandle(h, 4, info, 4)
1
>>> os.path.exists(f1.name)
True
>>> f2 = os.fdopen(msvcrt.open_osfhandle(h, os.O_RDWR), 'r+')
>>> f2.read()
'spam'

Notice that right after f1 is closed, os.path.exists(f1.name) lies, saying the 
file no longer exists. The problem is you can't stat the file at this point 
because you can't open a *new* handle to a file that's marked for deletion. But 
you can use the existing handle to remove the delete disposition, after which 
the file is resurrected.

Also note that the FILE_DISPOSITION_INFO [3] docs say "t]his member has no 
effect if the handle was opened with FILE_FLAG_DELETE_ON_CLOSE". That's 
referring literally to the handle passed to SetFileInformationByHandle. 

Microsoft publishes the source for the FAT filesystem, so I could provide links 
for how this is implemented. Basically every kernel file object has a context 
control block (CCB) that points at an underlying kernel filesystem structure 
such as a file control block (FCB) or NTFS link/stream control block (LCB / 
SCB). When the file object is closed, the delete-on-close flag in the CCB gets 
transferred over to the underlying control structure and the delete disposition 
is set. You can't remove the CCB flag from the kernel file object (as the 
documentation correctly notes), but as long as you have an open handle to a 
file object whose CCB does not have this flag, you can use this other file 
handle to remove the delete disposition and make the file permanent. Just make 
sure to first close all file objects that do have the CCB delete-on-close flag 
because otherwise they'll just set the delete disposition again when closed.

[1]: https://msdn.microsoft.com/en-us/library/aa365539
[2]: https://msdn.microsoft.com/en-us/library/aa363858
[3]: https://msdn.microsoft.com/en-us/library/aa364221

--
nosy: +eryksun

___
Python tracker 

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



[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-21 Thread STINNER Victor

STINNER Victor added the comment:

Python 3.5.0 and 3.5.1 are out. I don't think that it's worth to add back
bytes support is os.walk() in 3.5.2. I would prefer to do the opposite and
really drop bytes support for all filenames in the whole stdlib in 3.6.

It's really a bad idea to use bytes on Windows. With Python 3, it becomes
possible and simple to handle filenames as Unicode on all platforms and in
all cases (see PEP 393 for undecodable filenames).

--

___
Python tracker 

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



[issue13317] building with 2to3 generates wrong import paths because build_ext is run after build_py

2015-12-21 Thread Éric Araujo

Éric Araujo added the comment:

I’m not active in python-dev anymore.

The fix was noted in a previous comment:

build.sub_commands in distutils.command.build should list "build_ext" before 
"build_py".
lib2to3.fixes.fix_import will write global instead of local import statements 
else.

--
assignee: eric.araujo -> 
components:  -Distutils2
nosy: +dstufft
versions: +Python 3.5 -3rd party, Python 3.2, Python 3.3

___
Python tracker 

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



Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Jon Ribbens
On 2015-12-21, Steven D'Aprano  wrote:
> On Tue, 22 Dec 2015 08:44 am, Jon Ribbens wrote about mail clients that use
> the Subject line to thread messages:
>> Also: Thunderbird, The Bat!, Eudora, Gnus, Outlook, Outlook Express,
>> Pegasus Mail, Pine, Apple Mail, Windows Live Mail, Yahoo Mail,
>> Evolution, SquirrelMail, KMail, Windows Mail, etc.
>
> I understand that at least some of those will only use the Subject as a
> fallback when other threading information is not available. That's a
> reasonable strategy to take.
>
> As for mail clients that *always* and *exclusively* use the subject
> line to implement threading, they are horrifically broken.

Yes, that would be bizarre and clearly wrong. Are there any such clients?
I wouldn't put it past Microsoft to do such a thing, of course ;-)

> So as far as I am concerned, if changes of subject line breaks
> threading for you, so sad, too bad. Go without threading or use a
> better mail client.

I have no comment on that.

> The whole purpose of the change of subject is to indicate in a human-visible
> way that the subject of the thread has changed, i.e. that it is a new
> thread derived from the old one. If that breaks threading, oh well, it
> breaks threading.

That sounds a bit confused - if the *intention* of changing the
subject line is to create a new thread, then breaking the thread
is not "breaking threading" ;-)

>> And, yes, fixing the mail clients of "everybody else in the world"
>> might be a lovely idea but it is a little impractical to implement.
>
> Less impractical than insisting that "everybody else in the world" must
> change their posting habits to suit those using broken mail clients.

Fortunately I haven't suggested that.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25920] PyOS_AfterFork should reset socketmodule's lock

2015-12-21 Thread Yury Selivanov

Yury Selivanov added the comment:

Maybe instead of releasing the lock in the forked child process, we should try 
to acquire the lock in the os.fork() implementation, and then release it?

Otherwise, suppose that a call to getaddrinfo (call #1) takes a long amount of 
time.  In the middle of it we fork, and then immediately try to call 
getaddrinfo (call #2, and call #1 is still happening) for some other address. 
At this point, since getaddrinfo isn't threadsafe, something bad will happen.

--

___
Python tracker 

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



Re: Ignore error with non-zero exit status

2015-12-21 Thread Terry Reedy

On 12/21/2015 9:05 AM, Thomas 'PointedEars' Lahn wrote:

Chris Angelico wrote:


On Tue, Dec 22, 2015 at 12:19 AM, Thomas 'PointedEars' Lahn
 wrote:

Mark Lawrence wrote:

On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:

Chris Angelico wrote:

But it's been clearly stated that .format is not going to do away with
percent formatting, and all language of "new-style formatting" has
been removed so as not to cause confusion.

Wishful thinking, twice.

http://www.gossamer-threads.com/lists/python/dev/969817

What is this supposed to be evidence of?


Proof that percent formatting isn't planned for deprecation, much less
removal.


Then it would have failed to accomplish that.


There is strong support for it in certain quarters of python-dev. […]


There *was*.  The referred thread is from 2012-02.  It is 2015-12.


Nothing has changed since except for
https://www.python.org/dev/peps/pep-0498/
already added to 3.6.

If the 2.7 doc still implies that % -formatting is deprecated, it should 
changed as in the 3.x docs.


--
Terry Jan Reedy


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


[issue19475] Add timespec optional flag to datetime isoformat() to choose the precision

2015-12-21 Thread Alessandro Cucci

Alessandro Cucci added the comment:

Uploaded a new patch after SilentGhost review comments.

As he told me, I've left out milliseconds and nanoseconds, but refactored both 
python and c code so we could easily add support for them when they will be 
available.

--
Added file: http://bugs.python.org/file41381/issue19475_v6.patch

___
Python tracker 

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



[issue25920] PyOS_AfterFork should reset socketmodule's lock

2015-12-21 Thread Yury Selivanov

Changes by Yury Selivanov :


--
components: +Interpreter Core
nosy: +haypo, yselivanov
stage:  -> needs patch
type:  -> behavior
versions: +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



[issue25920] PyOS_AfterFork should reset socketmodule's lock

2015-12-21 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Peter Otten
Aaron Christensen wrote:

> Hello,
> 
> I am trying to figure out how to populate a shelve file with a nested
> dictionary.
> 
> These are my requirements:
> 
> -Create shelve file called people.db
> -Append the shelve file with new people (person_1, person_2, etc.).
> -Use a for loop to iterate through 'attributes' so that I do not need to
> write out the lengthy code line by line to populate to the shelve file.
> -Need to reference shelve file data for future use
> 
> Here is the key/value format that I would like to append to the shelve
> file.
> 
> person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
> [{'game': 'basketball', 'high score': '100', 'time': '3.34'},
> {'game': 'bridge', 'high score': '10', 'time': '30.34'},
> {'game': 'foosball', 'high score': '2', 'time': '24'}]
> '''
> 50+ other attributes
> '''
> }
> 
> # Example: s['person_1]['attributes'][2]['time'] would call out '24'.
> # 's' is from 's = shelve.open('people')'
> I have a dictionary dictPeople.py file (created using pprint() that
> contains the information of person_1, etc. And I am extracting only a
> small percentage of the data that is needed.
> 
> I have tried the following, but I get an invalid key error.
> 
> import shelve, dictPeople
> s = shelve.open('people')
> person = 'person_1'
> s[person]['name'] = dictPeople.person_1['name']
> s[person]['type'] = dictPeople.person_1['type']
> # I need to use this for loop because there are 50+ attributes.
> for attribute in range(0, len(dictPeople['attributes'][attribute])):
> s[person]['attributes'][attribute]['game'] = \
> dictPeople['attributes'][attribute]['game']
> s[person]['attributes'][attribute]['high score'] = \
> dictPeople['attributes'][attribute]['high score']
> s[person]['attributes'][attribute]['time'] = \
> dictPeople['attributes'][attribute]['time']
> It turns out, I get the key error because I am not allowed to reference a
> key/value pair the same way that I can with a dictionary. However, the
> crazy thing is that I can call values in the db file using the same exact
> format when trying to write.
> 
> For example: I can read data from the .db file using:
> 
> x = s['person_1']['name']
> print(x)
> BUT! I cannot write to that .db file using that exact format or I get an
> invalid key error. Makes no sense!
> 
> s['person_1']['name'] = 'Bob'
> # Returns invalid key entry.  Makes no sense.
> Therefore, I tried to extract data and populate the db file using the
> following:
> 
> s[person] = {   'name': dictPeople.person_1['name'],
> 'type': dictPeople.person_1['type'],
> for attribute in range(0, len(dictPeople['attributes'][attribute])):
> ['game':  dictPeople['attributes'][attribute]['game'],
> 'high score': dictPeople['attributes'][attribute]['high score'],
> 'time': dictPeople['attributes'][attribute]['time']]
> 
> }
> But, this obvously doesn't work because of the for loop. How can I do
> this?
> 
> -I am trying to figure out how to extract data from the dictionary
> dictPeople.py file and store it in the people.db file.
> -I am trying to add new people to the people.db file as more people become
> available.
> -I need to use the for loop because of the 50+ attributes I need to add.
> -My future steps would be to modify some of the data values that I extract
> and used to populate the people.db file, but my first step is to, at
> least, extract, and then populate the people.db file.
> 
> Any help or guidance is greatly appreciated.  Thank you for your time and
> reading my question.

You don't need these loops. The problem is that when you read the dict from 
the db

db = shelve.open(...)
person = db["person_1"]

person is a Python object completely independent of the shelve and the 
shelve has no way to trace changes to that object:

$ python3
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.
>>> import shelve
>>> db = shelve.open("tmp.shelve")
>>> person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
... [{'game': 'basketball', 'high score': '100', 'time': '3.34'},
... {'game': 'bridge', 'high score': '10', 'time': '30.34'},
... {'game': 'foosball', 'high score': '2', 'time': '24'}]
... }
>>> db["person_1"] = person_1
>>> db["person_1"]["age"] = 42
>>> db.close()
>>> db = shelve.open("tmp.shelve")
>>> db["person_1"]
{'name': 'Bob', 'type': 'employee', 'attributes': [{'time': '3.34', 'high 
score': '100', 'game': 'basketball'}, {'time': '30.34', 'high score': '10', 
'game': 'bridge'}, {'time': '24', 'high score': '2', 'game': 'foosball'}]}

When you look at the data you see that there is no "age" key. The straight-
forward fix is to always use an assignment 

db[key] = new_value

when you want a change:

>>> person = db["person_1"]
>>> person["age"] = 42
>>> db["person_1"] = person
>>> db.close()

That way the change will survive:

>>> db = 

Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Ian Kelly
On Mon, Dec 21, 2015 at 4:24 PM, Jon Ribbens
 wrote:
> On 2015-12-21, Steven D'Aprano  wrote:
>> The whole purpose of the change of subject is to indicate in a human-visible
>> way that the subject of the thread has changed, i.e. that it is a new
>> thread derived from the old one. If that breaks threading, oh well, it
>> breaks threading.
>
> That sounds a bit confused - if the *intention* of changing the
> subject line is to create a new thread, then breaking the thread
> is not "breaking threading" ;-)
>
>>> And, yes, fixing the mail clients of "everybody else in the world"
>>> might be a lovely idea but it is a little impractical to implement.
>>
>> Less impractical than insisting that "everybody else in the world" must
>> change their posting habits to suit those using broken mail clients.
>
> Fortunately I haven't suggested that.

Yes, I only requested that people not change the subject headers for
trivial reasons, by which I meant things like fixing typos (as in the
subject header change that brought about this thread). I also only
intended my request in the context of this forum, which is shared
between Usenet and mailing list users. Changing the subject header to
indicate a change in subject is, of course, fine.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ignore error with non-zero exit status

2015-12-21 Thread Chris Angelico
On Tue, Dec 22, 2015 at 10:53 AM, Terry Reedy  wrote:
> Nothing has changed since except for
> https://www.python.org/dev/peps/pep-0498/
> already added to 3.6.

And the flip side of the argument is
https://www.python.org/dev/peps/pep-0461/ in 3.5, expanding on percent
formatting. Both are useful, both are supported.

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


[issue4709] Mingw-w64 and python on windows x64

2015-12-21 Thread Steve Dower

Steve Dower added the comment:

As an occasional Linux user, I notice a huge difference between pure Python and 
extension packages there, but basically always have a compiler handy on my 
Windows machines. It's all about context and what you're used to :)

The advice has always been "Visual Studio X" is what is needed, and for 3.5 
onwards that becomes "Visual Studio 2015 or later". Unfortunately, the story 
isn't so simple for legacy Python and 3.3/3.4 because those versions of VS are 
not so easy to get (unless you're a professional Windows developer with an MSDN 
subscription, which is pretty common). It is possible to use some other 
installers to get the old compilers, but Python was not designed to work with 
those and so there are issues that we cannot fix at this stage.

It also doesn't help that older versions of VC weren't as standards compliant, 
so people wrote code that doesn't compile when ported. There are also many 
dependencies that don't work directly with MSVC (for the same reason, but in 
this case it wasn't the package author's fault).

If you follow distutils-sig, where this occasionally comes up, you'll see the 
direction for packaging generally is to avoid needing to build. The hope is 
that even setuptools becomes nonessential enough that it can be dropped from a 
default install, but package developers will install it or another build 
manager to produce their packages (on Windows at least, though there's work 
ongoing to make this possible on many Linux distros too).

--

___
Python tracker 

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



Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Jon Ribbens
On 2015-12-21, Ian Kelly  wrote:
> On Mon, Dec 21, 2015 at 1:58 PM, Ben Finney  
> wrote:
>> Ian Kelly  writes:
>>> This isn't just a Usenet group; it's also a mailing list, and many
>>> MUAs rely on the Subject header for proper threading.
>>
>> If such MUAs do that, they're misinterpreting the Subject field. Other
>> fields are available with the explicit meaning of relating messages to
>> each other regardless of what they discuss.
>>
>> If the correct fields are being mangled, then the correct place to apply
>> pressure is on those who can fix that error. Let's not overload the
>> Subject field to make up the lack.
>
> It might just be Gmail.
>
> http://webapps.stackexchange.com/questions/965/how-does-gmail-decide-to-thread-email-messages
>
> I can't specifically recall if I've used any MUA other than Gmail that
> even attempts threading email messages.

Also: Thunderbird, The Bat!, Eudora, Gnus, Outlook, Outlook Express,
Pegasus Mail, Pine, Apple Mail, Windows Live Mail, Yahoo Mail,
Evolution, SquirrelMail, KMail, Windows Mail, etc.

Trying to suggest that MUAs should never look at the Subject line for
threading is, unfortunately, ridiculous. Yes, in theory it shouldn't
be necessary but in practice enough people are using poor clients that
don't provide enough context in the proper headers that it can't be
avoided.

And, yes, fixing the mail clients of "everybody else in the world"
might be a lovely idea but it is a little impractical to implement.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meaning and purpose of the Subject field

2015-12-21 Thread Thomas 'PointedEars' Lahn
Jon Ribbens wrote:

> On 2015-12-21, Ian Kelly  wrote:
>> I can't specifically recall if I've used any MUA other than Gmail that
>> even attempts threading email messages.
> 
> Also: Thunderbird, The Bat!, Eudora, Gnus, Outlook, Outlook Express,
> Pegasus Mail, Pine, Apple Mail, Windows Live Mail, Yahoo Mail,
> Evolution, SquirrelMail, KMail, Windows Mail, etc.

Yes, of course.
 
> Trying to suggest that MUAs should never look at the Subject line for
> threading is, unfortunately, ridiculous.

No, it is what the Internet message standard says instead:

,-
| 
| 3.6.4.  Identification Fields
| 
| Though listed as optional in the table in section 3.6, every message
| SHOULD have a "Message-ID:" field.  Furthermore, reply messages
| SHOULD have "In-Reply-To:" and "References:" fields as appropriate
| and as described below.
| 
| The "Message-ID:" field contains a single unique message identifier.
| The "References:" and "In-Reply-To:" fields each contain one or more
| unique message identifiers, optionally separated by CFWS.

(“SHOULD” in an RFC means: “do as I say unless you can give me a very good 
reason not to do it”.  See RFC 2119 for details.)

vs.

,-
| 
| 3.6.5.  Informational Fields
| 
| The informational fields are all optional.  The "Subject:" and
| "Comments:" fields are unstructured fields as defined in section
| 2.2.1, and therefore may contain text or folding white space. […]

> Yes, in theory it shouldn't be necessary

It is not.

> but in practice enough people are using poor clients that don't provide
> enough context in the proper headers that it can't be avoided.

That Internet communication is made more difficult for *all* because a 
*perceived* majority of *perceived* clients is broken, is putting upside 
down the good Internet principle of “be conservative in what to send, 
liberal in what to receive”.

Those b0rked clients should either be fixed at once or not be used, period.

Instead, in practice, the Python mailing list software is b0rked since I 
know of the mailing list’s/newsgroups’ existence (several years ago): it is 
b0rked in the regard that its distributor does not consider that it is also 
posted to a Usenet newsgroup where articles require a References header 
field to be properly threaded.  Incidentally, that References header field 
is, in the absence of an In-Reply-To header field, used by hybrid e 
mail/NetNews agents such as Thunderbird, in full compliance with the NetNews 
message standard:

,-
| 
| 3.  News Header Fields
| 
|The following news header fields extend those defined in Section 3.6
|of [RFC5322]:
| 
| […]
| 3.2.10.  References
| 
|The References header field is the same as that specified in Section
|3.6.4 of [RFC5322], with the added restrictions detailed above in
|Section 2.2 and those listed below: […]

One could kill two birds with one stone here by fixing this, but it is not 
done.  Why?

> And, yes, fixing the mail clients of "everybody else in the world"
> might be a lovely idea but it is a little impractical to implement.

I find your argument strewn with gaping defects in logic.

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Steven D'Aprano
On Tue, 22 Dec 2015 08:44 am, Jon Ribbens wrote about mail clients that use
the Subject line to thread messages:

> Also: Thunderbird, The Bat!, Eudora, Gnus, Outlook, Outlook Express,
> Pegasus Mail, Pine, Apple Mail, Windows Live Mail, Yahoo Mail,
> Evolution, SquirrelMail, KMail, Windows Mail, etc.

I understand that at least some of those will only use the Subject as a
fallback when other threading information is not available. That's a
reasonable strategy to take.

As for mail clients that *always* and *exclusively* use the subject line to
implement threading, they are horrifically broken. It is completely
unreasonable to insist that people using non-broken tools must change their
habits to support those with completely broken tools.

So as far as I am concerned, if changes of subject line breaks threading for
you, so sad, too bad. Go without threading or use a better mail client.


> Trying to suggest that MUAs should never look at the Subject line for
> threading is, unfortunately, ridiculous. Yes, in theory it shouldn't
> be necessary but in practice enough people are using poor clients that
> don't provide enough context in the proper headers that it can't be
> avoided.

*shrug*

The whole purpose of the change of subject is to indicate in a human-visible
way that the subject of the thread has changed, i.e. that it is a new
thread derived from the old one. If that breaks threading, oh well, it
breaks threading.


> And, yes, fixing the mail clients of "everybody else in the world"
> might be a lovely idea but it is a little impractical to implement.

Less impractical than insisting that "everybody else in the world" must
change their posting habits to suit those using broken mail clients.

The fact is, even if nobody ever changed the subject line, sometimes
threading will be broken. I can't find the energy to care about something
which already only sometimes works.




-- 
Steven

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


Re: Catogorising strings into random versus non-random

2015-12-21 Thread Christian Gollwitzer

Am 21.12.15 um 09:24 schrieb Peter Otten:

Steven D'Aprano wrote:


I have a large number of strings (originally file names) which tend to
fall into two groups. Some are human-meaningful, but not necessarily
dictionary words e.g.:


baby lions at play
saturday_morning12
Fukushima
ImpossibleFork


(note that some use underscores, others spaces, and some CamelCase) while
others are completely meaningless (or mostly so):


xy39mGWbosjY
9sjz7s8198ghwt
rz4sdko-28dbRW00u


Let's call the second group "random" and the first "non-random", without
getting bogged down into arguments about whether they are really random or
not. I wish to process the strings and automatically determine whether
each string is random or not. I need to split the strings into three
groups:

- those that I'm confident are random
- those that I'm unsure about
- those that I'm confident are non-random

Ideally, I'll get some sort of numeric score so I can tweak where the
boundaries fall.

Strings are *mostly* ASCII but may include a few non-ASCII characters.

Note that false positives (detecting a meaningful non-random string as
random) is worse for me than false negatives (miscategorising a random
string as non-random).

Does anyone have any suggestions for how to do this? Preferably something
already existing. I have some thoughts and/or questions:

- I think nltk has a "language detection" function, would that be
suitable?

- If not nltk, are there are suitable language detection libraries?

- Is this the sort of problem that neural networks are good at solving?
Anyone know a really good tutorial for neural networks in Python?

- How about Bayesian filters, e.g. SpamBayes?


A dead simple approach -- look at the pairs in real words and calculate the
ratio

pairs-also-found-in-real-words/num-pairs


Sounds reasonable. Building on this approach, two simple improvements:
- calculate the log-likelihood instead, which also makes use of the 
frequency of the digraphs in the training set

- Use trigraphs instead of digraphs
- preprocess the string (lowercase), but more sophisticated 
preprocessing could be an option (i.e. converting under_scores and 
CamelCase to spaces)


The main reason for the low score of the baby lions is the space 
character, I think - the word list does not contain that much spaces. 
Maybe one should feed in some long wikipedia article to calculate the 
digraph/trigraph probabilities


=
Apfelkiste:Tests chris$ cat score_my.py
from __future__ import division
from collections import Counter, defaultdict
from math import log
import sys
WORDLIST = "/usr/share/dict/words"

SAMPLE = """\
baby lions at play
saturday_morning12
Fukushima
ImpossibleFork
xy39mGWbosjY
9sjz7s8198ghwt
rz4sdko-28dbRW00u
""".splitlines()

def extract_pairs(text):
for i in range(len(text)-1):
yield text.lower()[i:i+2]
# or len(text)-2 and i:i+3


def load_pairs():
pairs = Counter()
with open(WORDLIST) as f:
for line in f:
pairs.update(extract_pairs(line.strip()))
# normalize to sum
total_count = sum([pairs[x] for x in pairs])
N = total_count+len(pairs)
dist = defaultdict(lambda:1/N, ((x, (pairs[x]+1)/N) for x in pairs))
return dist


def get_score(text, dist):
ll= 0
for i, x in enumerate(extract_pairs(text), 1):
ll += log(dist[x])
return ll / i


def main():
pair_dist = load_pairs()
for text in sys.argv[1:] or SAMPLE:
score = get_score(text, pair_dist)
print("%.3g  %s" % (score, text))


if __name__ == "__main__":
main()

Apfelkiste:Tests chris$ python score_my.py
-8.74  baby lions at play
-7.63  saturday_morning12
-6.38  Fukushima
-5.72  ImpossibleFork
-10.6  xy39mGWbosjY
-12.9  9sjz7s8198ghwt
-12.1  rz4sdko-28dbRW00u
Apfelkiste:Tests chris$ python score_my.py 'bnsip atl ayba loy'
-9.43  bnsip atl ayba loy
Apfelkiste:Tests chris$

and using trigraphs:

Apfelkiste:Tests chris$ python score_my.py 'bnsip atl ayba loy'
-12.5  bnsip atl ayba loy
Apfelkiste:Tests chris$ python score_my.py
-11.5  baby lions at play
-9.88  saturday_morning12
-9.85  Fukushima
-7.68  ImpossibleFork
-13.4  xy39mGWbosjY
-14.2  9sjz7s8198ghwt
-14.2  rz4sdko-28dbRW00u
==

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


[issue25873] Faster ElementTree iterating

2015-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a5d5268afd5 by Serhiy Storchaka in branch 'default':
Issue #25873: Optimized iterating ElementTree.
https://hg.python.org/cpython/rev/5a5d5268afd5

--
nosy: +python-dev

___
Python tracker 

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



Re: Catogorising strings into random versus non-random

2015-12-21 Thread Christian Gollwitzer

Am 21.12.15 um 11:36 schrieb Steven D'Aprano:

On Mon, 21 Dec 2015 08:56 pm, Christian Gollwitzer wrote:


Apfelkiste:Tests chris$ python score_my.py
-8.74  baby lions at play
-7.63  saturday_morning12
-6.38  Fukushima
-5.72  ImpossibleFork
-10.6  xy39mGWbosjY
-12.9  9sjz7s8198ghwt
-12.1  rz4sdko-28dbRW00u
Apfelkiste:Tests chris$ python score_my.py 'bnsip atl ayba loy'
-9.43  bnsip atl ayba loy


Thanks Christian and Peter for the suggestion, I'll certainly investigate
this further.

But the scoring doesn't seem very good. "baby lions at play" is 100% English
words, and ought to have a radically different score from (say)
xy39mGWbosjY which is extremely non-English like. (How many English words
do you know of with W, X, two Y, and J?) And yet they are only two units
apart. "baby lions..." is a score almost as negative as the authentic
gibberish, while Fukushima (a Japanese word) has a much less negative
score.


It is the spaces, which do not occur in the training wordlist (I 
mentioned that above, maybe not prominently enough). 
/usr/share/dict/words contains one word per line. The underscore _ is 
probably putting the saturday morning low, while the spaces put the 
babies low. Using trigraphs:



Apfelkiste:Tests chris$ python score_my.py
-11.5  baby lions at play
-9.88  saturday_morning12
-9.85  Fukushima
-7.68  ImpossibleFork
-13.4  xy39mGWbosjY
-14.2  9sjz7s8198ghwt
-14.2  rz4sdko-28dbRW00u
Apfelkiste:Tests chris$ python score_my.py 'babylionsatplay'
-8.74  babylionsatplay
Apfelkiste:Tests chris$ python score_my.py 'saturdaymorning12'
-8.93  saturdaymorning12
Apfelkiste:Tests chris$

So for the spaces, either use a proper trainig material (some long 
corpus from Wikipedia or such), with punctuation removed. Then it will 
catch the correct probabilities at word boundaries. Or preprocess by 
removing the spaces.


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


Re: What could cause a plot fail in my code?

2015-12-21 Thread Peter Pearson
On Mon, 21 Dec 2015 09:29:24 -0800 (PST), Robert  wrote:
> On Monday, December 21, 2015 at 12:15:54 PM UTC-5, Robert wrote:
>> Hi,
>> 
>> I find a useful code snippet on link:
>> 
>> http://stackoverflow.com/questions/25126444/logistic-regression-in-pymc/34400966#34400966
>> 
>> but it has error on plot function. The error message is as following:
>> -
>> %run "C:\Users\rj\pyprj\logic_regression0.py"
>> [-100%-] 1 of 1 complete in 12.6 
>>   secPlotting beta0
>> Plotting tau
>> Plotting betaSalad
>> Plotting sigma
>> ---
>> UnboundLocalError Traceback (most recent call last)
>> C:\Users\pyprj\logic_regression0.py in ()
>>  34 #m.sample(10, 5, 50)
>>  35 m.sample(1, 5000, 50)
>> ---> 36 pm.Matplot.plot(m)
>>  37 import matplotlib.pyplot as plt
>>  38 #plt.plot(m)
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site- 
>> packages\pymc\Matplot.pyc in wrapper(pymc_obj, *args, **kwargs)
>> 339 if args:
>> 340 name = '%s_%s' % (args[0], variable.__name__)
>> --> 341 f(data, name, *args, **kwargs)
>> 342 return
>> 343 except AttributeError:
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\pymc\Matplot.pyc
>>  in plot(data, name, format, suffix, path,  common_scale, datarange, new, 
>> last, rows, num, fontmap, verbose)
>> 453 num=num * 2,
>> 454 last=last,
>> --> 455 fontmap=fontmap)
>> 456 
>> 457 if last:
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\pymc\Matplot.pyc
>>  in wrapper(pymc_obj, *args, **kwargs)
>> 375 
>> 376 # If others fail, assume that raw data is passed
>> --> 377 f(pymc_obj, *args, **kwargs)
>> 378 
>> 379 wrapper.__doc__ = f.__doc__
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\pymc\Matplot.pyc
>>  in histogram(data, name, bins, datarange, format, suffix, path, rows, 
>> columns, num, last, fontmap, verbose)
>> 576 
>> 577 # Generate histogram
>> --> 578 hist(data.tolist(), bins, histtype='stepfilled')
>> 579 
>> 580 xlim(datarange)
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\pyplot.py
>>  in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, 
>> align, orientation, rwidth, log, color, label, stacked, hold, data, **kwargs)
>>2956   histtype=histtype, align=align, 
>> orientation=orientation,
>>2957   rwidth=rwidth, log=log, color=color, 
>> label=label,
>> -> 2958   stacked=stacked, data=data, **kwargs)
>>2959 finally:
>>2960 ax.hold(washold)
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\__init__.py
>>  in inner(ax, *args, **kwargs)
>>1809 warnings.warn(msg % (label_namer, func.__name__),
>>1810   RuntimeWarning, stacklevel=2)
>> -> 1811 return func(ax, *args, **kwargs)
>>1812 pre_doc = inner.__doc__
>>1813 if pre_doc is None:
>> 
>> C:\Users\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.py
>>  in hist(self, x, bins, range, normed, weights, cumulative, bottom, 
>> histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
>>6192 ymin = np.amin(m[m != 0])
>>6193 # filter out the 0 height bins
>> -> 6194 ymin = max(ymin*0.9, minimum) if not input_empty 
>> else minimum
>>6195 ymin = min(ymin0, ymin)
>>6196 self.dataLim.intervaly = (ymin, ymax)
>> 
>> UnboundLocalError: local variable 'ymin' referenced before assignment 
>> /
>> 
>> I have no clue at all on debug it. Could you help me?
>> Thanks,
>
> Excuse me. The code link should be this one:
>
> http://nbviewer.ipython.org/gist/aflaxman/8329ec1b9f861469f896
>
> Do you experience such errors?


>From a quick look, it appears that you are trying to plot a histogram
in which all the bins are empty.


-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Library function to encode data to multipart/form-data format?

2015-12-21 Thread Grant Edwards
Is there a standard library function that can be used to encode data
into multipart/form-data format?  IIRC, I looked for this once before
and didn't find anything in the library. 

[I don't want to actually send an HTTP POST or an email message, I
just need to generate sets of data for test purposes.]

-- 
Grant Edwards   grant.b.edwardsYow! -- I love KATRINKA
  at   because she drives a
  gmail.comPONTIAC.  We're going
   away now.  I fed the cat.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Categorising strings on meaningful–meaningless spectrum (was: Catogorising strings into random versus non-random)

2015-12-21 Thread Steven D'Aprano
On Monday 21 December 2015 14:45, Ben Finney wrote:

> Steven D'Aprano  writes:
> 
>> Let's call the second group "random" and the first "non-random",
>> without getting bogged down into arguments about whether they are
>> really random or not.
> 
> I think we should discuss it, even at risk of getting bogged down. As
> you know better than I, “random” is not an observable property of the
> value, but of the process that produced it.
> 
> So, I don't think “random” is at all helpful as a descriptor of the
> criteria you need for discriminating these values.
> 
> Can you give a better definition of what criteria distinguish the
> values, based only on their observable properties?

No, not really. This *literally* is a case of "I'll know it when I see it", 
which suggests that some sort of machine-learning solution (neural network?) 
may be useful. I can train it on a bunch of strings which I can hand-
classify, and let the machine pick out the correlations, then apply it to 
the rest of the strings.

The best I can say is that the "non-random" strings either are, or consist 
of, mostly English words, names, or things which look like they might be 
English words, containing no more than a few non-ASCII characters, 
punctuation, or digits.


> You used “meaningless”; that seems at least more hopeful as a criterion
> we can use by examining text values. So, what counts as meaningless?

Strings made up of random-looking sequences of characters, like you often 
see on sites like imgur or tumblr. Characters from non-Latin character sets 
that I can't read (e.g. Japanese, Korean, Arabic, etc). Jumbled up words, 
e.g. "python" is non-random, "nyohtp" would be random.


[...]
> Perhaps you could measure Shannon entropy (“expected information value”)
>  as
> a proxy? Or maybe I don't quite understand the criteria.

That's a possibility. At least, it might be able to distinguish some 
strings, although if I understand correctly, the two strings "python" and 
"nhoypt" have identical entropy, so this alone won't be sufficient.




-- 
Steve

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


[issue25902] Fixed various refcount issues in ElementTree iteration

2015-12-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Martin.

Actually this patch is for 3.5 only. In 3.6 the code will be rewrote 
(issue25873).

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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: Ignore error with non-zero exit status

2015-12-21 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote:

> On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:
>> Chris Angelico wrote:
>>> But it's been clearly stated that .format is not going to do away with
>>> percent formatting, and all language of "new-style formatting" has been
>>> removed so as not to cause confusion.
>>
>> Wishful thinking, twice.
> 
> http://www.gossamer-threads.com/lists/python/dev/969817

What is this supposed to be evidence of?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Catogorising strings into random versus non-random

2015-12-21 Thread Vlastimil Brom
2015-12-21 4:01 GMT+01:00 Steven D'Aprano :
> I have a large number of strings (originally file names) which tend to fall
> into two groups. Some are human-meaningful, but not necessarily dictionary
> words e.g.:
>
>
> baby lions at play
> saturday_morning12
> Fukushima
> ImpossibleFork
>
>
> (note that some use underscores, others spaces, and some CamelCase) while
> others are completely meaningless (or mostly so):
>
>
> xy39mGWbosjY
> 9sjz7s8198ghwt
> rz4sdko-28dbRW00u
>
>
> Let's call the second group "random" and the first "non-random", without
> getting bogged down into arguments about whether they are really random or
> not. I wish to process the strings and automatically determine whether each
> string is random or not. I need to split the strings into three groups:
>
> - those that I'm confident are random
> - those that I'm unsure about
> - those that I'm confident are non-random
>
> Ideally, I'll get some sort of numeric score so I can tweak where the
> boundaries fall.
>
> Strings are *mostly* ASCII but may include a few non-ASCII characters.
>
> Note that false positives (detecting a meaningful non-random string as
> random) is worse for me than false negatives (miscategorising a random
> string as non-random).
>
> Does anyone have any suggestions for how to do this? Preferably something
> already existing. I have some thoughts and/or questions:
>
> - I think nltk has a "language detection" function, would that be suitable?
>
> - If not nltk, are there are suitable language detection libraries?
>
> - Is this the sort of problem that neural networks are good at solving?
> Anyone know a really good tutorial for neural networks in Python?
>
> - How about Bayesian filters, e.g. SpamBayes?
>
>
>
>
> --
> Steven
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Hi,
as you probably already know, NLTK could be helpful for some parts of
this task; if you can handle the most likely "word" splitting involved
by underscores, CamelCase etc., you could try to tag the parts of
speech of the words and interpret for the results according to your
needs.
In the online demo
http://text-processing.com/demo/tag/
your sample (with different approaches to splitt the words) yields:

baby/NN lions/NNS at/IN play/VB saturday/NN morning/NN 12/CD
Fukushima/NNP Impossible/JJ Fork/NNP xy39mGWbosjY/-None-
9sjz7s8198ghwt/-None- rz4sdko/-None- -/: 28dbRW00u/-None-

or with more splittings on case or letter-digit boundaries:
baby/NN lions/NNS at/IN play/VB saturday/NN morning/NN 12/CD
Fukushima/NNP Impossible/JJ Fork/NNP xy/-None- 39/CD m/-None- G/NNP
Wbosj/-None- Y/-None- 9/CD sjz/-None- 7/CD s/-None- 8198/-NONE-
ghwt/-None- rz/-None- 4/CD sdko/-None- -/: 28/CD db/-None- R/NNP
W/-None- 00/-None- u/-None-

 the tagset might be compatible with
https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html

There is sample code with a comparable output to this demo:
http://stackoverflow.com/questions/23953709/how-do-i-tag-a-sentence-with-the-brown-or-conll2000-tagger-chunker

For the given minimal sample, the results look useful (maybe with
exception of the capitalised words sometimes tagged as proper names -
but it might not be that relevant here).
Of course, any scoring isn't available with this approach, but you
could maybe check the proportion of the  recognised "words" comparing
to the total number of the "words" for the respective filename.
Training the tagger should be possible too in NLTK, but I don't have
experiences with this.

regards,
 vbr
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ignore error with non-zero exit status

2015-12-21 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote:

> On Tue, Dec 22, 2015 at 12:19 AM, Thomas 'PointedEars' Lahn
>  wrote:
>> Mark Lawrence wrote:
>>> On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:
 Chris Angelico wrote:
> But it's been clearly stated that .format is not going to do away with
> percent formatting, and all language of "new-style formatting" has
> been removed so as not to cause confusion.
 Wishful thinking, twice.
>>> http://www.gossamer-threads.com/lists/python/dev/969817
>> What is this supposed to be evidence of?
> 
> Proof that percent formatting isn't planned for deprecation, much less
> removal.

Then it would have failed to accomplish that.

> There is strong support for it in certain quarters of python-dev. […]

There *was*.  The referred thread is from 2012-02.  It is 2015-12.

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25148] Windows registry PythonCore key changed inconsistent with other releases

2015-12-21 Thread Mark Hammond

Mark Hammond added the comment:

It appears bdist_wininst wasn't updated for this so installed created by 
distutils don't work in 32bit versions - is there a different bug open for 
that? (Or I'm doing something wrong, but the installer fails and a quick scan 
of the source doesn't seem to handle it)

--

___
Python tracker 

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



[issue25918] AssertionError in lib2to3 on 2.7.11 Windows

2015-12-21 Thread Marc Schlaich

Marc Schlaich added the comment:

I'm attaching those bad files.

--
Added file: http://bugs.python.org/file41378/PatternGrammar2.7.11.final.0.pickle

___
Python tracker 

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



[issue25918] AssertionError in lib2to3 on 2.7.11 Windows

2015-12-21 Thread Marc Schlaich

Changes by Marc Schlaich :


Added file: http://bugs.python.org/file41379/Grammar2.7.11.final.0.pickle

___
Python tracker 

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



Re: Ignore error with non-zero exit status

2015-12-21 Thread Chris Angelico
On Tue, Dec 22, 2015 at 12:19 AM, Thomas 'PointedEars' Lahn
 wrote:
> Mark Lawrence wrote:
>
>> On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:
>>> Chris Angelico wrote:
 But it's been clearly stated that .format is not going to do away with
 percent formatting, and all language of "new-style formatting" has been
 removed so as not to cause confusion.
>>>
>>> Wishful thinking, twice.
>>
>> http://www.gossamer-threads.com/lists/python/dev/969817
>
> What is this supposed to be evidence of?

Proof that percent formatting isn't planned for deprecation, much less
removal. There is strong support for it in certain quarters of
python-dev. It's a fully supported language feature, not an old and
outmoded feature that is kept solely for backward compatibility (as
"old-style classes" are in Python 2.7 - you can still use them, but as
of Python 3, only "new-style classes" exist).

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


Re: Ignore error with non-zero exit status

2015-12-21 Thread Chris Angelico
On Tue, Dec 22, 2015 at 1:05 AM, Thomas 'PointedEars' Lahn
 wrote:
> Chris Angelico wrote:
>
>> On Tue, Dec 22, 2015 at 12:19 AM, Thomas 'PointedEars' Lahn
>>  wrote:
>>> Mark Lawrence wrote:
 On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:
> Chris Angelico wrote:
>> But it's been clearly stated that .format is not going to do away with
>> percent formatting, and all language of "new-style formatting" has
>> been removed so as not to cause confusion.
> Wishful thinking, twice.
 http://www.gossamer-threads.com/lists/python/dev/969817
>>> What is this supposed to be evidence of?
>>
>> Proof that percent formatting isn't planned for deprecation, much less
>> removal.
>
> Then it would have failed to accomplish that.
>
>> There is strong support for it in certain quarters of python-dev. […]
>
> There *was*.  The referred thread is from 2012-02.  It is 2015-12.

Then show some evidence that python-dev has changed in viewpoint.

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


Re: Catogorising strings into random versus non-random

2015-12-21 Thread Vincent Davis
On Mon, Dec 21, 2015 at 7:25 AM, Vlastimil Brom 
wrote:

> > baby lions at play
> > saturday_morning12
> > Fukushima
> > ImpossibleFork
> >
> >
> > (note that some use underscores, others spaces, and some CamelCase) while
> > others are completely meaningless (or mostly so):
> >
> >
> > xy39mGWbosjY
> > 9sjz7s8198ghwt
> > rz4sdko-28dbRW00u
>

My first thought it to search google for each wor
​d​
or phase and count
​(google gives a count) ​
the results. For example if you search for "xy39mGWbosjY" there is one
result as of now,
​which
 is an archive of this tread. If you search for any given word or even the
phrase
​, for example​
"baby lions at play
​
" you get a much larger set of results
​ ~500​
. I assue there are many was to search google with python, this looks like
one. https://pypi.python.org/pypi/google

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


Re: Ignore error with non-zero exit status

2015-12-21 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote:

> […] Thomas 'PointedEars' Lahn […] wrote:
>> Chris Angelico wrote:
>>> […] Thomas 'PointedEars' Lahn […] wrote:
 Mark Lawrence wrote:
> On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:
>> Chris Angelico wrote:
>>> But it's been clearly stated that .format is not going to do away
>>> with percent formatting, and all language of "new-style formatting"
>>> has been removed so as not to cause confusion.
>> Wishful thinking, twice.
> http://www.gossamer-threads.com/lists/python/dev/969817
 What is this supposed to be evidence of?
>>> Proof that percent formatting isn't planned for deprecation, much less
>>> removal.
>> Then it would have failed to accomplish that.
>> 
>>> There is strong support for it in certain quarters of python-dev. […]
>> There *was*.  The referred thread is from 2012-02.  It is 2015-12.
> 
> Then show some evidence that python-dev has changed in viewpoint.

And why would I do that?  I have claimed no such thing.

Your attempt to shift the burden of proof is unsuccessful.

BTW, which part of “attribution line” did you not understand?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meaning and purpose of the Subject field

2015-12-21 Thread Random832
Cameron Simpson  writes:
> Besides, changing the Subject line is _supposed_ to break the
> threading in these contexts: such clients clearly consider the
> discussion topic (subject) as sufficient definition of a thread, and
> changing the topic should imply a new thread to such simplistic
> clients.

This makes sense for the change from "old" to "new (was: old)",
which nobody was advocating against (after all, there's semantic
content - they wouldn't have changed the subject line if they
didn't consider it a new discussion topic), but I think there is
a reasonable argument that changing it a second time from
"new (was: old)" to "new" is frivolous.

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


Re: Newbie XML problem

2015-12-21 Thread Miki Tebeka
Hi,

> config = {id: 1, canvas: (3840, 1024), comment: "a comment",
>  {id: 4, gate: 3, (0,0, 1280, 1024)},   
>  {id: 5, gate: 2, (1280, 0, 2560, 1024)},
>  {id: 6, gate: 1, (2560, 0, 3840, 1024)}}
This is not valid Python. Are you trying to have a list of dicts?

> I have started to use this code - but this is beginning to feel very 
> non-elegant; not the cool Python code I usually see...
ElementTree supports XPATH, using this and some list comprehension you do 
things a little more easily. For example:

cfg = root.find('config[@id="B"]')
for panel in cfg.findall('panel'):
panels.append([{elem.tag: elem.text} for elem in panel])

You'll need to do some parsing for the coordinates and handle canvas and 
comments separately.
  
HTH,
Miki
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25922] canceling a repair install breaks the ability to uninstall repair or re-install

2015-12-21 Thread Kyle S (MrStonedOne)

New submission from Kyle S (MrStonedOne):

Title says all.

It refuses to install from that point on, complaining that a reboot is needed.

--
components: Installation, Windows
messages: 256829
nosy: Kyle S (MrStonedOne), paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: canceling a repair install breaks the ability to uninstall repair or 
re-install
type: behavior
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



[issue25922] canceling a repair install breaks the ability to uninstall, repair, or re-install

2015-12-21 Thread Kyle S (MrStonedOne)

Changes by Kyle S (MrStonedOne) :


--
title: canceling a repair install breaks the ability to uninstall repair or 
re-install -> canceling a repair install breaks the ability to uninstall, 
repair, or re-install

___
Python tracker 

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



[issue25827] Support ICC in configure

2015-12-21 Thread Zachary Ware

Zachary Ware added the comment:

The buildbots appear to be happy with this, so I'm closing the issue.  The 
intel-ubuntu-icc Non-Debug builders each had their first green build after this 
changeset.  The OSX ICC builder still has some issues, but they seem to be OSX 
specific (see issue25589).

--
resolution:  -> fixed
stage: patch review -> 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



Newbie XML problem

2015-12-21 Thread KP

>From my first foray into XML with Python:

I would like to retrieve this list from the XML upon searching for the 'config' 
with id attribute = 'B'


config = {id: 1, canvas: (3840, 1024), comment: "a comment",
 {id: 4, gate: 3, (0,0, 1280, 1024)},   
 {id: 5, gate: 2, (1280, 0, 2560, 1024)},
 {id: 6, gate: 1, (2560, 0, 3840, 1024)}}

I have started to use this code - but this is beginning to feel very 
non-elegant; not the cool Python code I usually see...

import xml.etree.ElementTree as ET

tree   = ET.parse('master.xml')
master = tree.getroot()

for config in master:
if config.attrib['id'] == 'B':
...  

Thanks for any help!






3840,1024
"bla"

1
6
0,0,1280,1024


2
5
1280,0,2560,1024


3
4
2560,0,3840,1024



3840,1024
"a comment"

4
3
0,0,1280,1024


5
2
1280,0,2560,1024


6
1
2560,0,3840,1024



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


[issue25878] CPython on Windows builds with /W3, not /W4

2015-12-21 Thread Alexander Riccio

Alexander Riccio added the comment:

> This should be about a 2 line change, but the current patch is several 
> hundred lines of spam.

I agree, but wasn't immediately sure how to do so.

Unfortunately, I've been working on other things, and I'm not sure when I'll be 
able to finish this.

--

___
Python tracker 

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



[issue25921] project files for wininst-14.0*.exe don't exist

2015-12-21 Thread Mark Hammond

Mark Hammond added the comment:

Awesome, thanks, sorry I missed that.

--

___
Python tracker 

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



Re: In Python 3, how to append a nested dictionary to a shelve file with the added difficulty of using a for loop?

2015-12-21 Thread Aaron Christensen
Hi Peter,

Thanks for the response!  Several things you stated definitely got me
thinking.  I really appreciate the response.  I used what you said and I am
able to accomplish what I needed.

Thanks!
Aaron



On Mon, Dec 21, 2015 at 7:23 PM, Peter Otten <__pete...@web.de> wrote:

> Aaron Christensen wrote:
>
> > Hello,
> >
> > I am trying to figure out how to populate a shelve file with a nested
> > dictionary.
> >
> > These are my requirements:
> >
> > -Create shelve file called people.db
> > -Append the shelve file with new people (person_1, person_2, etc.).
> > -Use a for loop to iterate through 'attributes' so that I do not need to
> > write out the lengthy code line by line to populate to the shelve file.
> > -Need to reference shelve file data for future use
> >
> > Here is the key/value format that I would like to append to the shelve
> > file.
> >
> > person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
> > [{'game': 'basketball', 'high score': '100', 'time': '3.34'},
> > {'game': 'bridge', 'high score': '10', 'time': '30.34'},
> > {'game': 'foosball', 'high score': '2', 'time': '24'}]
> > '''
> > 50+ other attributes
> > '''
> > }
> >
> > # Example: s['person_1]['attributes'][2]['time'] would call out '24'.
> > # 's' is from 's = shelve.open('people')'
> > I have a dictionary dictPeople.py file (created using pprint() that
> > contains the information of person_1, etc. And I am extracting only a
> > small percentage of the data that is needed.
> >
> > I have tried the following, but I get an invalid key error.
> >
> > import shelve, dictPeople
> > s = shelve.open('people')
> > person = 'person_1'
> > s[person]['name'] = dictPeople.person_1['name']
> > s[person]['type'] = dictPeople.person_1['type']
> > # I need to use this for loop because there are 50+ attributes.
> > for attribute in range(0, len(dictPeople['attributes'][attribute])):
> > s[person]['attributes'][attribute]['game'] = \
> > dictPeople['attributes'][attribute]['game']
> > s[person]['attributes'][attribute]['high score'] = \
> > dictPeople['attributes'][attribute]['high score']
> > s[person]['attributes'][attribute]['time'] = \
> > dictPeople['attributes'][attribute]['time']
> > It turns out, I get the key error because I am not allowed to reference a
> > key/value pair the same way that I can with a dictionary. However, the
> > crazy thing is that I can call values in the db file using the same exact
> > format when trying to write.
> >
> > For example: I can read data from the .db file using:
> >
> > x = s['person_1']['name']
> > print(x)
> > BUT! I cannot write to that .db file using that exact format or I get an
> > invalid key error. Makes no sense!
> >
> > s['person_1']['name'] = 'Bob'
> > # Returns invalid key entry.  Makes no sense.
> > Therefore, I tried to extract data and populate the db file using the
> > following:
> >
> > s[person] = {   'name': dictPeople.person_1['name'],
> > 'type': dictPeople.person_1['type'],
> > for attribute in range(0, len(dictPeople['attributes'][attribute])):
> > ['game':  dictPeople['attributes'][attribute]['game'],
> > 'high score': dictPeople['attributes'][attribute]['high score'],
> > 'time': dictPeople['attributes'][attribute]['time']]
> >
> > }
> > But, this obvously doesn't work because of the for loop. How can I do
> > this?
> >
> > -I am trying to figure out how to extract data from the dictionary
> > dictPeople.py file and store it in the people.db file.
> > -I am trying to add new people to the people.db file as more people
> become
> > available.
> > -I need to use the for loop because of the 50+ attributes I need to add.
> > -My future steps would be to modify some of the data values that I
> extract
> > and used to populate the people.db file, but my first step is to, at
> > least, extract, and then populate the people.db file.
> >
> > Any help or guidance is greatly appreciated.  Thank you for your time and
> > reading my question.
>
> You don't need these loops. The problem is that when you read the dict from
> the db
>
> db = shelve.open(...)
> person = db["person_1"]
>
> person is a Python object completely independent of the shelve and the
> shelve has no way to trace changes to that object:
>
> $ python3
> 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.
> >>> import shelve
> >>> db = shelve.open("tmp.shelve")
> >>> person_1 = { 'name': 'Bob', 'type': 'employee', 'attributes':
> ... [{'game': 'basketball', 'high score': '100', 'time': '3.34'},
> ... {'game': 'bridge', 'high score': '10', 'time': '30.34'},
> ... {'game': 'foosball', 'high score': '2', 'time': '24'}]
> ... }
> >>> db["person_1"] = person_1
> >>> db["person_1"]["age"] = 42
> >>> db.close()
> >>> db = shelve.open("tmp.shelve")
> >>> db["person_1"]
> {'name': 'Bob', 'type': 'employee', 

Re: Catogorising strings into random versus non-random

2015-12-21 Thread Rick Johnson
On Sunday, December 20, 2015 at 10:22:57 PM UTC-6, Chris Angelico wrote:
> DuckDuckGo doesn't give a result count, so I skipped it. Yahoo search yielded:

So why bother to mention it then? Is this another one of your "pikeish" 
propaganda campaigns?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25878] CPython on Windows builds with /W3, not /W4

2015-12-21 Thread Zachary Ware

Zachary Ware added the comment:

That's alright, it'll be here whenever you come back to it, unless
somebody else takes it up :)

By the way, my wording was poor in my previous message.  My 'hundreds
of lines of spam' remark was not meant to disparage your patch, but
rather Visual Studio's project editing abilities.  Sorry about that.

--

___
Python tracker 

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



[issue25921] project files for wininst-14.0*.exe don't exist

2015-12-21 Thread Mark Hammond

New submission from Mark Hammond:

Revision 34b35aa1967d pushed new versions of wininst-14.8*.exe, but didn't 
include the VS project files required to build it, thus meaning it can't 
reasonably be built from the source tree.

--
components: Build
messages: 256823
nosy: mhammond, steve.dower
priority: normal
severity: normal
status: open
title: project files for wininst-14.0*.exe don't exist

___
Python tracker 

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



Re: Meaning and purpose of the Subject field (was: Ignore error with non-zero exit status)

2015-12-21 Thread Cameron Simpson

On 22Dec2015 10:14, Steven D'Aprano  wrote:

On Tue, 22 Dec 2015 08:44 am, Jon Ribbens wrote about mail clients that use
the Subject line to thread messages:


Also: Thunderbird, The Bat!, Eudora, Gnus, Outlook, Outlook Express,
Pegasus Mail, Pine, Apple Mail, Windows Live Mail, Yahoo Mail,
Evolution, SquirrelMail, KMail, Windows Mail, etc.


I understand that at least some of those will only use the Subject as a
fallback when other threading information is not available. That's a
reasonable strategy to take.

As for mail clients that *always* and *exclusively* use the subject line to
implement threading, they are horrifically broken.


A big +1 here. Even as big as +2.


It is completely
unreasonable to insist that people using non-broken tools must change their
habits to support those with completely broken tools.

So as far as I am concerned, if changes of subject line breaks threading for
you, so sad, too bad. Go without threading or use a better mail client.

[...snip...]

Besides, changing the Subject line is _supposed_ to break the threading in 
these contexts: such clients clearly consider the discussion topic (subject) as 
sufficient definition of a thread, and changing the topic should imply a new 
thread to such simplistic clients.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue25921] project files for wininst-14.0*.exe don't exist

2015-12-21 Thread Zachary Ware

Zachary Ware added the comment:

The project file was moved to PC/bdist_wininst/bdist_wininst.vcxproj.  See 
55e5be11264e.  It's still included in the build solution, but not in the 
project used for building from the command line.

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +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



[issue4709] Mingw-w64 and python on windows x64

2015-12-21 Thread Ralf Gommers

Ralf Gommers added the comment:

> @Steve Great, so what needs to be done so that I as a package developer can 
> do `pip install windows-build-system`, `python setup.py bdist_wheel` and it 
> actually creates a wheel? (which AFAICT is the same problem).

Hi Henry, I expect progress on the mingw-w64 front within the next few months. 
There'll be a status update with some more concrete plans soon. Also, 
http://mingwpy.github.io/ has appeared last week - a few wheels have been set 
in motion.

> The advice has always been "Visual Studio X" is what is needed, and for 3.5 
> onwards that becomes "Visual Studio 2015 or later".

Hi Steve, that's actually not very useful advice for the scientific Python 
community. While things like C99 compliance are or could get better, there will 
always be a large Fortran-shaped hole in your suggestion. See my post above 
(from May 19) for more details.

--

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2015-12-21 Thread Henry Gomersall

Henry Gomersall added the comment:

@carlkl right, but it's not really a seamless experience. I think my question 
is: What needs to still be done in order that a user with a fresh Python 
install in Windows (and no compiler installed) can do "pip install 
an_extension_that_needs_compiling" and it _just works_?

Is someone with a better understanding of the issues able to comment on this?

--

___
Python tracker 

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



[issue25918] AssertionError in lib2to3 on 2.7.11 Windows

2015-12-21 Thread Marc Schlaich

Marc Schlaich added the comment:

The issue is in Grammar2.7.11.final.0.pickle or 
PatternGrammar2.7.11.final.0.pickle. I have copied these files to my manually 
built Python and getting the same issue in this case.

--

___
Python tracker 

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



Re: Python 3.1 test issue

2015-12-21 Thread rakeshravinlr
On Wednesday, December 16, 2015 at 11:53:14 PM UTC+5:30, George Trojan wrote:
> I installed Python 3.1 on RHEL 7.2.  The command make test hangs (or 
> takes a lot of time) on test_subprocess.
> 
> [396/397] test_subprocess
> ^C
> Test suite interrupted by signal SIGINT.
> 5 tests omitted:
>  test___all__ test_distutils test_site test_socket test_warnings
> 381 tests OK.
> 4 tests altered the execution environment:
>  test___all__ test_distutils test_site test_warnings
> 11 tests skipped:
>  test_devpoll test_kqueue test_msilib test_ossaudiodev
>  test_startfile test_tix test_tk test_ttk_guionly test_winreg
>  test_winsound test_zipfile64
> make: *** [test] Error 1
> 
> CPU was at 100% all the time for process
> 
> gtrojan  15758  8907 94 17:29 pts/6 00:06:47 
> /home/gtrojan/Downloads/Python-3.5.1/python -R -bb -E -Wdefault 
> -Werror::BytesWarning -X faulthandler -m test.regrtest --slaveargs 
> [["test_socket", 0, false], {"huntrleaks": false, "match_tests": null, 
> "failfast": false, "output_on_failure": false, "use_resources": 
> ["curses", "network", "decimal", "cpu", "subprocess", "urlfetch"], 
> "pgo": false, "timeout": null}]
> gtrojan  22889   336  0 17:36 pts/11   00:00:00 grep --color=auto 15758
> 
> Is this a problem?
> 
> George

can u help me to convert the folowing test case

Input:
/home/rebaca/azuki/streams/./tsudpsend 
/home/rebaca/azuki/streams/ebp/ebp-1250-2.ts 127.0.0.1 500011 
2151832|/home/rebaca/azuki/streams/./tsudpsend 
/home/rebaca/azuki/streams/ebp/ebp-1251-2.ts 127.0.0.1 500012 
2151832|/home/rebaca/azuki/streams/./tsudpsend 
/home/rebaca/azuki/streams/ebp/ebp-1250-2.ts 127.0.0.1 500013 2151832



Output:

AZ_HLS_PORT_BASED_VOD_TC6_STL_CMD='{ "TSUDPSEND":[ { "ebp_1250_2_av":"tsudpsend 
'+ STREAMS_PATH +'/ebp/ebp-1250-2.ts '+ DEVICE_UNDER_TEST +'5000112151832" }, { 
"ebp_1250_2_v": "tsudpsend '+ STREAMS_PATH+'/ebp/ebp-1250-2.ts '+ 
DEVICE_UNDER_TEST +' 500012 2151832" },{"ebp_1250_2_a": "tsudpsend '+ 
STREAMS_PATH +'/ebp/ebp-1250-2.ts '+DEVICE_UNDER_TEST +' 500013 2151832" } ] }' 


how to get output in the following format when the input is given using python



# The following are commands used for pumping the streams.
"/home/rebaca/azuki/streams/./tsudpsend"==> this is the path of the tool
used for pumping streams.
# "/home/rebaca/azuki/streams/ebp/ebp-1250-2.ts" ==>  Stream Path
# "127.0.0.1" & "500011" ==> Device IP & Port, respectively, to which
the stream needs to be pumped.
# "2151832" ==> Overall Bitrate of the input stream. 



please help me if u can
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25148] Windows registry PythonCore key changed inconsistent with other releases

2015-12-21 Thread Steve Dower

Steve Dower added the comment:

That's a possibility. I won't have a chance to check for a few days, but it 
should get another bug if it's wrong.

--

___
Python tracker 

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



Re: Catogorising strings into random versus non-random

2015-12-21 Thread Peter Otten
Steven D'Aprano wrote:

> I have a large number of strings (originally file names) which tend to
> fall into two groups. Some are human-meaningful, but not necessarily
> dictionary words e.g.:
> 
> 
> baby lions at play
> saturday_morning12
> Fukushima
> ImpossibleFork
> 
> 
> (note that some use underscores, others spaces, and some CamelCase) while
> others are completely meaningless (or mostly so):
> 
> 
> xy39mGWbosjY
> 9sjz7s8198ghwt
> rz4sdko-28dbRW00u
> 
> 
> Let's call the second group "random" and the first "non-random", without
> getting bogged down into arguments about whether they are really random or
> not. I wish to process the strings and automatically determine whether
> each string is random or not. I need to split the strings into three
> groups:
> 
> - those that I'm confident are random
> - those that I'm unsure about
> - those that I'm confident are non-random
> 
> Ideally, I'll get some sort of numeric score so I can tweak where the
> boundaries fall.
> 
> Strings are *mostly* ASCII but may include a few non-ASCII characters.
> 
> Note that false positives (detecting a meaningful non-random string as
> random) is worse for me than false negatives (miscategorising a random
> string as non-random).
> 
> Does anyone have any suggestions for how to do this? Preferably something
> already existing. I have some thoughts and/or questions:
> 
> - I think nltk has a "language detection" function, would that be
> suitable?
> 
> - If not nltk, are there are suitable language detection libraries?
> 
> - Is this the sort of problem that neural networks are good at solving?
> Anyone know a really good tutorial for neural networks in Python?
> 
> - How about Bayesian filters, e.g. SpamBayes?

A dead simple approach -- look at the pairs in real words and calculate the 
ratio

pairs-also-found-in-real-words/num-pairs

$ cat score.py
import sys
WORDLIST = "/usr/share/dict/words"

SAMPLE = """\
baby lions at play
saturday_morning12
Fukushima
ImpossibleFork
xy39mGWbosjY
9sjz7s8198ghwt
rz4sdko-28dbRW00u
""".splitlines()

def extract_pairs(text):
for i in range(len(text)-1):
yield text[i:i+2]


def load_pairs():
pairs = set()
with open(WORDLIST) as f:
for line in f:
pairs.update(extract_pairs(line.strip()))
return pairs


def get_score(text, popular_pairs):
m = 0
for i, p in enumerate(extract_pairs(text), 1):
if p in popular_pairs:
m += 1
return m/i


def main():
popular_pairs = load_pairs()
for text in sys.argv[1:] or SAMPLE:
score = get_score(text, popular_pairs)
print("%4.2f  %s" % (score, text))


if __name__ == "__main__":
main()

$ python3 score.py
0.65  baby lions at play
0.76  saturday_morning12
1.00  Fukushima
0.92  ImpossibleFork
0.36  xy39mGWbosjY
0.31  9sjz7s8198ghwt
0.31  rz4sdko-28dbRW00u

However:

$ python3 -c 'import random, sys; a = list(sys.argv[1]); random.shuffle(a); 
print("".join(a))' 'baby lions at play'
bnsip atl ayba loy
$ python3 score.py 'bnsip atl ayba loy'
0.65  bnsip atl ayba loy


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


Re: Catogorising strings into random versus non-random

2015-12-21 Thread Steven D'Aprano
On Monday 21 December 2015 15:22, Chris Angelico wrote:

> On Mon, Dec 21, 2015 at 2:01 PM, Steven D'Aprano 
> wrote:
>> I have a large number of strings (originally file names) which tend to
>> fall into two groups. Some are human-meaningful, but not necessarily
>> dictionary words e.g.:
[...]

> The first thing that comes to my mind is poking the string into a
> search engine and seeing how many results come back. You might need to
> do some preprocessing to recognize multi-word forms (maybe a handful
> of recognized cases like snake_case, CamelCase,
> CamelCasewiththeLittleWordsLeftUnchanged, etc),

I could possibly split the string into "words", based on CamelCase, spaces, 
hyphens or underscores. That would cover most of the cases.

> How many of these keywords would you be looking up, and would a
> network transaction (a search engine API call) for each one be too
> expensive?

Tens or hundreds of thousands of strings, and yes a network transaction 
probably would be a bit much. I'd rather not have Google or Bing be a 
dependency :-)


-- 
Steve

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


[issue25902] Fixed various refcount issues in ElementTree iteration

2015-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 00b6a13cfd70 by Serhiy Storchaka in branch '3.5':
Issue #25902: Fixed various refcount issues in ElementTree iteration.
https://hg.python.org/cpython/rev/00b6a13cfd70

New changeset e09cb2af3092 by Serhiy Storchaka in branch 'default':
Issue #25902: Fixed various refcount issues in ElementTree iteration.
https://hg.python.org/cpython/rev/e09cb2af3092

--
nosy: +python-dev

___
Python tracker 

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



[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-21 Thread Eryk Sun

Eryk Sun added the comment:

The ANSI API is problematic because it returns a best-fit encoding to the 
system codepage. For example:

>>> os.listdir('.')
['ƠƨưƸǀLjǐǘǠǨǰǸ']

>>> os.listdir(b'.')
[b'O?u?|?iu?Kj?']

To somewhat work around this problem, listdir and scandir could return the 
cAlternateFilename of the WIN32_FIND_DATA struct if present. This is the 
classic 8.3 short name that Microsoft file systems create for MS-DOS 
compatibility. For NTFS it can be disabled in the registry, or per volume, but 
I assume whoever does that knows what to expect. 

Also, since Python wouldn't need the short name for a wide-character path, 
there's no point in asking for it. (For NTFS it's a separate entry in the MFT. 
If it exists, which is known ahead of time, finding the entry requires a second 
lookup.) In this case it's better to call FindFirstFileExW and request only 
FindExInfoBasic. Generally the difference is inconsequential, but in a 
contrived example with 1 similarly-named files from "ĀāĂă" to 
"ĀāĂă" and short names from "~1" to "~1", skipping the short name 
lookup shaved about 10% off the total time. For this test, I replaced the 
FindFirstFileW call in posix_scandir with the following call:

iterator->handle = FindFirstFileExW(path_strW,
FindExInfoBasic,
>file_data,
FindExSearchNameMatch,
NULL, 0);

--
nosy: +eryksun

___
Python tracker 

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



[issue25918] AssertionError in lib2to3 on 2.7.11 Windows

2015-12-21 Thread Marc Schlaich

Marc Schlaich added the comment:

After deleting them, they are getting recreated and everything works now.

--

___
Python tracker 

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



Re: Catogorising strings into random versus non-random

2015-12-21 Thread Steven D'Aprano
On Mon, 21 Dec 2015 08:56 pm, Christian Gollwitzer wrote:

> Apfelkiste:Tests chris$ python score_my.py
> -8.74  baby lions at play
> -7.63  saturday_morning12
> -6.38  Fukushima
> -5.72  ImpossibleFork
> -10.6  xy39mGWbosjY
> -12.9  9sjz7s8198ghwt
> -12.1  rz4sdko-28dbRW00u
> Apfelkiste:Tests chris$ python score_my.py 'bnsip atl ayba loy'
> -9.43  bnsip atl ayba loy

Thanks Christian and Peter for the suggestion, I'll certainly investigate
this further.

But the scoring doesn't seem very good. "baby lions at play" is 100% English
words, and ought to have a radically different score from (say)
xy39mGWbosjY which is extremely non-English like. (How many English words
do you know of with W, X, two Y, and J?) And yet they are only two units
apart. "baby lions..." is a score almost as negative as the authentic
gibberish, while Fukushima (a Japanese word) has a much less negative
score. Using trigraphs doesn't change that:

> -11.5  baby lions at play
> -9.85  Fukushima
> -13.4  xy39mGWbosjY

So this test appears to find that English-like words are nearly as "random"
as actual random strings.

But it's certainly worth looking into.


-- 
Steven

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


[issue25869] Faster ElementTree deepcopying

2015-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 090c3e3a648d by Serhiy Storchaka in branch 'default':
Issue #25869: Optimized deepcopying ElementTree; it is now 20 times faster.
https://hg.python.org/cpython/rev/090c3e3a648d

--
nosy: +python-dev

___
Python tracker 

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



[issue25918] AssertionError in lib2to3 on 2.7.11 Windows

2015-12-21 Thread Marc Schlaich

New submission from Marc Schlaich:

This simple test case results in a lib2to3 crash with an AssertionError in 
2.7.11


source = '''

class Test(object):

tests = []


'''

from lib2to3.refactor import RefactoringTool


def main():
tool = RefactoringTool([])
tool.refactor_string(source, '')


Exception:

Traceback (most recent call last):
  File "test.py", line 21, in 
main()
  File "test.py", line 16, in main
tool.refactor_string(source, '')
  File "c:\Python27\Lib\lib2to3\refactor.py", line 380, in refactor_string
name, err.__class__.__name__, err)
  File "c:\Python27\Lib\lib2to3\refactor.py", line 377, in refactor_string
tree = self.driver.parse_string(data)
  File "c:\Python27\Lib\lib2to3\pgen2\driver.py", line 106, in parse_string
return self.parse_tokens(tokens, debug)
  File "c:\Python27\Lib\lib2to3\pgen2\driver.py", line 71, in parse_tokens
if p.addtoken(type, value, (prefix, start)):
  File "c:\Python27\Lib\lib2to3\pgen2\parse.py", line 127, in addtoken
assert t < 256
AssertionError

Pretty weird: A manually built Python 2.7.11 with VS 2008 doesn't show this 
issue.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 256790
nosy: schlamar
priority: normal
severity: normal
status: open
title: AssertionError in lib2to3 on 2.7.11 Windows
type: crash
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



[issue23670] Modifications to support iOS as a cross-compilation target

2015-12-21 Thread Nick Coghlan

Nick Coghlan added the comment:

Mac OS X 10.5 was the last version to support PowerPC architectures, and 
according to https://en.wikipedia.org/wiki/Mac_OS_X_Leopard#Release_history, 
the final version of that was 10.5.8, released in August 2009.

While we don't have a section in https://www.python.org/dev/peps/pep-0011/ 
spelling out our support policy for Mac OS X the way we do for Windows, Ned is 
still making dual architecture binaries available for 2.7.x and 3.5.x as seen 
at https://www.python.org/downloads/release/python-2711/ and 
https://www.python.org/downloads/release/python-351/

--

___
Python tracker 

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



Re: Catogorising strings into random versus non-random

2015-12-21 Thread Christian Gollwitzer

Am 21.12.15 um 11:53 schrieb Christian Gollwitzer:

So for the spaces, either use a proper trainig material (some long
corpus from Wikipedia or such), with punctuation removed. Then it will
catch the correct probabilities at word boundaries. Or preprocess by
removing the spaces.

 Christian


PS: The real log-likelihood would become -infinity, when some pair does 
not appear at all in the training set (esp. the numbers, e.g.). I used 
the 1/total in the defaultdict to mitigate that. You could tweak that 
value a bit. The larger the corpus, the sharper it will divide by 
itself, too.


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


[issue4709] Mingw-w64 and python on windows x64

2015-12-21 Thread Steve Dower

Steve Dower added the comment:

> What needs to still be done in order that a user with a fresh Python install 
> in Windows (and no compiler installed) can do "pip install 
> an_extension_that_needs_compiling" and it _just works_?

The package developer takes the time to build a wheel on Windows (presumably 
they are already testing on Windows...?) and publishes it. Problem solved.

Most of our efforts are (or should be) aimed at making it easier for the 
developers to do this, rather than trying to make a seamless build toolchain 
for the end user.

--

___
Python tracker 

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



[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-21 Thread Ben Hoyt

Ben Hoyt added the comment:

Just to clarify what Victor and Zachary mentioned: bytes filenames have been 
deprecated only *on Windows* since Python 3.3; bytes filenames are still fine 
on POSIX.

--

___
Python tracker 

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



[issue25848] Tkinter tests failed on Windows buildbots

2015-12-21 Thread Larry Hastings

Larry Hastings added the comment:

I hear your plea.  But isn't it almost as easy to just leave it alone?  3.4 
won't get many checkins from now on, so it won't actually kick off many tasks.  
But it would mean the "check the buildbots" step of making a release would be 
super easy, rather than the huge pain of requesting a manual build on the 
buildbots.

--

___
Python tracker 

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



[issue25914] Fix OrderedDict.__sizeof__

2015-12-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0a2ea08fcebe by Serhiy Storchaka in branch '3.5':
Issue #25914: Fixed and simplified OrderedDict.__sizeof__.
https://hg.python.org/cpython/rev/0a2ea08fcebe

New changeset 624316fbb39d by Serhiy Storchaka in branch 'default':
Issue #25914: Fixed and simplified OrderedDict.__sizeof__.
https://hg.python.org/cpython/rev/624316fbb39d

--
nosy: +python-dev

___
Python tracker 

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



[issue25914] Fix OrderedDict.__sizeof__

2015-12-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: commit review -> 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



IDLE 3.5.1 quits unexpectedly (portuguese keyboard)

2015-12-21 Thread Osvaldo Dias dos Santos
Hi,

Pressing the tilde key my iMac portuguese keyboard quits IDLE unexpectedly 
(along with any associated files I may be working on, including code). 

The keyboard image is attached. The tilde key is the second orange one from the 
top.

This key is very important in this language, because pressing it together with 
the shift key, the caret ( ^ ) symbol is entered. So, if I try to enter a caret 
and press the shift and the tilde key to do it, IDLE quits and any unsaved file 
information (even code) is lost.
Then Apple crash report window opens, but if I click the reopen button nothing 
happens, IDLE does not reopen.

Python 3.5.1
OS X 10.11.2 (El Capitan)

Anyone may help ?

Thank you,
Kind regards,
Osvaldo


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


Error

2015-12-21 Thread Amaan Hussain
Hello.
I get an error saying "api-ms-win-crt-runtime-l1-1-0.dll is missing"
Can you tell me how to fix this.
Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ignore error with non-zero exit status

2015-12-21 Thread Mark Lawrence

On 21/12/2015 07:51, Thomas 'PointedEars' Lahn wrote:

Chris Angelico wrote:


But it's been clearly stated that .format is not going to do away with
percent formatting, and all language of "new-style formatting" has been
removed so as not to cause confusion.


Wishful thinking, twice.



http://www.gossamer-threads.com/lists/python/dev/969817

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

Mark Lawrence

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


[issue4709] Mingw-w64 and python on windows x64

2015-12-21 Thread Henry Gomersall

Henry Gomersall added the comment:

@Steve Great, so what needs to be done so that I as a package developer can do 
`pip install windows-build-system`, `python setup.py bdist_wheel` and it 
actually creates a wheel? (which AFAICT is the same problem).

My interest is precisely as a package developer. I've spent far far too much 
time fighting compilers on Windows (many days) and I don't want to do that any 
more. Every time I come across a new machine, I need to re-establish the 
current way to do things, which invariably doesn't work properly because I 
can't find the SDK to download, or the SDK installation doesn't include things 
any more, or some other reason which I can't work out. On Linux, everything is 
basically wonderful - I notice no difference between pure python packages and 
extensions packages.

--

___
Python tracker 

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



[issue25869] Faster ElementTree deepcopying

2015-12-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> 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



[issue25900] unittest ignores the first ctrl-c when it shouldn't

2015-12-21 Thread Michael Foord

Michael Foord added the comment:

Suggested behaviour sounds good, patch looks sensible. Is it possible to add a 
test too?

--

___
Python tracker 

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



[issue25873] Faster ElementTree iterating

2015-12-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> 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



Please help

2015-12-21 Thread Abdul Basit
I am receiving this error while installing python interpreter version 3.5.1 (32 
bit)
Error is " This program cannot start because api-ms-win-crt-runtime-l1-1-0.dll 
is missing from your computer"

I reinstalled this file but again this error message 

What should I do to remove this issue kindly help me 

Regards
 Abdul Basit 
-- 
https://mail.python.org/mailman/listinfo/python-list


[no subject]

2015-12-21 Thread Animesh Srivastava
While installin python3.5.1 i m getting 0xc07b error
Please reslove it
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >