[issue26828] Implement __length_hint__() on map() and filter() to optimize list(map) and list(filter)

2017-04-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Length hints were intentionally omitted from the Python 3 map() and filter() 
which used to be in the itertools module.   I explored that notion of iterator 
length transparency years ago.  While I don't remember all the details, I did 
record some notes at the top of Lib/test/test_iterlen.py.

BTW, I also don't think the list(map(...)) or list(filter(...)) case is worth 
optimizing.  For big inputs, manifesting the whole input into a list is usually 
(but not always) the wrong thing to do if you care about performance (throwing 
away the iterator's superb L1 and L2 cache performance and throwing away the 
memory efficiency).

--

___
Python tracker 

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> In my experience CSV files with fields with embedded newlines 
> are pretty common.  I don't really think we want to support
> invalid CSV files.

I concur with David on both points.   Also, whether common or not, we don't 
want to break existing code that already works.

I recommend marking this as rejected and closing.

--
nosy: +rhettinger

___
Python tracker 

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



[issue30035] [RFC] PyMemberDef.name should be const char *

2017-04-10 Thread Sunyeop Lee

New submission from Sunyeop Lee:

PyMemberDef from Noddy examaple: 
https://docs.python.org/3/extending/newtypes.html

static PyMemberDef Noddy_members[] = {
{"first", T_OBJECT_EX, offsetof(Noddy, first), 0,
 "first name"},
{"last", T_OBJECT_EX, offsetof(Noddy, last), 0,
 "last name"},
{"number", T_INT, offsetof(Noddy, number), 0,
 "noddy number"},
{NULL}  /* Sentinel */
};

When compiling the code with the PyMemberDef above with GCC, it compiles well. 
However, with G++, ISO C++11 complains(warns) it is deprecated to convert 
string literal to 'char *' is deprecated 
[-Wc++11-compat-deprecated-writable-strings]

Should the example code be fixed, or should PyMemberDef fixed? I think 
PyMemberDef.name should bo const char * instead of char *.

Compiled with:
g++ test.cpp 
-I/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/include/python3.6m
 
-L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin
 -lpython3.6m -fPIC -shared

Compiler versions:

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

--
components: Extension Modules
files: test.cpp
messages: 291459
nosy: Sunyeop Lee
priority: normal
severity: normal
status: open
title: [RFC] PyMemberDef.name should be const char *
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file46795/test.cpp

___
Python tracker 

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



[issue26828] Implement __length_hint__() on map() and filter() to optimize list(map) and list(filter)

2017-04-10 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue26828] Implement __length_hint__() on map() and filter() to optimize list(map) and list(filter)

2017-04-10 Thread Michael Seifert

Changes by Michael Seifert :


--
pull_requests: +1220

___
Python tracker 

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



[issue29030] argparse: choices override metavar

2017-04-10 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> bethard
nosy: +bethard

___
Python tracker 

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



[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

2017-04-10 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



Re: Pound sign problem

2017-04-10 Thread Steve D'Aprano
On Tue, 11 Apr 2017 12:50 am, Lew Pitcher wrote:

> David Shi wrote:
> 
>> In the data set, pound sign escape appears:
>> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000',

That looks like David is using Python 2.

>> When using table.to_csv after importing pandas as pd, an error message
>> persists as follows: UnicodeEncodeError: 'ascii' codec can't encode
>> character u'\xa3' in position 0: ordinal not in range(128)
> 
> There is no "pound sign" in ASCII[1]. Try changing your target encoding to
> something other than ASCII.

Please don't encourage the use of old legacy encodings.

In 2017, unless you are reading from old legacy files created using a
non-Unicode encoding, you should just use UTF-8.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Keith Erskine

Keith Erskine added the comment:

As you say, David, however much we would like the world to stick to a given CSV 
standard, the reality is that people don't, which is all the more reason for 
making the csv reader flexible and forgiving.

The csv module can and should be used for more than just 
"comma-separated-values" files.  I use it for all sorts of different delimited 
files, and it works very well.  Pandas uses it, as I'm sure do many other 
packages.  It's such a good module, it would be a pity to restrict its scope to 
just Excel-related scenarios.  Parsing delimited files is undoubtedly complex, 
and painfully slow if done with pure Python, so the more that can be done in C 
the better.

I'm no C programmer, but my guesstimate is that the coding changes I'm 
proposing are relatively modest.  In the IN_QUOTED_FIELD section 
(https://github.com/python/cpython/blob/master/Modules/_csv.c#L690), it would 
mean checking for newline characters if the new "multiline" attribute is False 
(and probably "strict" is False too).  Of course there is more to this change 
than just that, but I'm guessing not that much more.

--

___
Python tracker 

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

Well, ETL is semi-standardized.  Try dealing with csv files exported from excel 
spreadsheets written by non-programmers :)

"e"X is not a quoting the csv module will produce, but I don't think it is a 
csv error.  insofar as csv has a standard, it is a defacto standard based on 
what Microsoft tools do.  What does excel, for example, do with either of those 
examples?

--

___
Python tracker 

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



Re: Python and the need for speed

2017-04-10 Thread Chris Angelico
On Tue, Apr 11, 2017 at 8:45 AM, Erik  wrote:
> On 10/04/17 03:23, Chris Angelico wrote:
>>
>> Okay, I have a pretty thick skin, but this is getting a bit obnoxious.
>> Can you PLEASE post something that isn't just insulting me? Thanks.
>
>
> Are you suggesting he should post something that insults you *and* others?
> If so, I'm up for being insulted too ;)

If he does, it might be the final thing that gets him banned from the
mailing list.

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


[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Keith Erskine

Keith Erskine added the comment:

The csv reader already handles a certain amount of bad formatting.  For 
example, using default behavior, the following file:

a,b,c
d,"e"X,f
g,h,i

is read as:
['a', 'b', 'c']
['d', 'eX', 'f']
['g', 'h', 'i']

It seems reasonable that csv should be able to handle delimited files that are 
not perfectly formatted.  After all, even the CSV "standard" isn't really a 
standard.  When dealing with large (10GB+) files, it's a pain if csv cannot 
read the file because of just one misplaced quote character.  Besides, data 
files are only going to get bigger.

Also, I have to say, I've been dealing with large ETL jobs for over 15 years 
now and I'm struggling to think of a time when I've ever seen a multiline CSV 
file.  Of course, we've all have different experiences.

--

___
Python tracker 

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



Re: Python and the need for speed

2017-04-10 Thread Erik

On 10/04/17 03:23, Chris Angelico wrote:

Okay, I have a pretty thick skin, but this is getting a bit obnoxious.
Can you PLEASE post something that isn't just insulting me? Thanks.


Are you suggesting he should post something that insults you *and* 
others? If so, I'm up for being insulted too ;)


E.

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


Re: read in a list in a file to list

2017-04-10 Thread Erik

On 09/04/17 22:22, john polo wrote:

The new attempt gives me a list, now I have to figure out how to deal
with unwanted quotation marks and spaces.

datFil =  open("apelist.txt")
datObj =  datFil.read()


datObj2 = datObj.replace('" ','')  #added this comment while writing
this email: I guess I could have used 'datObj = datFil.read().replace('"
','')'. Can you make two replacements in the same statement, for example
'datObj=datFil.read().replace('" ','').replace('"','')?

datObj2 = datObj2.replace('"','')  #this was here to try to get rid of "
that didn't have a subsequent space.


John, where does your "apelist.txt" file come from? Who has decided what 
format it should be in?


If *you* get to decide that, then the best thing to do is to specify a 
format that is easy to read in in the first place - rather than 
specifying something that looks like source code and then has to be parsed.


E.g., if the file had the format:

Home sapiens
Pan troglodytes
Gorilla gorilla

(i.e., each value on a separate line with no quotes or any other 
"noise"), then the code to read that in as you have indicated you want 
is something like:


for i in open("apefile.txt").readlines():
print("one of the apes is " + i.rstrip())

(the .rstrip() is to remove the trailing newline character - and any 
other trailing whitespace - which readlines() will include in what it 
returns).


Of course, if you don't have any control over the input file's format, 
then it looks like you (or something you delegate to) will have to do 
some sort of parsing.


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


RE: Swiss Ephemeris

2017-04-10 Thread Deborah Swanson
Hi Peter

I'm willing to believe there's a correlation between planetary cycles
and the stockmarket, if you say you see one. The question is whether
this correlation has truth value significance, or whether it's just a
set of coincidences. 

The correlation is interesting, but I fail to see the causal link, the
reason why planetary cycles necessarily have a relationship with market
movements, and without that all you have is coincidence. 

Though one could spend a great deal of time analyzing the correlation, I
have low confidence that it would be a strong and reliable correlation.
This has been the fate of many other misadventures in astrology, systems
of belief built around weak and unreliable correlations that are
sometimes right, but more often wrong, sad to say.

I don't have Windows 7 or 10. Any chance there's source code for the
addin? That's what I would be looking at anyway. ;)

Best,
Deborah



Peter Henry wrote, on Monday, April 10, 2017 1:56 PM
> 
> Hi Deborah
> 
> Very few people would believe there is correlation between 
> planetary cycles and the stockmarket  however this is known 
> to select few, for many years, I can also visually see 
> relationship on charts, however its hard to quantify statically
> 
> http://astrologynewsservice.com/business/study-confirms-plan
> ets-impact-stock-market-averages/
> 
> I'll forward the Excel addin later it works on Windows 7 and 
> require updating to Win10
> 
> The idea is to create a full and complete program in Python 
> only, that would import stock data, generate planetary 
> coordinates, pre process train then predict
> 
> I'll keep you updated
> 
> Peter
> 
> 
> 
> On 10 Apr 2017 9:10 p.m., "Deborah Swanson" 
> 
> wrote:
> 
> > Hi Peter,
> >
> > I would be interested in seeing your Excel addin with customized 
> > planetary settings. I'd be curious what these 
> customizations would be, 
> > though if they look useful I'd more likely be scavenging 
> the code to 
> > rewrite it in Python and add to what I already have, rather 
> than using 
> > the addin in Excel. The only thing not quite right about 
> what I have 
> > is the times, which are a smidge off. This could be due to 
> planetary 
> > anomalies, so I definitely would like to look at it.
> >
> > I totally agree with all you said about Python and more. I didn't 
> > start out in Python looking to replace Excel or to migrate my 
> > planetary project to it, those things just happened along 
> the way. But 
> > looking around to see what was new and what was better than 
> anything 
> > I'd done before, Python was a natural choice.
> >
> > I'll have to say though that I don't share your enthusiasm for 
> > modeling the market with planetary relationships, indeed any 
> > mathematical modelling of the market can easily be overall 
> wrong, and 
> > yet complex enough to engage the explorer endlessly.
> >
> > I've analyzed a couple of these schemes to draw that conclusion, 
> > though it's tentative at best. Obviously there are 
> mathematical models 
> > of the market that do work, but I really don't know anything about 
> > them.
> >
> > In this case though, I don't see the connection between planetary 
> > configurations and a pure physical aspect of the market for them to 
> > engage with. And as you may recall from somewhere, to establish 
> > causality you must produce the causal link between the two sets of 
> > events you're attempting to correlate. No matter how 
> stunning an array 
> > of coincidences might be, without producing the causal link 
> you really 
> > don't have anything. This is a key error that many who do 
> statistical 
> > analyses tend to overlook.
> >
> > I looked at your CSV, but I'm not sure what you would like 
> to add to 
> > it, probably because I'm totally unfamiliar with this type 
> of project.
> >
> > Best in your endeavors,
> >
> > Deborah
> >
> >
> > Peter Henry wrote, on Monday, April 10, 2017 11:58 AM
> >
> > Hi Deborah,
> >
> >
> > Thanks your reply and interest,
> >
> >
> > A few years ago did create a Excel addin, that extracted planetary 
> > coordinates from the Swisseph source code and populated excel 
> > spreadsheet  This Marco addin had customized planetary settings of 
> > which was  useful
> >
> >
> > Currently now learning to program in Python as it  is flexible, 
> > popular for machine learning and data science. The idea the 
> planetary 
> > coordinate can help with timing stock commodity and Forex 
> markets, as 
> > both freely trading markets and planetary  movement adhere 
> to natural 
> > law
> >
> >
> > Neural networks can also assist in extracting relationship 
> information 
> > between markets and planetary positions.
> >
> >
> > Whilst waiting for a solution  can you advise of an 
> efficient way of 
> > producing a a CSV file similar to the file attached, only planetary 
> > data required
> >
> >
> >
> >
> > Many thanks
> >
> >
> > Peter
> >
> >
> > On 10 April 2017 at 02:52, Deborah Swanson 

[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

In my experience CSV files with fields with embedded newlines are pretty 
common.  I don't really think we want to support invalid CSV files.

--
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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Keith Erskine

Keith Erskine added the comment:

Perhaps I should add what I would prefer the csv reader to return in my example 
above.  That would be:

['a', 'b', 'c']
['d', 'e,f']
['g', 'h', 'i']

Yes, the second line is still mangled but at least the csv reader would carry 
on and read the third line correctly.

--

___
Python tracker 

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
components: +Library (Lib)
nosy: +Mariatta

___
Python tracker 

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



[issue30034] csv reader chokes on bad quoting in large files

2017-04-10 Thread Keith Erskine

New submission from Keith Erskine:

If a csv file has a quote character at the beginning of a field but no closing 
quote, the csv module will keep reading the file until the very end in an 
attempt to close out the field.  It's true this situation occurs only when the 
quoting in a csv file is incorrect, but it would be extremely helpful if the 
csv reader could be told to stop reading each row of fields when it encounters 
a newline character, even if it is within a quoted field at the time.  At the 
moment, with large files, the csv reader will typically error out in this 
situation once it reads the maximum size of a string.  Furthermore, this is not 
an easy situation to trap with custom code.

Here's an example of the what I'm talking about.  For a csv file with the 
following content:
a,b,c
d,"e,f
g,h,i

This code:

import csv
with open('file.txt') as f:
reader = csv.reader(f)
for row in reader:
print(row)

returns:
['a', 'b', 'c']
['d', 'e,f\ng,h,i\n']

Note that the whole of the file after "e", including delimiters and newlines, 
has been added to the second field on the second line. This is correct csv 
behavior but is very unhelpful to me in this situation.

On the grounds that most csv files do not have multiline values within them, 
perhaps a new dialect attribute called "multiline" could be added to the csv 
module, that defaults to True for backwards compatibility.  It would indicate 
whether the csv file has any field values within it that span more than one 
line.  If multiline is False, then the "parse_process_char" function in "_csv" 
would always close out a row of fields when it encounters a newline character.  
It might be best if this multiline attribute were taken into account only when 
"strict" is False.

Right now, I do get badly-formatted files like this, and I cannot ask the 
source for a new file.  I have to manually correct the file using a mixture of 
custom scripts and vi before the csv module will read it. It would be very 
helpful if csv would handle this directly.

--
messages: 291453
nosy: keef604
priority: normal
severity: normal
status: open
title: csv reader chokes on bad quoting in large files
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-04-10 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
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



Fwd: Swiss Ephemeris

2017-04-10 Thread Peter Henry
Hi Deborah

Very few people would believe there is correlation between planetary cycles
and the stockmarket  however this is known to select few, for many years, I
can also visually see relationship on charts, however its hard to quantify
statically

http://astrologynewsservice.com/business/study-confirms-plan
ets-impact-stock-market-averages/

I'll forward the Excel addin later it works on Windows 7 and require
updating to Win10

The idea is to create a full and complete program in Python only, that
would import stock data, generate planetary coordinates, pre process train
then predict

I'll keep you updated

Peter



On 10 Apr 2017 9:10 p.m., "Deborah Swanson" 
wrote:

> Hi Peter,
>
> I would be interested in seeing your Excel addin with customized
> planetary settings. I'd be curious what these customizations would be,
> though if they look useful I'd more likely be scavenging the code to
> rewrite it in Python and add to what I already have, rather than using
> the addin in Excel. The only thing not quite right about what I have is
> the times, which are a smidge off. This could be due to planetary
> anomalies, so I definitely would like to look at it.
>
> I totally agree with all you said about Python and more. I didn't start
> out in Python looking to replace Excel or to migrate my planetary
> project to it, those things just happened along the way. But looking
> around to see what was new and what was better than anything I'd done
> before, Python was a natural choice.
>
> I'll have to say though that I don't share your enthusiasm for modeling
> the market with planetary relationships, indeed any mathematical
> modelling of the market can easily be overall wrong, and yet complex
> enough to engage the explorer endlessly.
>
> I've analyzed a couple of these schemes to draw that conclusion, though
> it's tentative at best. Obviously there are mathematical models of the
> market that do work, but I really don't know anything about them.
>
> In this case though, I don't see the connection between planetary
> configurations and a pure physical aspect of the market for them to
> engage with. And as you may recall from somewhere, to establish
> causality you must produce the causal link between the two sets of
> events you're attempting to correlate. No matter how stunning an array
> of coincidences might be, without producing the causal link you really
> don't have anything. This is a key error that many who do statistical
> analyses tend to overlook.
>
> I looked at your CSV, but I'm not sure what you would like to add to it,
> probably because I'm totally unfamiliar with this type of project.
>
> Best in your endeavors,
>
> Deborah
>
>
> Peter Henry wrote, on Monday, April 10, 2017 11:58 AM
>
> Hi Deborah,
>
>
> Thanks your reply and interest,
>
>
> A few years ago did create a Excel addin, that extracted planetary
> coordinates from the Swisseph source code and populated excel
> spreadsheet  This Marco addin had customized planetary settings of which
> was  useful
>
>
> Currently now learning to program in Python as it  is flexible, popular
> for machine learning and data science. The idea the planetary coordinate
> can help with timing stock commodity and Forex markets, as both freely
> trading markets and planetary  movement adhere to natural law
>
>
> Neural networks can also assist in extracting relationship information
> between markets and planetary positions.
>
>
> Whilst waiting for a solution  can you advise of an efficient way of
> producing a a CSV file similar to the file attached, only planetary data
> required
>
>
>
>
> Many thanks
>
>
> Peter
>
>
> On 10 April 2017 at 02:52, Deborah Swanson 
> wrote:
>
> Peter Henry wrote, on Sunday, April 09, 2017 10:53 AM
> >
> > I have a package that has been altered to imported in to
> > python, however I tired to get is working but without success
> > I be missing something obvious
> >
> > The Swiss Ephemeris enable planetary coordinate  to be
> > imported and used in your program
> >
> > Files access https://pypi.python.org/pypi/pyswisseph
> >
> > Many thanks in advance
> >
> > Peter
>
> I've also worked on the problem of getting sweph into Python and have
> mostly struck out so far myself.
>
> I found one reliable means to get sweph's planetary data into Python,
> but it's more or less a cheat. Nonetheless, if you want to see how much
> good it does you, try the Swiss Ephemeris Test Page at
> http://www.astro.com/swisseph/swetest.htm. If you can successfully
> formulate a query useful to your purposes, you can download a csv of
> results, read it into Python, and work from there. Right now I'm working
> on converting some Excel spreadsheets and Excel VBA I use into Python
> and recoding it all, using the CSVs for jumping off points. That works
> pretty well, except the times from swetest are off a bit and I haven't
> figured out why. But I'm concentrating on getting all my VBA code ported
> to 

[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

There is, however, an issue that if you pass a message with the default policy 
to the generator and specify SMTP as the policy, it doesn't *recode* the line 
endings.  I thought there was an open issue for that, but I can't find it.

One solution would be to do as you suggest and make \r\n what we always use 
when doing base64 encoding.  I'm open to that as a possible fix, but it 
probably needs at least a brief discussion with Barry.

--

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

Huh.  I ran something like that test and thought I saw the reverse.  I guess I 
misread my terminal.  Looking at the code, set_content does take care to fix 
the line ending according to the policy before doing the encoding.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens

Jon Ribbens added the comment:

So on further investigation, with the new API and policy=SMTP, it does generate 
correct base64 output. So I guess on the basis that the new version can 
generate the right output, and it appears to be a deliberate choice that the 
default policy breaks the RFCs, you can close this issue ;-)

>>> from email.message import EmailMessage
>>> from email.policy import SMTP
>>> import base64
>>> msg = EmailMessage(policy=SMTP)
>>> msg.set_content("hello\nthere", cte="base64")
>>> msg.as_string()
'Content-Type: text/plain; charset="utf-8"\r\nContent-Transfer-Encoding: 
base64\r\nMIME-Version: 1.0\r\n\r\naGVsbG8NCnRoZXJlDQo=\r\n'
>>> base64.b64decode("aGVsbG8NCnRoZXJlDQo=")
b'hello\r\nthere\r\n'

--

___
Python tracker 

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



RE: Swiss Ephemeris

2017-04-10 Thread Deborah Swanson
Hi Peter,

I would be interested in seeing your Excel addin with customized
planetary settings. I'd be curious what these customizations would be,
though if they look useful I'd more likely be scavenging the code to
rewrite it in Python and add to what I already have, rather than using
the addin in Excel. The only thing not quite right about what I have is
the times, which are a smidge off. This could be due to planetary
anomalies, so I definitely would like to look at it.

I totally agree with all you said about Python and more. I didn't start
out in Python looking to replace Excel or to migrate my planetary
project to it, those things just happened along the way. But looking
around to see what was new and what was better than anything I'd done
before, Python was a natural choice.

I'll have to say though that I don't share your enthusiasm for modeling
the market with planetary relationships, indeed any mathematical
modelling of the market can easily be overall wrong, and yet complex
enough to engage the explorer endlessly. 

I've analyzed a couple of these schemes to draw that conclusion, though
it's tentative at best. Obviously there are mathematical models of the
market that do work, but I really don't know anything about them. 

In this case though, I don't see the connection between planetary
configurations and a pure physical aspect of the market for them to
engage with. And as you may recall from somewhere, to establish
causality you must produce the causal link between the two sets of
events you're attempting to correlate. No matter how stunning an array
of coincidences might be, without producing the causal link you really
don't have anything. This is a key error that many who do statistical
analyses tend to overlook.

I looked at your CSV, but I'm not sure what you would like to add to it,
probably because I'm totally unfamiliar with this type of project. 

Best in your endeavors,

Deborah


Peter Henry wrote, on Monday, April 10, 2017 11:58 AM

Hi Deborah,


Thanks your reply and interest, 


A few years ago did create a Excel addin, that extracted planetary
coordinates from the Swisseph source code and populated excel
spreadsheet  This Marco addin had customized planetary settings of which
was  useful


Currently now learning to program in Python as it  is flexible, popular
for machine learning and data science. The idea the planetary coordinate
can help with timing stock commodity and Forex markets, as both freely
trading markets and planetary  movement adhere to natural law


Neural networks can also assist in extracting relationship information
between markets and planetary positions. 


Whilst waiting for a solution  can you advise of an efficient way of
producing a a CSV file similar to the file attached, only planetary data
required




Many thanks 


Peter 


On 10 April 2017 at 02:52, Deborah Swanson 
wrote:

Peter Henry wrote, on Sunday, April 09, 2017 10:53 AM
>
> I have a package that has been altered to imported in to
> python, however I tired to get is working but without success
> I be missing something obvious
>
> The Swiss Ephemeris enable planetary coordinate  to be
> imported and used in your program
>
> Files access https://pypi.python.org/pypi/pyswisseph
>
> Many thanks in advance
>
> Peter

I've also worked on the problem of getting sweph into Python and have
mostly struck out so far myself.

I found one reliable means to get sweph's planetary data into Python,
but it's more or less a cheat. Nonetheless, if you want to see how much
good it does you, try the Swiss Ephemeris Test Page at
http://www.astro.com/swisseph/swetest.htm. If you can successfully
formulate a query useful to your purposes, you can download a csv of
results, read it into Python, and work from there. Right now I'm working
on converting some Excel spreadsheets and Excel VBA I use into Python
and recoding it all, using the CSVs for jumping off points. That works
pretty well, except the times from swetest are off a bit and I haven't
figured out why. But I'm concentrating on getting all my VBA code ported
to Python, and will go back to getting bang on data from sweph after I
have my code done.

The first thing I tried was to get sweph's C source code into a free
IDE, but that whole project went down in flames. You can read bits and
pieces of that misadventure at the tail end of the "Python application
launcher (for Python code)" thread. I found sweph's C source code at
some link off "Programming interface to the Swiss Ephemeris" at
http://www.astro.com/swisseph/swephprg.htm (or maybe it was on
http://www.astro.com/swisseph/swephinfo_e.htm - I can't easily find it
now, but the download link is in one of those two pages somewhere.)

Then I tried picking through sweph's C source code, attempting to
manually reproduce the logic and the calculations in Python. That was a
highly qualified semi-success because the times were still off, but it
essentially produces the most basic planetary 

how to convert this container back to format build result?

2017-04-10 Thread Ho Yeung Lee

http://construct.readthedocs.io/en/latest/basics.html

format.build can build the hex string, 
but after edit attribute of the format parse result
it is a container, how to convert this container back to format build result?

#format.parse(format.build(dict(width=3,height=2,pixels=[7,8,9,11,12,13]))).signature
format = Struct(
"signature" / Const(b"a2MP"),
"width" / Int8ub,
"height" / Int8ub,
"pixels" / Array(3 * 2, Byte),
)

#protocolA = {"a1" : "a2"}
#protocolA["a2"] = "a3"
#protocolA["a3"] = "a1"
protocolA = {"a1MP" : 
format.build(dict(width=3,height=2,pixels=[7,8,9,11,12,13]))}

a2MP = 
format.parse(format.build(dict(width=3,height=2,pixels=[7,8,9,11,12,13])))
a2MP.signature = "a3MP"
protocolA["a2MP"] = a2MP.build({})
a1MP = 
format.parse(format.build(dict(width=3,height=2,pixels=[7,8,9,11,12,13])))
a1MP.signature = "a1MP"
protocolA["a3MP"] = format.build(a1MP)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

The API exists in python3.5 and python3.4 as well, it was just provisional.  
Very few things changed between the provisional version and the final version 
in 3.6.

--

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

Changes by R. David Murray :


--
components: +email

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

Changes by R. David Murray :


--
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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

That is true for text/ types, yes.  The policy is named after the target 
wire protocol, and if you are transmitting an email message over SMTP, that 
implies MIME.  What to do if you are not sending it over SMTP, though, is a 
tougher question. One could argue it either way for the 'default' policy, and 
I'm open to argument.

--
versions: +Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



Re: Swiss Ephemeris

2017-04-10 Thread Peter Henry
Hi Deborah,

Thanks your reply and interest,

A few years ago did create a Excel addin, that extracted planetary
coordinates from the Swisseph source code and populated excel spreadsheet
 This Marco addin had customised planetary settings of which was  useful

Currently now learning to program in Python as it  is flexible, popular
 for machine learning and data science. The idea the planetary coordinate
can help with timing stock commodity and Forex markets, as both freely
trading markets and planetary  movement adhere to natural law

Neural networks can also assist in extracting relationship information
between markets and planetary positions.

Whilst waiting for a solution  can you advise of an efficient way of
producing a a CSV file similar to the file attached, only planetary data
required


Many thanks

Peter

On 10 April 2017 at 02:52, Deborah Swanson 
wrote:

> Peter Henry wrote, on Sunday, April 09, 2017 10:53 AM
> >
> > I have a package that has been altered to imported in to
> > python, however I tired to get is working but without success
> > I be missing something obvious
> >
> > The Swiss Ephemeris enable planetary coordinate  to be
> > imported and used in your program
> >
> > Files access https://pypi.python.org/pypi/pyswisseph
> >
> > Many thanks in advance
> >
> > Peter
>
> I've also worked on the problem of getting sweph into Python and have
> mostly struck out so far myself.
>
> I found one reliable means to get sweph's planetary data into Python,
> but it's more or less a cheat. Nonetheless, if you want to see how much
> good it does you, try the Swiss Ephemeris Test Page at
> http://www.astro.com/swisseph/swetest.htm. If you can successfully
> formulate a query useful to your purposes, you can download a csv of
> results, read it into Python, and work from there. Right now I'm working
> on converting some Excel spreadsheets and Excel VBA I use into Python
> and recoding it all, using the CSVs for jumping off points. That works
> pretty well, except the times from swetest are off a bit and I haven't
> figured out why. But I'm concentrating on getting all my VBA code ported
> to Python, and will go back to getting bang on data from sweph after I
> have my code done.
>
> The first thing I tried was to get sweph's C source code into a free
> IDE, but that whole project went down in flames. You can read bits and
> pieces of that misadventure at the tail end of the "Python application
> launcher (for Python code)" thread. I found sweph's C source code at
> some link off "Programming interface to the Swiss Ephemeris" at
> http://www.astro.com/swisseph/swephprg.htm (or maybe it was on
> http://www.astro.com/swisseph/swephinfo_e.htm - I can't easily find it
> now, but the download link is in one of those two pages somewhere.)
>
> Then I tried picking through sweph's C source code, attempting to
> manually reproduce the logic and the calculations in Python. That was a
> highly qualified semi-success because the times were still off, but it
> essentially produces the most basic planetary data. The swetest output
> CSVs were more complete however, and easy to read the planetary data
> into Python from, so I'd pretty much abandoned efforts to "translate"
> the C source code. And now, all my efforts to leverage the C source
> code. Even if successful it would be a lot more time sunk into working
> with a language other than Python, which I likely wouldn't have a use
> for after this project is completed.
>
> However, I have seen bits here and there on this list that are at least
> interesting. Tim Chase mentioned in passing that he encapsulated C
> source code in a class, which may bear looking into. Lutz Horn also gave
> a link for building a Python module to add a C language library to
> Python, which also might be worth checking out:
> https://docs.python.org/3/extending/index.html (I changed the 2 to a 3
> from the link he gave, but you can change it back to 2 if your working
> in a build of Python 2.)
>
> But many thanks for your pypi link to pyswisseph, which I will check
> out. I can reply to this thread after I give it a shot and tell you what
> I think of it. But like I said earlier, that won't be until all my Excel
> VBA code, which jumps off from the sweph bare planetary data, is ported
> to Python and working. Could be awhile yet. And if pyswisseph doesn't
> pan out, I'll likely work on refining the two methods I have for
> producing the planetary data, both of which are only lacking precisely
> accurate time data in my local time, and both are off by only 5-30
> minutes. I easily limped along for years with my Excel spread sheets
> using the swetest CSVs for input, even though my times then were more
> than a day off.
>
> Good luck! (and this venture is a goodly portion of luck...)
>
> Deborah
>
> PS. I've been using medical astrology to look ahead at my medical
> condition for years in advance. And being off by a day or so doesn't
> matter that much when 

[issue29870] ssl socket leak

2017-04-10 Thread Alexander Mohr

Alexander Mohr added the comment:

yes, in the gist I created you can switch between the various clients, by 
default right now it uses raw sockets.

--

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens

Jon Ribbens added the comment:

OK cool, but please note that this is a MIME issue not an SMTP issue - if the 
message has text that is being base64-encoded then it must use CRLF line breaks 
regardless of whether SMTP is involved or not.

--

___
Python tracker 

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



[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread Jon Ribbens

Jon Ribbens added the comment:

Just a note for anyone finding this in searching results: it appears that what 
David means by "python3 API" is actually a new API in Python 3.6 
(email.message.EmailMessage).

--

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I see.  This may mean the leak is in memory that's not managed directly by 
Python (e.g. some OpenSSL structure).

Is there a way to reproduce without third-party libraries such as requests?

--

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

Actually, I think the fix would go in the generator, not in the contentmanager, 
but it's been long enough since I've worked on the code that I'm not sure.

--

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

This appears to be a problem in the new API as well.  I don't think we can 
change the legacy API because its been that way forever and applications might 
be depending on it (that is, the library preserves exactly what it is handed, 
and an application might break if that changes).  In the new API, though, I 
think we could get away with fixing it to do the transformation on text strings 
in the default content manager so that the line endings follow the message 
policy.  (That is, if you use default, you get \n, if you use SMTP, you get 
\r\n).  I think we can get away with it because there aren't that many 
applications using the new API yet.

--
components:  -email

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-10 Thread Alexander Mohr

Alexander Mohr added the comment:

@pitrou: sys.getallocatedblocks does not seem to increase

--

___
Python tracker 

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



[ANN] txkube 0.1.0

2017-04-10 Thread Jean-Paul Calderone
Hello all,

I'm pleased to announce the first release of txkube, a Twisted-based
library for interacting with Kubernetes using the HTTP API.

This release supports several of the most commonly used basic Kubernetes
objects, including Services, ConfigMaps, Deployments, ReplicaSets, and
Pods.  While Kubernetes has many, many more object kinds, this collection
of kinds already supports a very useful set of interactions.

Here is an example of txkube usage, taken from the README:

   from __future__ import print_function
   from twisted.internet.task import react

   from txkube import v1, network_kubernetes_from_context

   @react
   def main(reactor):
   k8s = network_kubernetes_from_context(reactor, u"minikube")
   client = k8s.client()
   d = client.list(v1.Namespace)
   d.addCallback(print)
   return d

You can download txkube from PyPI .
You can contribute to its development on GitHub
.

Thanks to Least Authority Enterprises  for
sponsoring this development.

Jean-Paul Calderone
http://as.ynchrono.us/
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


[issue30031] Improve queens demo (use argparse and singular form)

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

Yeah, I was wondering if part of the demo was to show something that can be 
done with no library support...but that probably isn't the case.

--

___
Python tracker 

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



[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

Yes, this sub-optimal, but it's the way it works in the legacy API, and we 
aren't going to change the legacy (compat32) API at this point.  The new 
policies and the new API in python3 handle this sensibly.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[ANN] txkube 0.1.0

2017-04-10 Thread Jean-Paul Calderone
Hello all,

I'm pleased to announce the first release of txkube, a Twisted-based
library for interacting with Kubernetes using the HTTP API.

This release supports several of the most commonly used basic Kubernetes
objects, including Services, ConfigMaps, Deployments, ReplicaSets, and
Pods.  While Kubernetes has many, many more object kinds, this collection
of kinds already supports a very useful set of interactions.

Here is an example of txkube usage, taken from the README:

   from __future__ import print_function
   from twisted.internet.task import react

   from txkube import v1, network_kubernetes_from_context

   @react
   def main(reactor):
   k8s = network_kubernetes_from_context(reactor, u"minikube")
   client = k8s.client()
   d = client.list(v1.Namespace)
   d.addCallback(print)
   return d

You can download txkube from PyPI .
You can contribute to its development on GitHub
.

Thanks to Least Authority Enterprises  for
sponsoring this development.

Jean-Paul Calderone
http://as.ynchrono.us/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +email
nosy: +barry, r.david.murray

___
Python tracker 

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



Re: Installing Python 3.6.1 on a Windows 10

2017-04-10 Thread eryk sun
On Mon, Apr 10, 2017 at 3:45 PM, Colin J. Williams  wrote:
> Below is the tail of my Install Log.
> Is this a problem that I should be able to resolve?
> Advice sought.

Open a Windows / Installation issue on bugs.python.org. Zip up the
installation logs and attach the zip to the issue.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +email
nosy: +barry, r.david.murray

___
Python tracker 

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



[issue30031] Improve queens demo (use argparse and singular form)

2017-04-10 Thread Eric V. Smith

Eric V. Smith added the comment:

Oops, yes, __init__.

Plenty of the demos use imports. I think it would be clearer with argparse, but 
I also don't feel strongly about it.

--

___
Python tracker 

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



[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is easy to implement this (just replace LOAD_ATTR with IMPORT_FROM in the 
compiler). The hardest part is writing tests.

--
keywords: +easy (C)
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

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



[issue30031] Improve queens demo (use argparse and singular form)

2017-04-10 Thread R. David Murray

R. David Murray added the comment:

I'm not sure about using argparse.  Currently the demo uses no imports.  I'm 
not strongly against, though.

Did you mean __init__ instead of __new__?  Also, its value could be made True 
and False instead of 0 and 1.  (Which tells you how old this demo is.)

--
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



[issue30033] email module base64-encodes utf-8 text

2017-04-10 Thread Jon Ribbens

New submission from Jon Ribbens:

The email module, when creating text parts using character encoding utf-8, 
base64-encodes the output even though this is often inappropriate (e.g. if it 
is a Western language it is almost never appropriate).

>>> from email.mime.text import MIMEText
>>> m = MIMEText("hello", _charset="utf-8")
>>> m.as_string()
'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 
1.0\nContent-Transfer-Encoding: base64\n\naGVsbG8=\n'

--
components: Library (Lib)
messages: 291435
nosy: jribbens
priority: normal
severity: normal
status: open
title: email module base64-encodes utf-8 text
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue30032] email module creates base64 output with incorrect line breaks

2017-04-10 Thread Jon Ribbens

New submission from Jon Ribbens:

The email module, when creating base64-encoded text parts, does not process 
line breaks correctly - RFC 2045 s6.8 says that line breaks must be converted 
to CRLF before base64-encoding, and the email module is not doing this.

>>> from email.mime.text import MIMEText
>>> import base64
>>> m = MIMEText("hello\nthere", _charset="utf-8")
>>> m.as_string()
'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 
1.0\nContent-Transfer-Encoding: base64\n\naGVsbG8KdGhlcmU=\n'
>>> base64.b64decode("aGVsbG8KdGhlcmU=")
b'hello\nthere'

You might say that it is the application's job to convert the line endings 
before calling MIMEText(), but I think all application authors would be 
surprised by this. Certainly the MailMan authors would be, as they say this is 
a Python bug not a MailMan bug ;-)

--
components: Library (Lib)
messages: 291434
nosy: jribbens
priority: normal
severity: normal
status: open
title: email module creates base64 output with incorrect line breaks
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue29521] Minor warning messages when compiling documentation

2017-04-10 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset e0cba5b45a5c4bafd1ae772be52ca0d69651da24 by Mariatta in branch 
'2.7':
[2.7] bpo-29521: Fix two minor documentation build warnings (GH-41) (GH-670)
https://github.com/python/cpython/commit/e0cba5b45a5c4bafd1ae772be52ca0d69651da24


--

___
Python tracker 

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



Re: Need help with getting Key, Value out of dicts in lists

2017-04-10 Thread John Ralph
There are a number of ways to reorganise the data for the exclusive use of your 
script without affecting the original data.  Is there a reason you can't or not 
allowed to do this?

Regardless, here's some code that might make things a little easier.  It 
operates on each balancer on the fly, reduces the number of for loops, and 
eliminates worries about where the tags are placed within the list.

from operator import itemgetter

alist = \
[
[
{u'Value': 'shibboleth-prd', u'Key': 'Name'},
{u'Value': 'kvmu', u'Key': 'Billing'},
{u'Value': '20179204-181622543367489', u'Key': 'Resource_group_id'}
],
[
{u'Value': '20172857-152037106154311', u'Key': 'Resource_group_id'},
{u'Value': 'shibboleth-tst', u'Key': 'Name'}
]
]

# Problem:
# for all resource group id tags that equal '20172857-152037106154311':
#   print its name tag (eg, "shibboleth-prd-alb")

# create a container (dict) of tags for each balancer on the fly
for balancer in alist:
tags = dict(map(itemgetter('Key', 'Value'), balancer))
print 'group of tags:', tags
if itemgetter('Resource_group_id')(tags) == '20172857-152037106154311':
print '\tfound resource, resource name:', itemgetter('Name')(tags)

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


[issue30031] Improve queens demo (use argparse and singular form)

2017-04-10 Thread Eric V. Smith

Eric V. Smith added the comment:

I think these are reasonable improvements. Also, move the initialization of 
"silent" in to __new__.

--
keywords: +easy
nosy: +eric.smith

___
Python tracker 

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



[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-10 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-10 Thread Guido van Rossum

Guido van Rossum added the comment:

OK I won't close it but I'm withdrawing from the issue. If there are devs who 
want to implement this or mentor some contributor into implementing it feel 
free, but it sounds like Nick doesn't think it's important enough to fix (i.e. 
not worth his time) and I feel the same.

--

___
Python tracker 

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



[issue29881] Add a new private API clear private variables, which are initialized once, at Python shutdown

2017-04-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can you move forward this issue Victor? I'm very interesting in it. It is worth 
to advertise this API on Python-Dev.

_PyArg_Parser also can utilize this API.

--

___
Python tracker 

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



Re: using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-10 Thread iMath
On Tuesday, April 11, 2017 at 12:00:27 AM UTC+8, iMath wrote:
> > Are you sure you posted the code you are actually using? Because the 
> > error message suggests a difference.
> > 
> I am sure !
> 
> As I have tested: If I pass the IP address of my web server to the host 
> parameter of HTTPHandler, the server side would show http 400 and Invalid 
> HTTP_HOST header message  ,

Besides the http 400 and Invalid HTTP_HOST header message , there are also 
exceptions , pasted here https://bpaste.net/show/f2d2e64e7a7e
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30030] Simplify _RandomNameSequence

2017-04-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The downside of this change:

1. The _RandomNameSequence iterator no longer has the rng field. But it isn't 
used in the stdlib. And since _RandomNameSequence is a private name, it 
shouldn't be used in third-party code.

2. The result of no longer copyable neither pickleable. This could cause a 
problem if it is set as an attribute of copyable of pickleable object. But it 
is used only as function local or module global instances in tempfile and class 
attribute of in multiprocessing.synchronize.SemLock and 
multiprocessing.heap.Arena. All these cases don't involved in copying or 
pickling. And in general copying and pickling the _RandomNameSequence object is 
a doubtful idea.

3. This makes iterating the _RandomNameSequence iterator slightly (about 6%) 
slower. Not a big deal, it isn't used in performance critical code. It is 
possible to speed up the _RandomNameSequence iterator by the same 6% by using 
functools.partial (functools already is imported in tempfile), but this makes 
the code slightly less clear, and I choose the simplicity of the code.

--

___
Python tracker 

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



Re: using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-10 Thread iMath
On Tuesday, April 11, 2017 at 12:00:27 AM UTC+8, iMath wrote:
> > Are you sure you posted the code you are actually using? Because the 
> > error message suggests a difference.
> > 
> I am sure !
> 
> As I have tested: If I pass the IP address of my web server to the host 
> parameter of HTTPHandler, the server side would show http 400 and Invalid 
> HTTP_HOST header message , 
>  

Besides the http 400 and Invalid HTTP_HOST header message , there are also 
following exceptions 


Invalid HTTP_HOST header: '112.74.98.187:8001,112.74.98.187'. The domain name 
pr 
ovided is not valid according to RFC 1034/1035.
[10/Apr/2017 15:38:04] "GET 
/VideoParser/lYYDownloaderClientLog/?funcName=%3Cmod
 
ule%3E=26=ERROR=__main___info=None=%28%29
 
e=a=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRec
 
v%5Ca.py=6636=6972=1491838715.9931207=993.120670318
 
6035=testing+remote+logging_info=None=64.00370597839355&
 
filename=a.py=MainThread=MainProcess=40_text=
 
None HTTP/1.1" 400 66752
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in 
finish_respo
 nse
self.write(data)
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
  File "/usr/local/lib/python3.6/socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
[10/Apr/2017 15:38:04] "GET 
/VideoParser/lYYDownloaderClientLog/?funcName=%3Cmod
 
ule%3E=26=ERROR=__main___info=None=%28%29
 
e=a=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRec
 
v%5Ca.py=6636=6972=1491838715.9931207=993.120670318
 
6035=testing+remote+logging_info=None=64.00370597839355&
 
filename=a.py=MainThread=MainProcess=40_text=
 
None HTTP/1.1" 500 59

Exception happened during processing of request from ('117.136.84.223', 49862)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 138, in run
self.finish_response()
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in 
finish_respo
 nse
self.write(data)
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 279, in write
self._write(data)
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
  File "/usr/local/lib/python3.6/socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 141, in run
self.handle_error()
  File 
"/usr/local/lib/python3.6/site-packages/django/core/servers/basehttp.py",   
   line 95, 
in handle_error
super(ServerHandler, self).handle_error()
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 180, in 
finish_respo
 nse
self.write(data)
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 274, in write
self.send_headers()
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 344, in 
client_is_mo
 dern
return 

Re: using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-10 Thread iMath

> Are you sure you posted the code you are actually using? Because the 
> error message suggests a difference.
> 
I am sure !

As I have tested: If I pass the IP address of my web server to the host 
parameter of HTTPHandler, the server side would show http 400 and Invalid 
HTTP_HOST header message  , while if I pass the domain name instead, then the 
view function works as expected . 
 
would it be a bug within HTTPHandler?
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing Python 3.6.1 on a Windows 10

2017-04-10 Thread Colin J. Williams
   Below is the tail of my Install Log.

   Is this a problem that I should be able to resolve?

   Advice sought.

   C

   Property(S): RedirectedDllSupport = 2
   Property(S): MsiRunningElevated = 1
   Property(S): Privileged = 1
   Property(S): USERNAME = AdminOnly
   Property(S): Installed = 00:00:00
   Property(S): DATABASE = C:\WINDOWS\Installer\3cb4905.msi
   Property(S): OriginalDatabase = C:\WINDOWS\Installer\3cb4905.msi
   Property(S): UILevel = 2
   Property(S): MsiUISourceResOnly = 1
   Property(S): Preselected = 1
   Property(S): ACTION = INSTALL
   Property(S): ROOTDRIVE = E:\
   Property(S): CostingComplete = 1
   Property(S): OutOfDiskSpace = 0
   Property(S): OutOfNoRbDiskSpace = 0
   Property(S): PrimaryVolumeSpaceAvailable = 0
   Property(S): PrimaryVolumeSpaceRequired = 0
   Property(S): PrimaryVolumeSpaceRemaining = 0
   Property(S): INSTALLLEVEL = 1
   MSI (s) (2C:60) [09:00:59:536]: Note: 1: 1724
   MSI (s) (2C:60) [09:00:59:536]: Note: 1: 2205 2:  3: Error
   MSI (s) (2C:60) [09:00:59:536]: Note: 1: 2228 2:  3: Error 4: SELECT
   `Message` FROM `Error` WHERE `Error` = 1724
   MSI (s) (2C:60) [09:00:59:536]: Note: 1: 2205 2:  3: Error
   MSI (s) (2C:60) [09:00:59:536]: Note: 1: 2228 2:  3: Error 4: SELECT
   `Message` FROM `Error` WHERE `Error` = 1709
   MSI (s) (2C:60) [09:00:59:536]: Product: Python 3.6.1 Core Interpreter
   (64-bit symbols) -- Removal completed successfully.

   MSI (s) (2C:60) [09:00:59:536]: Windows Installer removed the product.
   Product Name: Python 3.6.1 Core Interpreter (64-bit symbols). Product
   Version: 3.6.1150.0. Product Language: 1033. Manufacturer: Python Software
   Foundation. Removal success or error status: 0.

   MSI (s) (2C:60) [09:00:59:536]: Deferring clean up of packages/files, if
   any exist
   MSI (s) (2C:60) [09:00:59:536]: MainEngineThread is returning 0
   MSI (s) (2C:DC) [09:00:59:536]: RESTART MANAGER: Session closed.
   MSI (s) (2C:DC) [09:00:59:536]: No System Restore sequence number for this
   installation.
   === Logging stopped: 2017-04-10  9:00:59 ===
   MSI (s) (2C:DC) [09:00:59:551]: User policy value 'DisableRollback' is 0
   MSI (s) (2C:DC) [09:00:59:551]: Machine policy value 'DisableRollback' is
   0
   MSI (s) (2C:DC) [09:00:59:551]: Incrementing counter to disable shutdown.
   Counter after increment: 0
   MSI (s) (2C:DC) [09:00:59:551]: Note: 1: 1402 2:
   
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts
   3: 2
   MSI (s) (2C:DC) [09:00:59:551]: Note: 1: 2265 2:  3: -2147287035
   MSI (s) (2C:DC) [09:00:59:551]: Note: 1: 1402 2:
   
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts
   3: 2
   MSI (s) (2C:DC) [09:00:59:551]: Decrementing counter to disable shutdown.
   If counter >= 0, shutdown will be denied.  Counter after decrement: -1
   MSI (s) (2C:DC) [09:00:59:551]: Post-install cleanup: removing installer
   file 'C:\WINDOWS\Installer\3cb4905.msi'
   MSI (c) (C8:98) [09:00:59:551]: Decrementing counter to disable shutdown.
   If counter >= 0, shutdown will be denied.  Counter after decrement: -1
   MSI (c) (C8:98) [09:00:59:551]: MainEngineThread is returning 0
   === Verbose logging stopped: 2017-04-10  9:00:59 ===
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2017: Financial Aid is now open

2017-04-10 Thread Alexander Hendorf
As part of our commitment to the Python community, 
we are pleased to announce that we offer special grants for people in need 
of a financial aid to attend EuroPython.

Financial aid is sponsored in part by Python Software Foundation (PSF)

We offer financial aid conference grants in these 3 categories:
- Free and discounted ticket: get a standard ticket for the conference for free 
  (including access to talks, trainings, sprints, etc.)
- Travel costs:  we will cover the travel costs pro rata, 
  depending on what you are applying for.
- Accommodation: we can partially cover the accommodation costs

Grant Eligibility
Our grants are open to all people in need of financial aid. We will 
specifically take into account the following criteria in the selection process:
- Contributors: potential speakers/trainers of EuroPython (people who submitted 
a proposal) 
  and all who contribute to EuroPython and/or Python community projects.
- Economic factors: we want everybody to have a chance to come to EuroPython, 
  regardless of economic situation or income level.
- Diversity: we seek the most diverse and inclusive event possible.

How to Apply
You can apply for financial aid by filling the form on the EuroPython 2017 
Finance Aid web
https://ep2017.europython.eu/en/registration/financial-aid/
If you have any questions, please read the FAQ or send an e-mail to 
fin...@europython.eu 

Timeline
April 10th (2017-04-10) - open the finance aid grant opportunity
April 24th (2017-04-24) - the deadline for submitting the applications 
April 30th (2017-04-30) - applicants will be notified by e-mail 
May 6th (2017-05-06) - deadline for applicants to accept the grant
May 14th (2017-05-14) - applicants will receive confirmation notification

Refund management
Free ticket: the individual coupons will be generated for a free ticket.
Accommodation and Travel grant:  all grants involving reimbursements will be 
reimbursed by 
PayPal or bank transfer. Please send us your receipts (hotel invoice, 
plane/bus/train ticket) before the conference to approval.

Become a special Diversity sponsor!
You or your company can support our finaid initiative by becoming a sponsor.
We have a special events “Financial aid sponsor” and “Financial aid donation” 
in the list of sponsor options, that can be booked separately or be included in 
the sponsor package.
Check the sponsor brochure for more information and contact 
fin...@europython.eu or the sponsor work group directly 
sponsor...@europython.eu.
Bring a new sponsor and get a free ticket for EuroPython 2017!

Enjoy,

EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/

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

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


EuroPython 2017: Tickets are now available

2017-04-10 Thread Alexander Hendorf
You can now buy regular tickets 
for Europe’s largest Python conference.

After the early bird tickets sold out in just eight hours,
standard rate tickets are now available:

Student: EUR 130.- incl. VAT 
(only available for students and postdocs; please bring your student card)

Personal: EUR 375.- incl. VAT 
(for people enjoying Python from home)

Business: EUR 555.- excl. VAT / 677.10 incl. VAT 
(for people using Python to make a living)

Tickets can be purchased via the EuroPython website.
https://ep2017.europython.eu/en/registration/buy-tickets/

Please help us spreading the news by forwarding this mail 
or re-tweeting, thanks!
https://twitter.com/europython/status/850368483061846018


Enjoy,

EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/


PS: please remember to submit your proposals for the conference. 
https://ep2017.europython.eu/en/call-for-proposals/
There are only a few days left for submission. 
The deadline is (Easter) Sunday, April 16th.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


Grako 3.20.0 released

2017-04-10 Thread Juancarlo Añez
Added

   -

   Added grako.compile(grammar, name=None, **kwargs) as a substitute for
   grako.genmodel (which remains for backwards compatibility).
   -

   Added a grako.parse(grammar, input, **kwargs) that will compile a
   grammar and uset to parse the given input. For efficiency, parsed grammars
   are cached.
   -

   Added a grako.to_python_sourcecode(grammar, name=None, filename=None,
   **kwargs) that compiles the grammar to the Python sourcecode that
   implements the parser.
   -

   Rename the existing *join* (.{}) expression to *gather*, and use *join* for
   a new expression (%{}) that keeps the separator in the resulting AST.
   -

   Added left-join (<{}) and right-join (>{}) expressions to the grammar.

Changed

   -

   Enable python setup.py test with pytest.
   -

   Remove the deprecated prefix= argument to ParseContext.closure().
   -

   Document that *Grako* may be used as a library (with no code generation)
   by compiling grammars to Grammar objects that can be used to parse any
   given input, much like Python's re does with regular expressions.
   -

   Refactored grammar so double naming (name1:name2:exp) is disallowed.

Grako 3.20.0 

*Grako* (for *grammar compiler*) is a tool that takes grammars in a
variation of EBNF as input, and outputs memoizing (Packrat) PEG parsers
in Python.

*Grako* can also compile a grammar stored in a string into a
grako.grammars.Grammar object that can be used to parse any given input,
much like the *re* module does with regular expressions.
https://pypi.python.org/pypi/grako/3.20.0

https://bitbucket.org/neogeny/grako/

-- 
Juancarlo *Añez*
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Pound sign problem

2017-04-10 Thread Lew Pitcher
David Shi wrote:

> In the data set, pound sign escape appears:
> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000',
> When using table.to_csv after importing pandas as pd, an error message
> persists as follows: UnicodeEncodeError: 'ascii' codec can't encode
> character u'\xa3' in position 0: ordinal not in range(128)

There is no "pound sign" in ASCII[1]. Try changing your target encoding to 
something other than ASCII.

[1]: See http://std.dkuug.dk/i18n/charmaps/ascii for a list of valid ASCII 
values.

-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request


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


Re: Python and the need for speed

2017-04-10 Thread William Ray Wing

> On Apr 10, 2017, at 8:25 AM, Mikhail V  wrote:
> 
> On 10 April 2017 at 02:21, Gregory Ewing  wrote:
>> 
>> 
>> 
>> My take on the idea of making Python less dynamic in order
>> to improve speed is that you'll end up with a language that,
>> while it may superficially resemble Python, doesn't
>> really feel like Python.
>> 
>> Boo is an example of that. It has a Python-like syntax, but
>> to get any speed advantage you need to add static type
>> delarations, and then it feels more like programming in
>> C# than Python. At that point, you wonder whether you might
>> just be better off writing your program in C# to begin with.
>> 
>> That's not to say this kind of approach isn't worth pursuing,
>> but like the JIT attempts mentioned in the article, it has
>> also been tried before, with varying levels of success.
> 
> Agree. python is python and I suppose that performance issues
> has much to do with types and OOP.
> When I first started with python I thought - no, it is not possible
> without types, if I'll write something more complicated than
> hello world, it will all break at some point.
> But hell, this works and works good.
> 
> Still I miss some old school features in Python, e.g. "goto" statement would
> be very useful in some cases. I know it is considered bad style
> to use goto, but in some cases it is just most natural thing to use.
> 
> What I am (and probably many people) missing is a good tool for
> performance middle- and low-level applications.
> For me it would be a coding tool, sort of minimalist IDE, with simple
> readable syntax which generates compilable C code.
> And it would not be necessarily python-like syntax,
> but I tend to agree that for today python's syntax is
> most readable.

Have you considered Swift, now that it is open source?

Bill

> 
> The problem that many are overlooking still is that the
> possibilities for syntaxes are very limited in pure text-mode
> presentation.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Pillow ImportError: No module named Image

2017-04-10 Thread Jon Ribbens
On 2017-04-10, jorge.conr...@cptec.inpe.br  wrote:
> I installed the Pillow in my computer. The I did:
>
> import Image, ImageMath
>
> ImportError: No module named Image

Try:

from PIL import Image, ImageMath
-- 
https://mail.python.org/mailman/listinfo/python-list


Pillow ImportError: No module named Image

2017-04-10 Thread jorge . conrado

Hi,

I installed the Pillow in my computer. The I did:

import Image, ImageMath

ImportError: No module named Image

Please, what can I do to solve this.

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


Re: Python 3.6 printing crashing on OS X 10.12.4

2017-04-10 Thread Ray Cote
On Wed, Apr 5, 2017 at 3:40 PM, Python  wrote:

> Le 05/04/2017 à 20:14, Ray Cote a écrit :
>
>> Hello:
>>
>> Python 3.6 crashing when trying to print from the environment.
>>
>> $ python
>> Python 3.6.1 (default, Mar 22 2017, 15:53:21)
>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>> print("hello")
>

>> Python(53390,0x7fffdd9e63c0) malloc: *** error for object 0x10dde4110:
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>> Abort trap: 6
>>
>>
>> Pastebin link to OS X crash report if that’s helpful:
>> https://pastebin.com/t1j3nz5L
>>
>>
>> 1: Python installed via ports.
>> 2: OS X 10.12.4.
>> 3: Python 3.6.1 (though I also had this problem with 3.6.0).
>> 4: Have successfully run python 3.5 for months.
>> 5: Running under standard terminal program.
>> 6: I have py36-readline installed.
>> 7: Have tried uninstalling and re-installing Python.
>>
>> Any thoughts on what I could have wrong?
>>
>> Regards
>> —Ray
>>
>>
> Mac OS X 10.12.3, Python 3 installed by brew
>
> mac:~$ uname -r
> 16.4.0
> mac:~$ python3
> Python 3.6.0 (default, Mar  4 2017, 12:32:34)
> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print("hello")
> hello
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


Follow up:

Never did find out why the macports Python was crashing.
Switched over to brew and it is working fine.
—R
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pound sign problem

2017-04-10 Thread Peter Otten
David Shi via Python-list wrote:

> In the data set, pound sign escape appears:
> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000',
> When using table.to_csv after importing pandas as pd, an error message
> persists as follows: UnicodeEncodeError: 'ascii' codec can't encode
> character u'\xa3' in position 0: ordinal not in range(128)

The default encoding in Python 2 is ascii, and the pound sign is not part of 
that.

> Can anyone help?

Specify an alternative encoding, preferably UTF-8:

>>> import pandas
>>> df = pandas.DataFrame([[u"\xa3123"], [u"\xa3321"]], columns=["Price"])
>>> df
  Price
0  £123
1  £321

[2 rows x 1 columns]
>>> df.to_csv("tmp.csv", encoding="utf-8")
>>> 
$ cat tmp.csv
,Price
0,£123
1,£321
$ 


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


Re: Pound sign problem

2017-04-10 Thread Ben Finney
David Shi via Python-list  writes:

> When using table.to_csv after importing pandas as pd

I don't know much about that library. What does its documentation say
for the ‘table.to_csv’ function?

Can you write a *very short* complete example, that we can run to
demonstrate the same behaviour you are seeing?

> an error message persists as follows:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 
> 0: ordinal not in range(128)

This means the function has been told (or is assuming, in the absence of
better information) that the input data is in the ‘ascii’ text encoding.

That assumption turns out to be incorrect, for the actual data you have.
So that error occurs.

You will need to:

* Find out exactly what text encoding was used to write the file. Don't
  guess, because there are many ways to be wrong.

* Specify that encoding to the ‘table.to_csv’ function, or to whatever
  function opens the file. (This might be the Python built-in ‘open’
  function, but we'd need to see your short example to know.)

-- 
 \“Most people, I think, don't even know what a rootkit is, so |
  `\ why should they care about it?” —Thomas Hesse, Sony BMG, 2006 |
_o__)  |
Ben Finney

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


[ANN] txAWS 0.3.0

2017-04-10 Thread Jean-Paul Calderone
Hello all,

I'm pleased to announce the release of txAWS 0.3.0.  txAWS is a library for
interacting with
Amazon Web Services (AWS) using Twisted.

You can download the release from PyPI 
 (https://pypi.python.org/pypi/txAWS).

txAWS development uses GitHub for issues and source control
 (https://github.com/twisted/txaws).

Since the last release, the following enhancements have been made:

   - Jean-Paul Calderone added basic Route53 support.
   - Mark Williams add Auth v4, now used by the S3 and Route53 support.
   - Francisco Souza added support for VPCs to some EC2 APIs.
   - Drew Smathers added multi-part S3 upload support.
   - Several people added other S3 client features such as pagination and
   streaming uploads.
   - *txaws.testing* now provides S3 and Route53 support.

Additionally, the following APIs have been deprecated:

   - The *client* attribute of *txaws.client.base.BaseQuery*
   - The *date* attribute of *txaws.s3.client.Query*

Thanks to everyone who contributed and to Least Authority Enterprises
 () for
sponsoring my work on this release.

Jean-Paul Calderone
-- 
https://mail.python.org/mailman/listinfo/python-list


Pound sign problem

2017-04-10 Thread David Shi via Python-list
In the data set, pound sign escape appears:
u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000',
When using table.to_csv after importing pandas as pd, an error message persists 
as follows:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: 
ordinal not in range(128)

Can anyone help?
Regards.
David
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30031] Improve queens demo (use argparse and singular form)

2017-04-10 Thread Pavlo Kapyshin

New submission from Pavlo Kapyshin:

Currently Tools/demo/queens.py:

 - does manual sys.argv parsing
 - says “Found 1 solutions”

I propose to: 1) use argparse; 2) if q.nfound == 1, use “solution”. I you are 
ok with this, I’ll make a pull request.

--
components: Demos and Tools
messages: 291428
nosy: paka
priority: normal
severity: normal
status: open
title: Improve queens demo (use argparse and singular form)
type: enhancement
versions: Python 3.7

___
Python tracker 

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



Re: Python and the need for speed

2017-04-10 Thread breamoreboy
On Monday, April 10, 2017 at 1:25:48 PM UTC+1, Mikhail V wrote:
> 
> Still I miss some old school features in Python, e.g. "goto" statement would
> be very useful in some cases. I know it is considered bad style
> to use goto, but in some cases it is just most natural thing to use.
> 

http://entrian.com/goto/
https://pypi.python.org/pypi/goto-statement

Kindest regards.

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


Re: Python and the need for speed

2017-04-10 Thread Mikhail V
On 10 April 2017 at 02:21, Gregory Ewing  wrote:
>
> 
>
> My take on the idea of making Python less dynamic in order
> to improve speed is that you'll end up with a language that,
> while it may superficially resemble Python, doesn't
> really feel like Python.
>
> Boo is an example of that. It has a Python-like syntax, but
> to get any speed advantage you need to add static type
> delarations, and then it feels more like programming in
> C# than Python. At that point, you wonder whether you might
> just be better off writing your program in C# to begin with.
>
> That's not to say this kind of approach isn't worth pursuing,
> but like the JIT attempts mentioned in the article, it has
> also been tried before, with varying levels of success.

Agree. python is python and I suppose that performance issues
has much to do with types and OOP.
When I first started with python I thought - no, it is not possible
without types, if I'll write something more complicated than
hello world, it will all break at some point.
But hell, this works and works good.

Still I miss some old school features in Python, e.g. "goto" statement would
be very useful in some cases. I know it is considered bad style
to use goto, but in some cases it is just most natural thing to use.

What I am (and probably many people) missing is a good tool for
performance middle- and low-level applications.
For me it would be a coding tool, sort of minimalist IDE, with simple
readable syntax which generates compilable C code.
And it would not be necessarily python-like syntax,
but I tend to agree that for today python's syntax is
most readable.

The problem that many are overlooking still is that the
possibilities for syntaxes are very limited in pure text-mode
presentation.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29870] ssl socket leak

2017-04-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Can you record sys.getallocatedblocks() to see whether it grows continuously?

--
nosy: +pitrou

___
Python tracker 

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



RE: Swiss Ephemeris

2017-04-10 Thread Adriaan Renting

There are at least two other packages with Python bindings that allow
ephimerides calculations.

1) PyEphem http://rhodesmill.org/pyephem/
2) Pyraphttp://www.astron.nl/casacore/trunk/pyrap/docs/ (This needs a
very big casacore c++ library and thus a pain to compile, but can give
second level accuracy if you use updated IERS tables).

As to the ancient's (Greek/Roman) nature philosophy. We still use some
of it today, especially in the fields of mathematics, mechanics and
observational astronomy, but their understanding of biology and
especially the human body was entirely incorrect.

Western/Islamic medicine largely followed Hippocrates for nearly 2000
years (although the ideas are originally from Indian Ayurveda) and some
of the methods had some merit, but overall the treatments were often
worse than the disease, for example George Washinton was almost
certainly killed by his doctors.
Only with the application of the scientific method to medicine after
the enlightenment have we started to make any real progress. The most
important of which is blind trials in which a treatment needs to show to
be better than a placebo.

One of the most important things that modern medicine has shown is that
a placebo can have a real effect and cure people. Some people do get
better after you give them a sugar pill or its equivalent.
As humans we're also very good at seeing correlation and causation when
none might exist. Matt Parker has a very entertaining talk about this
here https://www.youtube.com/watch?v=sf5OrthVRPA

Cheers,

Adriaan Renting

P.S. I had an uncle who died of cancer 2 years ago who was a firm
believer in all kinds of non-mainstream cures and tried all kinds of
alternative cures from accupuncture to yoga to Gc-MAF. In the end the
only results I saw were that these people got many 10.000s euros from
him and he died very disillusioned and poor as these were not covered by
his health insurance. I learned a lot about magazines like "What doctors
don't tell you" - which use the images of people in white labcoats to
sell you things that doctors don't tell you about because they are known
to be ineffective or even bad for you. I understand that a lot of people
have a problem with authority and/or look for alternatives if mainstream
medicine can't help them. And sometimes the methods seem to work and
those are the stories you hear, as the other people end up like my
uncle, who's not here any more to tell his story. Don't end up like my
uncle.

 >>>
> Fully recognizing that most of what you wrote was tongue-in-cheek, I
> just want to say that regardless of the wonders of modern medicine,
it's
> a pity they learn so little about successful medicines other than
their
> own. In other academic scientific disciplines such as physics and
> chemistry it's not uncommon to see history of science courses in the
> curriculum. But not in medicine. I learned what I know about ancient
> Greek science from a university physics professor, though I doubt he
> would ever have guessed that one of his students would someday
breathe
> new life into that ancient science by attempting to ressurrect it.
The
> great ancients were no less endowed with intelligence than we are,
they
> simply directed it to different ends.
> 
> 
> Rick Johnson wrote, on Sunday, April 09, 2017 9:00 PM
>> 
>> On Sunday, April 9, 2017 at 8:52:44 PM UTC-5, Deborah Swanson
wrote:
>> > PS. I've been using medical astrology to look ahead at my medical

>> > condition for years in advance. And being off by a day or 
>> so doesn't 
>> > matter that much when you're looking at trends over the course of

>> > years and decades. I also have a little software widget to 
>> look at the 
>> > planetary data in graphical chart form at any particular 
>> second, also 
>> > based on sweph, which has been quite astoundingly accurate in
>> > following the rather complex kaleidoscope of my symptoms
>> > during the course of a day. (Though it doesn't do you a bit
>> > of good if you forget to look! Which is my entire
>> > motivation to get it encoded and available with a few
>> > clicks.) And it is quite useful to know in advance what
>> > will be happening when, and most importantly when it will
>> > stop. Knowledge is power!
>> 
>> It's simply amazing what technology can do these days. And
>> with medical diagnosis now just a few clicks away, someone 
>> really should tell those medical students to stop wasting 
>> time and money at university.
>> 
>> > Caveat. This kind of precision and accuracy is only found
>> > in the specific forms of astrology which relate to pure physical 
>> > phenomena, and most of what you see these days masquerading as 
>> > astrology is pure hooey, almost entirely invented on a 
>> large scale in 
>> > the Middle Ages and flowered in the Renaissance.
>> 
>> Whadda coinicidence, as did alchemy!
>> 
>> > By pure physical phenomena, which is the only phenomena
>> > that is at least debatably influenced by physical planetary 
>> forces, I 
>> > mean 

Re: Python and the need for speed

2017-04-10 Thread bartc

On 10/04/2017 03:40, Rick Johnson wrote:

On Sunday, April 9, 2017 at 1:34:39 PM UTC-5, bartc wrote:



I have my own interpreted language which I call 'dynamic',
but compared with Python, code in it might as well be set
in concrete.


Is this a personal toy, or something that you can share a
link to?


It's a personal thing but not a toy. Some more info here:

https://github.com/bartg/langs/tree/master/qlang

Click on the 'Q Features' link, this includes a selection of built-in 
features that have been easily and efficiently implemented 
(enumerations, records etc) which Python seems to have trouble with.


(And it can't have simple enumerations such that cat=1, dog=2, but needs 
to have every conceivable embellishment. In other words it doesn't know 
how to keep things simple.)


(To actually run this, there still appears to be a file 'pcc.c' at the 
top level of that github project. This is an old C version of the 
interpreter (yes, just one file) and it seemed to work when I tried it 
just now. You need a 32-bit C compiler. I had to remove a binary version 
(for Windows) when someone said github doesn't allow binaries.)



For all the hype about GvR's "supposed" time machine, we can
see that Python has suffered some major design flaws. And
since Python3000, feature creep has been churning into
overdrive.


Yes. I suppose when it gets to a point where there are so many features 
anyway, adding a few more makes little difference!


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


[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> os.getlogin document says `Availability: Unix, Windows.`

Originally this meant "not in Mac OS, DOS, OS/2, VMS". But now the support of 
all these platforms is dropped and the note is outdated.

--

___
Python tracker 

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



[issue30030] Simplify _RandomNameSequence

2017-04-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1219

___
Python tracker 

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



[issue30030] Simplify _RandomNameSequence

2017-04-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

_RandomNameSequence was added in issue589982 when generator functions were new 
optional feature. _RandomNameSequence is implemented as an iterator class. 
Proposed patch simplifies _RandomNameSequence by implementing it as a generator 
function.

This is a private name, all uses of _RandomNameSequence() need only the support 
of the iterator protocol.

--
components: Library (Lib)
messages: 291425
nosy: haypo, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Simplify _RandomNameSequence
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29870] ssl socket leak

2017-04-10 Thread Michael Sghaier

Changes by Michael Sghaier :


--
pull_requests: +1218

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread INADA Naoki

INADA Naoki added the comment:

> Oh. If os.getpid() is not always available, the documentation should be 
> updated.

Yes, but CloudABI is not officially supported platform.
They have many patches to run Python on CloudABI. 
https://github.com/NuxiNL/cloudabi-ports/tree/master/packages/python

How can we document about it?  I hadn't used it.

os.getlogin document says `Availability: Unix, Windows.` [1]
Is it proper way to indicate "there may be some minor platforms which doesn't 
provide this."?
[1] https://docs.python.org/3.6/library/os.html#os.getlogin

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread STINNER Victor

STINNER Victor added the comment:

Naoki:
> #28156 added HAVE_GETPID check.
> Maybe, we should have dummy getpid() for CloudABI?

Oh. If os.getpid() is not always available, the documentation should be updated.

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread INADA Naoki

INADA Naoki added the comment:

#28156 added HAVE_GETPID check.
Maybe, we should have dummy getpid() for CloudABI?

--
nosy: +inada.naoki

___
Python tracker 

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



Re: Improve Python + Influxdb import performance

2017-04-10 Thread Prathamesh
Hi

I've installed Jython 2.7 and was able to get weblogic running as a Jython 2.7 
module following
https://technology.amis.nl/2015/10/04/how-to-use-wlst-as-a-jython-2-7-module/

I got the requests module 2.7 installed as well

But am facing an issue when invoking it
related to SSL certificates
and to stop those errors I think you need utillib2/utillib3
and that has dependencies
one of which is cryptography - which is a real pain to install

Any pointers on this
or easier way to install this?
I'm running Windows 2008R2

Also my pip install doesn't work
I get geteid error

Please let me know

Thanks
P

On Tuesday, April 4, 2017 at 6:51:28 PM UTC+5:30, Prathamesh wrote:
> Hi Inada
> 
> Thank you for your response
> Weblogic works on Jython 2.2.1
> and I think the Python requests module requires >= python 2.6
> 
> Please correct me if I'm wrong
> or if there is another way to get this to work
> 
> Thanks
> P
> 
> On Monday, April 3, 2017 at 9:52:38 PM UTC+5:30, INADA Naoki wrote:
> > You can reuse connection, instead of creating for each request. (HTTP
> > keep-alive).
> > 
> > On Tue, Apr 4, 2017 at 1:11 AM, Prathamesh  
> > wrote:
> > > Hello World
> > >
> > > The following script is an extract from
> > >
> > > https://github.com/RittmanMead/obi-metrics-agent/blob/master/obi-metrics-agent.py
> > >
> > > <>
> > >
> > > import calendar, time
> > > import sys
> > > import getopt
> > >
> > > print '---'
> > >
> > > # Check the arguments to this script are as expected.
> > > # argv[0] is script name.
> > > argLen = len(sys.argv)
> > > if argLen -1 < 2:
> > > print "ERROR: got ", argLen -1, " args, must be at least two."
> > > print '$FMW_HOME/oracle_common/common/bin/wlst.sh 
> > > obi-metrics-agent.py
> > > [] [] [] [ > > port>] [targetDB influx db>'
> > > exit()
> > >
> > > outputFormat='CSV'
> > > url='t3://localhost:7001'
> > > targetHost='localhost'
> > > targetDB='obi'
> > > targetPort='8086'
> > >
> > > try:
> > > wls_user = sys.argv[1]
> > > wls_pw = sys.argv[2]
> > > url  = sys.argv[3]
> > > outputFormat=sys.argv[4]
> > > targetHost=sys.argv[5]
> > > targetPort=sys.argv[6]
> > > targetDB=sys.argv[7]
> > > except:
> > > print ''
> > >
> > > print wls_user, wls_pw,url, outputFormat,targetHost,targetPort,targetDB
> > >
> > > now_epoch = calendar.timegm(time.gmtime())*1000
> > >
> > > if outputFormat=='InfluxDB':
> > > import httplib
> > > influx_msgs=''
> > >
> > > connect(wls_user,wls_pw,url)
> > > results = displayMetricTables('Oracle_BI*','dms_cProcessInfo')
> > > for table in results:
> > > tableName = table.get('Table')
> > > rows = table.get('Rows')
> > > rowCollection = rows.values()
> > > iter = rowCollection.iterator()
> > > while iter.hasNext():
> > > row = iter.next()
> > > rowType = row.getCompositeType()
> > > keys = rowType.keySet()
> > > keyIter = keys.iterator()
> > > inst_name= row.get('Name').replace(' ','-')
> > > try:
> > > server= row.get('Servername').replace(' 
> > > ','-').replace('/','_')
> > > except:
> > > try:
> > > server= row.get('ServerName').replace(' 
> > > ','-').replace('/','_')
> > > except:
> > > server='unknown'
> > > try:
> > > host= row.get('Host').replace(' ','-')
> > > except:
> > > host=''
> > > while keyIter.hasNext():
> > > columnName = keyIter.next()
> > > value = row.get(columnName )
> > > if columnName.find('.value')>0:
> > > metric_name=columnName.replace('.value','')
> > > if value is not None:
> > > if value != 0:
> > > if outputFormat=='InfluxDB':
> > > influx_msg= 
> > > ('%s,server=%s,host=%s,metric_group=%s,metric_instance=%s value=%s %s') % 
> > > (metric_name,server,host,tableName,inst_name,  value,now_epoch*100)
> > > influx_msgs+='\n%s' % influx_msg
> > > conn = httplib.HTTPConnection('%s:%s' % 
> > > (targetHost,targetPort))
> > > ## TODO pretty sure should be urlencoding 
> > > this ...
> > > a=conn.request("POST", ("/write?db=%s" % 
> > > targetDB), influx_msg)
> > > r=conn.getresponse()
> > >
> > > <>
> > >
> > > It currently takes about 3 minutes to execute completely and I was 
> > > thinking of a way to make it run faster
> > >
> > > Data alignment (Influx line protocol) & data loading - done together 
> > > takes up most of the time
> > >
> > > Influxdb is currently loading data at around 3 points/second
> > >
> > > Any way to align the data separately, store it and load it as a batch?
> > >
> > > I feel that would help improve 

[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2017-04-10 Thread Segev Finer

Segev Finer added the comment:

It's been a while since this got any attention...

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread STINNER Victor

STINNER Victor added the comment:

I proposed PR 1074 to remove the hasattr(os, 'getpid') from logging.LogRecord 
constructor.

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1217

___
Python tracker 

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



[issue29694] race condition in pathlib mkdir with flags parents=True

2017-04-10 Thread Armin Rigo

Armin Rigo added the comment:

Maybe we should review pathlib.py for this kind of issues and first apply the 
fixes and new tests inside PyPy.  That sounds like a better way to get things 
done for these rare issues, where CPython is understandably reluctant to do 
much changes.

Note that the PyPy version of the stdlib already contains fixes that have not 
been merged back to CPython (or only very slowly), though so far they are the 
kind of issues that trigger more often on PyPy than on CPython, like GC issues.

--

___
Python tracker 

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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> not a bug

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Then LGTM.

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread Anselm Kruis

Anselm Kruis added the comment:

I had the same concerns about os.getpid(), but test.support uses it 
unconditionally in various places. See 
https://github.com/python/cpython/blob/master/Lib/test/support/__init__.py#L803 
for an example.

--

___
Python tracker 

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



[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, this problem only arises with import cycles, and that's why we resisted 
making eager submodule resolution work *at all* for so long (issue 992389 was 
filed way back in 2004).

We only conceded the point (with issue 17636 being implemented for 3.5) 
specifically to address a barrier to adoption for explicit relative imports, as 
it turned out that "from . import bar" could fail in cases where "import 
foo.bar" previously worked.

The best explanation I could find for that rationale in the related python-dev 
thread is PJE's post here: 
https://mail.python.org/pipermail/python-dev/2013-April/125121.html

What Victor's python-ideas thread pointed out is that there are actually *3* 
flavours of import where this particular circular reference problem can come up:

# Has worked as long as Python has had packages,
# as long as you only lazily resolve foo.bar in
# function and method implementations
import foo.bar

# Has worked since 3.5 due to the IMPORT_FROM
# change that falls back to a sys.modules lookup
from foo import bar

# Still gives AttributeError since it
# eagerly resolves the attribute lookup
import foo.bar as bar

While I think the architectural case for allowing this kind of circular 
dependency between different top level namespaces is *much* weaker than that 
for allowing it within packages, I do think there's a reasonable consistency 
argument to be made in favour of ensuring that `from foo import bar` and 
`import foo.bar as bar` are functionally equivalent when `bar` is a submodule 
of `foo`, especially since the latter form makes it clearer to the reader that 
`bar` *is* a submodule, rather than any arbitrary attribute.

I don't think it's a big problem in practice (so I wouldn't spend any time on 
implementing it myself), but the notion of an IMPORT_ATTR opcode for the 
"import x.y.z as m" case that parallels IMPORT_FROM seems architecturally clean 
to me in a way that the proposed resolutions to issue 992389 weren't.

--

___
Python tracker 

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



[issue30028] make test.support.temp_cwd() fork-safe

2017-04-10 Thread Christian Heimes

Christian Heimes added the comment:

The line is from 2006. Some parts of the logging module are much older, maybe 
even from the time Python had DOS support.

--
nosy: +christian.heimes

___
Python tracker 

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



RE: Swiss Ephemeris

2017-04-10 Thread Deborah Swanson
Fully recognizing that most of what you wrote was tongue-in-cheek, I
just want to say that regardless of the wonders of modern medicine, it's
a pity they learn so little about successful medicines other than their
own. In other academic scientific disciplines such as physics and
chemistry it's not uncommon to see history of science courses in the
curriculum. But not in medicine. I learned what I know about ancient
Greek science from a university physics professor, though I doubt he
would ever have guessed that one of his students would someday breathe
new life into that ancient science by attempting to ressurrect it. The
great ancients were no less endowed with intelligence than we are, they
simply directed it to different ends.


Rick Johnson wrote, on Sunday, April 09, 2017 9:00 PM
> 
> On Sunday, April 9, 2017 at 8:52:44 PM UTC-5, Deborah Swanson wrote:
> > PS. I've been using medical astrology to look ahead at my medical 
> > condition for years in advance. And being off by a day or 
> so doesn't 
> > matter that much when you're looking at trends over the course of 
> > years and decades. I also have a little software widget to 
> look at the 
> > planetary data in graphical chart form at any particular 
> second, also 
> > based on sweph, which has been quite astoundingly accurate in
> > following the rather complex kaleidoscope of my symptoms
> > during the course of a day. (Though it doesn't do you a bit
> > of good if you forget to look! Which is my entire
> > motivation to get it encoded and available with a few
> > clicks.) And it is quite useful to know in advance what
> > will be happening when, and most importantly when it will
> > stop. Knowledge is power!
> 
> It's simply amazing what technology can do these days. And
> with medical diagnosis now just a few clicks away, someone 
> really should tell those medical students to stop wasting 
> time and money at university.
> 
> > Caveat. This kind of precision and accuracy is only found
> > in the specific forms of astrology which relate to pure physical 
> > phenomena, and most of what you see these days masquerading as 
> > astrology is pure hooey, almost entirely invented on a 
> large scale in 
> > the Middle Ages and flowered in the Renaissance.
> 
> Whadda coinicidence, as did alchemy!
> 
> > By pure physical phenomena, which is the only phenomena
> > that is at least debatably influenced by physical planetary 
> forces, I 
> > mean things like the moon's tides, sunspots, plant and 
> animal activity 
> > throughout the year, and supremely, the inner workings of the human 
> > body, the first wholly Western medicine devised by the 
> ancient Greeks. 
> > (The ancient Greek physicians are an excellent fallback if
> > modern medicine is failing you - if you can find enough
> > that remains today of their art.)
> 
> Yeah, just uh, be sure to avoid te hemlock, mmmkay? ;-)
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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