ANN: bcolz 0.7.1 released

2014-07-30 Thread Francesc Alted

bcolz: columnar and compressed data containers
==

bcolz provides columnar, chunked data containers that can be
compressed either in-memory and on-disk.  Column storage allows for
efficiently querying tables, as well as for cheap column addition and
removal.  It is based on `NumPy http://www.numpy.org`_, and uses it
as the standard data container to communicate with bcolz objects, but
it also comes with support for import/export facilities to/from
`HDF5/PyTables tables http://www.pytables.org`_ and `pandas
dataframes http://pandas.pydata.org`_.

bcolz objects are compressed by default not only for reducing
memory/disk storage, but also to improve I/O speed.  The compression
process is carried out internally by `Blosc http://blosc.org`_, a
high-performance, multithreaded meta-compressor that is optimized for
binary data (although it works with text data just fine too).

bcolz can also use `numexpr https://github.com/pydata/numexpr`_
internally (it does that by default if it detects numexpr installed)
so as to accelerate many vector and query operations (although it can
use pure NumPy for doing so too).  numexpr can optimize the memory
usage and use multithreading for doing the computations, so it is
blazing fast.  This, in combination with carray/ctable disk-based,
compressed containers, can be used for performing out-of-core
computations efficiently, but most importantly *transparently*.

Just to wet your appetite, here it is an example with real data, where
bcolz is already fullfilling the promise of accelerating memory I/O by
using compression:

http://nbviewer.ipython.org/github/Blosc/movielens-bench/blob/master/querying-ep14.ipynb


Rational


By using compression, you can deal with more data using the same
amount of memory, which is very good on itself.  But in case you are
wondering about the price to pay in terms of performance, you should
know that nowadays memory access is the most common bottleneck in many
computational scenarios, and that CPUs spend most of its time waiting
for data.  Hence, having data compressed in memory can reduce the
stress of the memory subsystem as well.

Furthermore, columnar means that the tabular datasets are stored
column-wise order, and this turns out to offer better opportunities to
improve compression ratio.  This is because data tends to expose more
similarity in elements that sit in the same column rather than those
in the same row, so compressors generally do a much better job when
data is aligned in such column-wise order.

So, the ultimate goal for bcolz is not only reducing the memory needs
of large arrays/tables, but also making bcolz operations to go faster
than using a traditional ndarray object from NumPy.  That is already
the case in some real-life scenarios (see the notebook above) but that
will become pretty more noticeable in combination with forthcoming,
faster CPUs integrating more cores and wider vector units.

Requisites
--

- Python = 2.6
- NumPy = 1.7
- Cython = 0.20 (just for compiling the beast)
- Blosc = 1.3.0 (optional, as the internal Blosc will be used by default)
- unittest2 (optional, only in the case you are running Python 2.6)

Building


Assuming that you have the requisites and a C compiler installed, do::

  $ pip install -U bcolz

or, if you have unpacked the tarball locally::

  $ python setup.py build_ext --inplace

In case you have Blosc installed as an external library you can link
with it (disregarding the included Blosc sources) in a couple of ways:

Using an environment variable::

  $ BLOSC_DIR=/usr/local (or set BLOSC_DIR=\blosc on Win)
  $ export BLOSC_DIR (not needed on Win)
  $ python setup.py build_ext --inplace

Using a flag::

  $ python setup.py build_ext --inplace --blosc=/usr/local

Testing
---

After compiling, you can quickly check that the package is sane by
running::

  $ PYTHONPATH=.   (or set PYTHONPATH=. on Windows)
  $ export PYTHONPATH(not needed on Windows)
  $ python -cimport bcolz; bcolz.test()  # add `heavy=True` if desired

Installing
--

Install it as a typical Python package::

  $ python setup.py install

Documentation
-

You can find the online manual at:

http://bcolz.blosc.org

but of course, you can always access docstrings from the console
(i.e. help(bcolz.ctable)).

Also, you may want to look at the bench/ directory for some examples
of use.

Resources
-

Visit the main bcolz site repository at:
http://github.com/Blosc/bcolz

Home of Blosc compressor:
http://blosc.org

User's mail list:
http://groups.google.com/group/bcolz (bc...@googlegroups.com)

An `introductory talk (20 min)
https://www.youtube.com/watch?v=-lKV4zC1gss`_ about bcolz at
EuroPython 2014.  `Slides here
http://blosc.org/docs/bcolz-EuroPython-2014.pdf`_.

License
---

Please see BCOLZ.txt in LICENSES/ directory.

Share your experience
-

Let us know of any bugs, suggestions, gripes, 

xlwings v0.2.0 adds native support for Excel on Mac!

2014-07-30 Thread Felix Zumstein
I am happy to announce the release of xlwings v0.2.0, adding native support for 
Excel on Mac.

xlwings is a BSD-licensed Python library that makes it easy to call Python from 
Excel and vice versa: http://xlwings.org

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

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


Getting a list of all modules

2014-07-30 Thread Steven D'Aprano
I'm looking for a programmatic way to get a list of all Python modules 
and packages. Not just those already imported, but all those which 
*could* be imported.

I have a quick-and-dirty function which half does the job:


def get_modules():
extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')
matches = set()
for location in sys.path:
if location == '': location = '.'
if os.path.isdir(location):
for name in os.listdir(location):
base, ext = os.path.splitext(name)
if ext in extensions:
matches.add(base)
return sorted(matches)



but I know it's wrong (it doesn't handle packages correctly, or zip 
files, doesn't follow .pth files, has a very naive understanding of cross-
platform issues, fails to include built-in modules that don't live in the 
file system, and probably more).

Is this problem already solved? Can anyone make any suggestions?



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


Re: Load a CSV with different row lengths

2014-07-30 Thread Peter Otten
Miki Tebeka wrote:

 Greetings,
 
 I should've mentioned that I want to import my csv as a data frame or
 numpy array or as a table.
 If you know the max length of a row, then you can do something like:
 def gen_rows(stream, max_length):
 for row in csv.reader(stream):
 yield row + ([None] * (max_length - len(line))
 
 max_length = 10
 with open('data.csv') as fo:
 df = pd.DataFrame.from_records(gen_rows(fo, max_length))

With the help of the search engine that must not be named and some trial and 
error I also found a way to use pandas.read_csv():

$ cat data.csv
a,b
a,b,c,d
a,b,c
$ python3
Python 3.3.2+ (default, Feb 28 2014, 00:52:16) 
[GCC 4.8.1] on linux
Type help, copyright, credits or license for more information.
 import pandas
 pandas.read_csv(data.csv, names=list(range(4)))
   0  123
0  a  b  NaN  NaN
1  a  bcd
2  a  bc  NaN

And if the maximum row length is not known here's a modification of Miki's 
recipe:

def gen_rows(stream, max_length=None):
  rows = csv.reader(stream)
  if max_length is None:
  rows = list(rows)
  max_length = max(len(row) for row in rows)
  for row in rows:
  yield row + [None] * (max_length - len(row))

with open('data.csv') as f:
df = pd.DataFrame.from_records(list(gen_rows(f))) # my version of pandas
  # does not accept a
  # generator


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


Re: Getting a list of all modules

2014-07-30 Thread Chris Angelico
On Wed, Jul 30, 2014 at 5:43 PM, Steven D'Aprano st...@pearwood.info wrote:
 Is this problem already solved? Can anyone make any suggestions?

I don't know of an actual solution, but I know where I'd look for one,
and that's importlib. If nothing else, you can use
importlib.machinery.all_suffixes() rather than hard-coding them, for
instance.

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


Re: Getting a list of all modules

2014-07-30 Thread Peter Otten
Steven D'Aprano wrote:

 I'm looking for a programmatic way to get a list of all Python modules
 and packages. Not just those already imported, but all those which
 *could* be imported.
 
 I have a quick-and-dirty function which half does the job:
 
 
 def get_modules():
 extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')
 matches = set()
 for location in sys.path:
 if location == '': location = '.'
 if os.path.isdir(location):
 for name in os.listdir(location):
 base, ext = os.path.splitext(name)
 if ext in extensions:
 matches.add(base)
 return sorted(matches)
 
 
 
 but I know it's wrong (it doesn't handle packages correctly, or zip
 files, doesn't follow .pth files, has a very naive understanding of cross-
 platform issues, fails to include built-in modules that don't live in the
 file system, and probably more).
 
 Is this problem already solved? Can anyone make any suggestions?

$ python3 -m pydoc -b

shows a page with modules that I think is more complete than what you have. 
A quick glance at the implementation suggests that the hard work is done by 

pkgutil.iter_modules()

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


Re: Getting a list of all modules

2014-07-30 Thread Robert Kern

On 2014-07-30 09:46, Peter Otten wrote:

Steven D'Aprano wrote:


I'm looking for a programmatic way to get a list of all Python modules
and packages. Not just those already imported, but all those which
*could* be imported.

I have a quick-and-dirty function which half does the job:


def get_modules():
 extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')
 matches = set()
 for location in sys.path:
 if location == '': location = '.'
 if os.path.isdir(location):
 for name in os.listdir(location):
 base, ext = os.path.splitext(name)
 if ext in extensions:
 matches.add(base)
 return sorted(matches)



but I know it's wrong (it doesn't handle packages correctly, or zip
files, doesn't follow .pth files, has a very naive understanding of cross-
platform issues, fails to include built-in modules that don't live in the
file system, and probably more).

Is this problem already solved? Can anyone make any suggestions?


$ python3 -m pydoc -b

shows a page with modules that I think is more complete than what you have.
A quick glance at the implementation suggests that the hard work is done by

pkgutil.iter_modules()


There are two niggles to this answer: it omits builtin modules, but those are 
easily discovered through sys.builtin_module_names. It can also include spurious 
script .py files that cannot be imported because their names are not Python 
identifiers: e.g. check-newconfigs.py. Those are easy to filter out, fortunately.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: one to many (passing variables)

2014-07-30 Thread Antoon Pardon
On 28-07-14 21:29, Terry Reedy wrote:

 On 7/25/2014 9:47 PM, C.D. Reimer wrote:
 On 7/24/2014 2:58 AM, Ben Finney wrote:
 Here is an article on good API design; the principles apply to Python
 URL:http://blog.isnotworking.com/2007/05/api-design-guidelines.html.
 You know your API and its requirements better than we; see whether that
 sheds any light on improvements to make.
 Thank you for the link. I'm curious about one item mentioned in the
 article: Avoid return values that Demand Exceptional Processing: return
 zero-length array or empty collection, not null
 Isn't a zero-length array, empty collection and null all the same thing?
 No. [] is an empty list, None is a null.
 Or does the Demand Exceptional Processing comes from testing to see if
 the object is empty versus being null?
 Testing whether null or not.
 And does this apply to Python?
 Yes. If a function always returns a iterable, sometimes empty, it can be 
 used as follows:
 for item in f(): process(item)
 If the iterable is empty, nothing happens.  If the function returns None 
 instead of empty, then the use has to write the following to get the 
 same result.

Taking this in consideration I think the io.RawIOBase.read got it backwards.

The documentation says the following:

| If 0 bytes are returned, and size was not 0, this indicates end of file.
| If the object is in non-blocking mode and no bytes are available, None is 
returned.

But typically if you are reading in non-blocking mode, no bytes availabe can be
treated as if you receive an empty (byte)string. While reaching the end of the
stream is different. So it would have been more consistent if an empty 
(byte)string
was return in case of no bytes availabe and None or io.EOF or something like 
that
in case of end of file.

Now I have to write things as follows:

for block in iter(partial(RawStream.read, 1024), ''):
if block is not None:
for b in block
process(b)

Otherwise I could write it more as follows:

for block in iter(partial(RawStream.read, 1024), io.EOF):
for b in block
process(b)

-- 
Antoon Pardon

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


Re: one to many (passing variables)

2014-07-30 Thread Peter Otten
Antoon Pardon wrote:

 Taking this in consideration I think the io.RawIOBase.read got it
 backwards.
 
 The documentation says the following:
 
 | If 0 bytes are returned, and size was not 0, this indicates end of file.
 | If the object is in non-blocking mode and no bytes are available, None
 | is returned.
 
 But typically if you are reading in non-blocking mode, no bytes availabe
 can be treated as if you receive an empty (byte)string. While reaching the
 end of the stream is different. So it would have been more consistent if
 an empty (byte)string was return in case of no bytes availabe and None or
 io.EOF or something like that in case of end of file.
 
 Now I have to write things as follows:
 
 for block in iter(partial(RawStream.read, 1024), ''):
 if block is not None:
 for b in block
 process(b)

or

for block in ...:
for b in block or ():
process(b)

 Otherwise I could write it more as follows:
 
 for block in iter(partial(RawStream.read, 1024), io.EOF):
 for b in block
 process(b)
 


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


Unable to find ssh library supporting python 3.1

2014-07-30 Thread Chirag Dhyani
Hi,

Could you suggest me ssh library supporting python 3.1, to a surprise I
checked pramiko, fabric, etc etc and no one does. even workaround with
plumbum but not helpful. We have a project entirely on python 3.1 and now
we are stuck with ssh.

Please help

Thank you
~Chi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: one to many (passing variables)

2014-07-30 Thread Antoon Pardon
On 30-07-14 13:37, Peter Otten wrote:

 Antoon Pardon wrote:

 Taking this in consideration I think the io.RawIOBase.read got it
 backwards.

 The documentation says the following:

 | If 0 bytes are returned, and size was not 0, this indicates end of file.
 | If the object is in non-blocking mode and no bytes are available, None
 | is returned.

 But typically if you are reading in non-blocking mode, no bytes availabe
 can be treated as if you receive an empty (byte)string. While reaching the
 end of the stream is different. So it would have been more consistent if
 an empty (byte)string was return in case of no bytes availabe and None or
 io.EOF or something like that in case of end of file.

 Now I have to write things as follows:

 for block in iter(partial(RawStream.read, 1024), ''):
 if block is not None:
 for b in block
 process(b)
 or

 for block in ...:
 for b in block or ():
 process(b)

No it obscures what is going on and is prone to problems if you have more code
that expects block to be a (byte)string. I think this is better:

for block in ...:
block = block or ''
for b in block:
process(b)
do_other_stuff_with(block) 

It is not that big a deal but you can't escape testing for an exceptional
value, whether you do it with an if or with an or. A test that wouldn't
be needed if they had done it the other way around. IMO they stayed too
close to how things are done in C. 

 Otherwise I could write it more as follows:

 for block in iter(partial(RawStream.read, 1024), io.EOF):
 for b in block
 process(b)
  
-- 
https://mail.python.org/mailman/listinfo/python-list


How to loop through nodes of xml through xslt

2014-07-30 Thread varun bhatnagar
Hi,

I have two xml files.

*File1.xml*

*?xml version=1.0 encoding=UTF-8?*
*InfoTag*
*Procedure attrProc=TestProcA attrLevel=1*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*

* Procedure attrProc=TestProcB attrLevel=2*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
*/InfoTag*


*File2.xml*

*?xml version=1.0 encoding=UTF-8?*
*InfoTag*
*Procedure attrProc=TestProcC attrLevel=3*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*

* Procedure attrProc=TestProcD attrLevel=4*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
*/InfoTag*


I am trying to fetch an output file which looks like this:

*Output.xml*

*InfoTag*
*Procedure attrProc=1 attrLevel=### NOT UNIQUE ###*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
* Procedure attrProc=2 attrLevel=### NOT UNIQUE ###*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
*Procedure attrProc=3 attrLevel=### NOT UNIQUE ###*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
* Procedure attrProc=4 attrLevel=### NOT UNIQUE ###*
*  downTime*
*acceptableDownTime*
*  all/*
*/acceptableDownTime*
*downTimePeriod time=6/*
*  /downTime*
*/Procedure*
*/InfoTag*

The number of Procedure tag (Procedure) can be different every time. So I
have to read this tag every time from each xml and then merge it
sequentially.
Can anyone tell me how to achieve this. How can I loop every Procedure tag
and and append the attrProc attribute value in a sequential order?

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


Re: Unable to find ssh library supporting python 3.1

2014-07-30 Thread Chris “Kwpolska” Warrick
On Wed, Jul 30, 2014 at 1:49 PM, Chirag Dhyani chiragdhy...@gmail.com wrote:
 Hi,

 Could you suggest me ssh library supporting python 3.1, to a surprise I
 checked pramiko, fabric, etc etc and no one does. even workaround with
 plumbum but not helpful. We have a project entirely on python 3.1 and now we
 are stuck with ssh.

 Please help

 Thank you
 ~Chi

Python 3.1.0 celebrated its fifth birthday on Sunday.  You should not
be using software that old.  There is no real reason to do so,
especially because modern versions of the 3.x series are generally
backwards compatible with each other.

Instead, upgrade to the most recent version, 3.4.1, which is happily
supported by Paramiko.  Many Python 3-compatible libraries
dropped/never had support for 3.0—3.2 due to
http://legacy.python.org/dev/peps/pep-0414/, which makes porting
between Python 2 and 3 much easier.

-- 
Chris “Kwpolska” Warrick http://chriswarrick.com/
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a list of all modules

2014-07-30 Thread Leo Jay
On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote:
 I'm looking for a programmatic way to get a list of all Python modules
 and packages. Not just those already imported, but all those which
 *could* be imported.


If you don't actually import it, how can you know it could be imported?
Not all .so files are valid python modules.
Not all .py files could be imported by all python interpreters.

 I have a quick-and-dirty function which half does the job:


 def get_modules():
 extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')
 matches = set()
 for location in sys.path:
 if location == '': location = '.'
 if os.path.isdir(location):
 for name in os.listdir(location):
 base, ext = os.path.splitext(name)
 if ext in extensions:
 matches.add(base)
 return sorted(matches)



 but I know it's wrong (it doesn't handle packages correctly, or zip
 files, doesn't follow .pth files, has a very naive understanding of cross-
 platform issues, fails to include built-in modules that don't live in the
 file system, and probably more).

 Is this problem already solved? Can anyone make any suggestions?



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



-- 
Best Regards,
Leo Jay
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a list of all modules

2014-07-30 Thread Chris Angelico
On Wed, Jul 30, 2014 at 11:22 PM, Leo Jay python.leo...@gmail.com wrote:
 On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote:
 I'm looking for a programmatic way to get a list of all Python modules
 and packages. Not just those already imported, but all those which
 *could* be imported.


 If you don't actually import it, how can you know it could be imported?
 Not all .so files are valid python modules.
 Not all .py files could be imported by all python interpreters.

What if you define it as modules you could attempt to import? Sure,
any module might fail during importing, but you've still taken a
statement of import spam and turned it into an attempt to read some
specific file from the disk.

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


Convert Python 3 ResourceWarnings into exception

2014-07-30 Thread Piotr Dobrogost
Hi!

Recently A. Jesse Jiryu Davis asked at Stackoverflow
(http://stackoverflow.com/q/24717027/95735) if there is a way to force a
Python 3 unittest to fail, rather than simply print a warning to stderr, if
it causes any ResourceWarning? Daniel Harding, in the accepted answer,
states it's not possible.

Is it really the case?

For sake of context, here I believe is the place, where
PyErr_WriteUnraisable is being called in this case –
http://hg.python.org/cpython/annotate/c0e311e010fc/Modules/socketmodule.c#l3857


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


Re: Getting a list of all modules

2014-07-30 Thread Ian Kelly
On Jul 30, 2014 4:37 AM, Robert Kern robert.k...@gmail.com wrote:

 On 2014-07-30 09:46, Peter Otten wrote:

 Steven D'Aprano wrote:

 I'm looking for a programmatic way to get a list of all Python modules
 and packages. Not just those already imported, but all those which
 *could* be imported.

 I have a quick-and-dirty function which half does the job:


 def get_modules():
  extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')
  matches = set()
  for location in sys.path:
  if location == '': location = '.'
  if os.path.isdir(location):
  for name in os.listdir(location):
  base, ext = os.path.splitext(name)
  if ext in extensions:
  matches.add(base)
  return sorted(matches)



 but I know it's wrong (it doesn't handle packages correctly, or zip
 files, doesn't follow .pth files, has a very naive understanding of
cross-
 platform issues, fails to include built-in modules that don't live in
the
 file system, and probably more).

 Is this problem already solved? Can anyone make any suggestions?


 $ python3 -m pydoc -b

 shows a page with modules that I think is more complete than what you
have.
 A quick glance at the implementation suggests that the hard work is done
by

 pkgutil.iter_modules()


 There are two niggles to this answer: it omits builtin modules, but those
are easily discovered through sys.builtin_module_names. It can also include
spurious script .py files that cannot be imported because their names are
not Python identifiers: e.g. check-newconfigs.py. Those are easy to filter
out, fortunately.

It will also omit any modules provided by a custom module finder that
doesn't implement iter_modules, which is not a required part of the
interface.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a list of all modules

2014-07-30 Thread Skip Montanaro
On Wed, Jul 30, 2014 at 2:43 AM, Steven D'Aprano st...@pearwood.info
wrote:

 I'm looking for a programmatic way to get a list of all Python modules
 and packages. Not just those already imported, but all those which
 *could* be imported.


I wrote a modified dir(), which I inject into builtins in interactive
sessions. When getting a directory of an object, it attempts to identify
not-yet-imported modules it contains. Such modules are enclosed in square
brackets. Modules that smell like packages also get a trailing '/'. For
example:

% python
Python 2.7.5+ (2.7:2921f6c2009e, Apr 30 2014, 14:00:13)
[GCC 4.4.6 [TWW]] on linux2
Type help, copyright, credits or license for more information.
 import dateutil
 dir(dateutil)
['[easter]', '[parser]', '[relativedelta]', '[rrule]', '[tz]', '[tzwin]',
'[zoneinfo/]', '__author__', '__builtins__', '__doc__', '__file__',
'__license__', '__name__', '__package__', '__path__', '__version__']


It's not perfect, but works for my needs. Perhaps it will give you some
ideas.

Skip
import os
_dir = dir

def dir(o=globals(), hidden=False):
if not hidden and hasattr(o, __all__):
contents = o.__all__
else:
contents = _dir(o)
if hasattr(o, __file__):
dname = os.path.dirname(o.__file__)
# look for not-yet-imported modules within packages
if /__init__.py in o.__file__:
try:
stuff = os.listdir(dname)
except OSError:
# Searching eggs lands here.  Introspect.
import zipfile
d = os.path.dirname(dname)
if not zipfile.is_zipfile(d):
return sorted(contents)
base = os.path.basename(dname)
stuff = [f[len(base)+1:]
 for f in zipfile.ZipFile(d).namelist()
 if f.startswith(base)]
for p in stuff:
m = os.path.splitext(p)[0]
if (
# not already known
m not in contents and
# isn't a package file
p != __init__.py and
# is a python or ...
(p.endswith(.py) or
 # c module or ...
 p.endswith(.so) or
 # a subpackage
 (os.path.isdir(os.path.join(dname, p)) and
  os.path.exists(os.path.join(dname, p, __init__.py):
if os.path.isdir(os.path.join(dname, p)):
# tack on trailing / to distinguish packages from
# modules
m += /
if not m.startswith(_) or hidden:
# [...] shows it hasn't been imported yet
contents.append([%s] % m)
return sorted(contents)
-- 
https://mail.python.org/mailman/listinfo/python-list


Elektra 0.8.7 improved Python support

2014-07-30 Thread Markus Raab
Hello list,

Elektra provides a universal and secure framework to store configuration 
parameters in a global, hierarchical key database. The core is a small 
library implemented in C. The plugin-based framework fulfills many 
configuration-related tasks to avoid any unnecessary code duplication across 
applications while it still allows the core to stay without any external 
dependency. Elektra abstracts from cross-platform-related issues with an 
consistent API, and allows applications to be aware of other applications' 
configurations, leveraging easy application integration.
http://www.libelektra.org

While the core is in C, both applications and soon plugins can be written in 
python. The API is complete and fully functional but not yet stable. So if 
you have any suggestions, please let us know.

Additionally the latest release added:
- python2 next to python3 bindings + lots of improvements there
- ini plugin
- 3 way merge
- tab completion
- for more details see:
http://sourceforge.net/p/registry/mailman/message/32655639/

You can download the release at:
 http://www.markus-raab.org/ftp/elektra/releases/elektra-0.8.7.tar.gz
 size: 1566800
 md5sum: 4996df62942791373b192c793d912b4c

Make sure to enable BUILD_SWIG and BUILD_SWIG_PYTHON2 or BUILD_SWIG_PYTHON3.

Docu (C/C++) can be found here:
 http://doc.libelektra.org/api/0.8.7/html/

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


Re: Convert Python 3 ResourceWarnings into exception

2014-07-30 Thread Terry Reedy

On 7/30/2014 9:24 AM, Piotr Dobrogost wrote:

Hi!

Recently A. Jesse Jiryu Davis asked at Stackoverflow
(http://stackoverflow.com/q/24717027/95735) if there is a way to force a
Python 3 unittest to fail, rather than simply print a warning to stderr, if
it causes any ResourceWarning? Daniel Harding, in the accepted answer,
states it's not possible.

Is it really the case?

For sake of context, here I believe is the place, where
PyErr_WriteUnraisable is being called in this case –
http://hg.python.org/cpython/annotate/c0e311e010fc/Modules/socketmodule.c#l3857


python -W error ...
Raise an exception instead of printing a warning message.

You can also turn this on with the warnings module. Assuming that this 
works for ResourceWarning, which is should, please correct the SO record.


--
Terry Jan Reedy


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


What is best way to learn Python for advanced developer?

2014-07-30 Thread guirec . corbel
Hello,

I am a Ruby developer and I want to program in Python. I know how to do simple 
things like create classes, methods, variables and all the basics. I want to 
know more. I want to know what is the Python philosophy, how to test, how to 
create maintenable software, etc.

I'm looking for online courses and any ressources I can have on the subject.

Can you help me?

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


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread MRAB

On 2014-07-30 21:20, guirec.cor...@gmail.com wrote:

Hello,

I am a Ruby developer and I want to program in Python. I know how to
do simple things like create classes, methods, variables and all the
basics. I want to know more. I want to know what is the Python
philosophy, how to test, how to create maintenable software, etc.


If you want to know the philosophy, type:

import this

at the Python prompt.

It'll give you The Zen of Python.


I'm looking for online courses and any ressources I can have on the
subject.


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


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread guirec . corbel
That's cool but not very exhaustive. Do you more sources?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread Ethan Furman

On 07/30/2014 01:20 PM, guirec.cor...@gmail.com wrote:


I'm looking for online courses and any ressources I can have on the subject.


Udacity [1] has some free computer courses, a few of which use Python as the 
language -- what I have seen so far is decent.

O'Reilly [2] has four very good Python courses, which are not free.

--
~Ethan~

[1] https://www.udacity.com
[2] http://www.oreillyschool.com/search/?search=Python
--
https://mail.python.org/mailman/listinfo/python-list


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread Mark Lawrence

On 30/07/2014 21:47, guirec.cor...@gmail.com wrote:

That's cool but not very exhaustive. Do you more sources?



Ever heard of search engines, they're very good.  Can't really say much 
else when you don't provide any context in your message.


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

Mark Lawrence

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


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread Emile van Sebille

On 7/30/2014 1:47 PM, guirec.cor...@gmail.com wrote:

That's cool but not very exhaustive. Do you more sources?


I'd normally suggest reviewing the standard library after getting 
comfortable with the basics -- see https://docs.python.org/2/library/


But, if you've already done that and want to learn even more, start 
responding to queries posted here and you'll find out in a hurry how 
deep your knowledge is.   :)


Emile


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


Re: Python 3 is killing Python

2014-07-30 Thread Rustom Mody
On Wednesday, July 16, 2014 4:16:45 PM UTC+5:30, Marko Rauhamaa wrote:

 In unix and linux, there never was a separate text mode for files. When
 you open a file, you open a file -- and stuff bytes in it. There is no
 commonly accepted text file encoding. UTF-8 comes close to being a
 standard, but I know somebody who sticks to an ISO-8859-1 locale.

Here's the Solaris docs:

| The C locale, also known as the POSIX locale, is the POSIX system
| default locale for all POSIX-compliant systems. The Oracle Solaris
| operating system is a POSIX system. The Single UNIX Specification,
| Version 3, defines the C locale. You can register at
| http://www.unix.org/version3/online.html to read and download the
| specification.
|
| http://docs.oracle.com/cd/E23824_01/html/E26033/glmbx.html#glmar

Layman version:

ASCII - also known as the Unix locale - is the default for all *nix
compliant systems.

expanded further at 
http://blog.languager.org/2014/04/unicode-and-unix-assumption.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread guirec . corbel
I will look for all your ressources. Did someone tried this : 
http://pluralsight.com/training/Courses/Find?highlight=truesearchTerm=python ?
-- 
https://mail.python.org/mailman/listinfo/python-list


speed up pandas calculation

2014-07-30 Thread Vincent Davis
I know this is a general python list and I am asking about pandas but this
question is probably not great for asking on stackoverflow.
I have a list of files (~80 files, ~30,000 rows) I need to process with my
current code it is take minutes for each file. Any suggestions of a fast
way. I am try to stick with pandas for educational purposes. Any
suggestions would be great. If you are curious the can find the data file I
am using below here. http://www.nber.org/nhamcs/data/nhamcsopd2010.csv

drugs_current = {'CITALOPRAM': 4332,
 'ESCITALOPRAM': 4812,
 'FLUOXETINE': 236,
 'FLUVOXAMINE': 3804,
 'PAROXETINE': 3157,
 'SERTRALINE': 880,
 'METHYLPHENIDATE': 900,
 'DEXMETHYLPHENIDATE': 4777,
 'AMPHETAMINE-DEXTROAMPHETAMINE': 4035,
 'DEXTROAMPHETAMINE': 804,
 'LISDEXAMFETAMINE': 6663,
 'METHAMPHETAMINE': 805,
 'ATOMOXETINE': 4827,
 'CLONIDINE': 44,
 'GUANFACINE': 717}

drugs_98_05 = { 'SERTRALINE': 56635,
'CITALOPRAM': 59829,
'FLUOXETINE': 80006,
'PAROXETINE_HCL': 57150,
'FLUVOXAMINE': 57064,
'ESCITALOPRAM': 70466,
'DEXMETHYLPHENIDATE': 70427,
'METHYLPHENIDATE': 70374,
'METHAMPHETAMINE': 53485,
'AMPHETAMINE1': 70257,
'AMPHETAMINE2': 70258,
'AMPHETAMINE3': 50265,
'DEXTROAMPHETAMINE1': 70259,
'DEXTROAMPHETAMINE2': 70260,
'DEXTROAMPHETAMINE3': 51665,
'COMBINATION_PRODUCT': 51380,
'FIXED_COMBINATION': 51381,
'ATOMOXETINE': 70687,
'CLONIDINE1': 51275,
'CLONIDINE2': 70357,
'GUANFACINE': 52498
   }

df = pd.read_csv('nhamcsopd2010.csv' , index_col='PATCODE',
low_memory=False)
col_init = list(df.columns.values)
keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1', 'MED2',
'MED3', 'MED4', 'MED5']
for col in col_init:
if col not in keep_col:
del df[col]
if f[-3:] == 'csv' and f[-6:-4] in ('93', '94', '95', '96', '97', '98',
'99', '00', '91', '02', '03', '04', '05'):
drugs = drugs_98_05
elif f[-3:]  == 'csv' and f[-6:-4] in ('06', '08', '09', '10'):
drugs = drugs_current
for n in drugs:
df[n] = df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)


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


Re: speed up pandas calculation

2014-07-30 Thread Mark Lawrence

On 31/07/2014 00:04, Vincent Davis wrote:

I know this is a general python list and I am asking about pandas but
this question is probably not great for asking on stackoverflow.
I have a list of files (~80 files, ~30,000 rows) I need to process with
my current code it is take minutes for each file. Any suggestions of a
fast way. I am try to stick with pandas for educational purposes. Any
suggestions would be great. If you are curious the can find the data
file I am using below here.
http://www.nber.org/nhamcs/data/nhamcsopd2010.csv

drugs_current = {'CITALOPRAM': 4332,
  'ESCITALOPRAM': 4812,
  'FLUOXETINE': 236,
  'FLUVOXAMINE': 3804,
  'PAROXETINE': 3157,
  'SERTRALINE': 880,
  'METHYLPHENIDATE': 900,
  'DEXMETHYLPHENIDATE': 4777,
  'AMPHETAMINE-DEXTROAMPHETAMINE': 4035,
  'DEXTROAMPHETAMINE': 804,
  'LISDEXAMFETAMINE': 6663,
  'METHAMPHETAMINE': 805,
  'ATOMOXETINE': 4827,
  'CLONIDINE': 44,
  'GUANFACINE': 717}

drugs_98_05 = { 'SERTRALINE': 56635,
 'CITALOPRAM': 59829,
 'FLUOXETINE': 80006,
 'PAROXETINE_HCL': 57150,
 'FLUVOXAMINE': 57064,
 'ESCITALOPRAM': 70466,
 'DEXMETHYLPHENIDATE': 70427,
 'METHYLPHENIDATE': 70374,
 'METHAMPHETAMINE': 53485,
 'AMPHETAMINE1': 70257,
 'AMPHETAMINE2': 70258,
 'AMPHETAMINE3': 50265,
 'DEXTROAMPHETAMINE1': 70259,
 'DEXTROAMPHETAMINE2': 70260,
 'DEXTROAMPHETAMINE3': 51665,
 'COMBINATION_PRODUCT': 51380,
 'FIXED_COMBINATION': 51381,
 'ATOMOXETINE': 70687,
 'CLONIDINE1': 51275,
 'CLONIDINE2': 70357,
 'GUANFACINE': 52498
}

df = pd.read_csv('nhamcsopd2010.csv' , index_col='PATCODE',
low_memory=False)
col_init = list(df.columns.values)
keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1',
'MED2', 'MED3', 'MED4', 'MED5']
for col in col_init:
 if col not in keep_col:
 del df[col]
if f[-3:] == 'csv' and f[-6:-4] in ('93', '94', '95', '96', '97', '98',
'99', '00', '91', '02', '03', '04', '05'):
 drugs = drugs_98_05
elif f[-3:]  == 'csv' and f[-6:-4] in ('06', '08', '09', '10'):
 drugs = drugs_current
for n in drugs:
 df[n] =
df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)


Vincent Davis
720-301-3003




I suggest you ask here 
https://mail.python.org/mailman/listinfo/pandas-dev which I believe is 
also gmane.comp.python.pydata.



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

Mark Lawrence

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


Re: speed up pandas calculation

2014-07-30 Thread Skip Montanaro
 df = pd.read_csv('nhamcsopd2010.csv' , index_col='PATCODE',
low_memory=False)
 col_init = list(df.columns.values)
 keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1',
'MED2', 'MED3', 'MED4', 'MED5']
 for col in col_init:
 if col not in keep_col:
 del df[col]

I'm no pandas expert, but a couple things come to mind. First, where is
your code slow (profile it, even with a few well-placed prints)? If it's in
read_csv there might be little you can do unless you load those data
repeatedly, and can save a pickled data frame as a caching measure. Second,
you loop over columns deciding one by one whether to keep or toss a column.
Instead try

df = df[keep_col]

Third, if deleting those other columns is costly, can you perhaps just
ignore them?

Can't be more investigative right now. I don't have pandas on Android. :-)

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


Re: speed up pandas calculation

2014-07-30 Thread Vincent Davis
On Wed, Jul 30, 2014 at 6:28 PM, Vincent Davis vinc...@vincentdavis.net
wrote:

 The real slow part seems to be
 for n in drugs:
 df[n] =
 df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)


​I was wrong, this is fast, it was selecting the columns that was slow.
using
keep_col = ['PATCODE', 'PATWT', 'VDAYR', 'VMONTH', 'MED1', 'MED2', 'MED3',
'MED4', 'MED5']
df = df[keep_col]

took the time down from 19sec to 2 sec.


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


Re: speed up pandas calculation

2014-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2014 17:04:04 -0600, Vincent Davis wrote:

 I know this is a general python list and I am asking about pandas but
 this question is probably not great for asking on stackoverflow. I have
 a list of files (~80 files, ~30,000 rows) I need to process with my
 current code it is take minutes for each file. 

Hmmm, is that 30,000 rows per file, or 30,000 files in total?

Not that it really matters, I shouldn't expect that it makes that much 
difference either way.


 Any suggestions of a fast
 way. I am try to stick with pandas for educational purposes. Any
 suggestions would be great. If you are curious the can find the data
 file I am using below here.
 http://www.nber.org/nhamcs/data/nhamcsopd2010.csv


For brevity, I've trimmed back the dictionaries to something smaller. 
That's just for ease of reading.

 drugs_current = {'CITALOPRAM': 4332,
  'ESCITALOPRAM': 4812,
   [...]
  'CLONIDINE': 44,
  'GUANFACINE': 717}
 
 drugs_98_05 = { 'SERTRALINE': 56635,
 'CITALOPRAM': 59829,
  [...]
 'CLONIDINE2': 70357,
 'GUANFACINE': 52498
}
 
 df = pd.read_csv('nhamcsopd2010.csv' , index_col='PATCODE',
  low_memory=False)
 col_init = list(df.columns.values)
 keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1',
 'MED2', 'MED3', 'MED4', 'MED5']
 for col in col_init:
 if col not in keep_col:
 del df[col]

I expect that this could be your problem here. Deleting from the start or 
middle of lists is slow, and df may be a list or at least have list-like 
performance. Suppose you have a list like this:

['a', 'b', 'c', 'd', 'e', ..., 'zzz']

that is, a total of 26 + 26**2 + 26**3 = 18278 items. Now suppose you 
delete item 0, 'a':

= ['b', 'c', 'd', 'e', ..., 'zzz']

Python has to move the remaining 18278 items across one space. Then you 
delete 'b':

= ['c', 'd', 'e', ..., 'zzz']

Python has to move the remaining 18276 items across one space, making a 
total of 36559 moves. And that's just to delete two items. Roughly 
speaking, if you end up deleting N items from a list starting from the 
front, Python may have to move as many as N**2 items into their final 
positions. If you have 5 or 10 columns, that's not too bad, but if you 
have (say) 80 columns, and delete 70 of them, that could be *horribly* 
expensive.

If you must *repeatedly* use del on lists, it's best to ensure you're 
deleting from the end, not the start. But even better, and this applies 
to anything not just lists, is not to delete at all, but to create a new 
list, copying the columns you want, rather than deleting the columns you 
don't want.

I'm not familiar with pandas and am not sure about the exact syntax 
needed, but something like:

new_df = []  # Assuming df is a list.
for col in df:
if col.value in keep_col:
new_df.append(col)


 if f[-3:] == 'csv' and f[-6:-4] in ('93', '94', '95', '96', '97', '98',
 '99', '00', '91', '02', '03', '04', '05'):

Where does f come from? You haven't shown the definition of that.



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


Re: speed up pandas calculation

2014-07-30 Thread Chris Kaynor
On Wed, Jul 30, 2014 at 5:57 PM, Vincent Davis vinc...@vincentdavis.net
wrote:

 On Wed, Jul 30, 2014 at 6:28 PM, Vincent Davis vinc...@vincentdavis.net
 wrote:

 The real slow part seems to be
 for n in drugs:
 df[n] =
 df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)


 ​I was wrong, this is fast, it was selecting the columns that was slow.
 using


And that shows why profiling is important - before attempting to optimize
:).


  keep_col = ['PATCODE', 'PATWT', 'VDAYR', 'VMONTH', 'MED1', 'MED2',
 'MED3', 'MED4', 'MED5']
 df = df[keep_col]

 took the time down from 19sec to 2 sec.


 On Wed, Jul 30, 2014 at 5:57 PM, Steven D'Aprano 
steve+comp.lang.pyt...@pearwood.info wrote:

 ['a', 'b', 'c', 'd', 'e', ..., 'zzz']

 that is, a total of 26 + 26**2 + 26**3 = 18278 items. Now suppose you
 delete item 0, 'a':

 = ['b', 'c', 'd', 'e', ..., 'zzz']

 Python has to move the remaining 18278 items across one space. Then you
 delete 'b':


Really minor issue: I believe this should read 18277 items :).


 = ['c', 'd', 'e', ..., 'zzz']

 I'm not familiar with pandas and am not sure about the exact syntax
 needed, but something like:

 new_df = []  # Assuming df is a list.
 for col in df:
 if col.value in keep_col:
 new_df.append(col)


Another way to write this, using a list expression (untested):
new_df = [col for col in df if col.value in keep_col]

Also note that, while the code shows keep_col is fairly short, you may also
see performance gains if keep_col is a set ( O(1) lookup performance)
rather than a list ( O(n) lookup performance ). You would do this by using:

keep_col = set(('PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1', 'MED2',
'MED3', 'MED4', 'MED5'))

rather than your existing:

keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1', 'MED2',
'MED3', 'MED4', 'MED5']


This can apply anywhere you use the in operator. Note, however, that
generating the set is a bit slower, so you'd want to make sure the set is
made outside of a large loop.

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


Re: speed up pandas calculation

2014-07-30 Thread Steven D'Aprano
On Wed, 30 Jul 2014 18:57:15 -0600, Vincent Davis wrote:

 On Wed, Jul 30, 2014 at 6:28 PM, Vincent Davis
 vinc...@vincentdavis.net wrote:
 
 The real slow part seems to be
 for n in drugs:
 df[n] =
 df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)


 ​I was wrong, this is fast, it was selecting the columns that was slow.
 using
 keep_col = ['PATCODE', 'PATWT', 'VDAYR', 'VMONTH', 'MED1', 'MED2',
 'MED3', 'MED4', 'MED5']
 df = df[keep_col]
 
 took the time down from 19sec to 2 sec.


19 seconds? I thought you said it was taking multiple minutes?




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


Re: speed up pandas calculation

2014-07-30 Thread Skip Montanaro
(Now that I'm on a real keyboard, more complete responses are a bit easier.)

Regarding the issue of missing columns from keep_col, you could create
sets of what you have and what you want, and toss the rest:

toss_these = list(set(df.columns) - set(keep_col))
del df[toss_these]

Or something to that effect.

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


Re: speed up pandas calculation

2014-07-30 Thread Skip Montanaro
On Wed, Jul 30, 2014 at 8:11 PM, Chris Kaynor ckay...@zindagigames.com wrote:
 Another way to write this, using a list expression (untested):
 new_df = [col for col in df if col.value in keep_col]

As I am learning (often painfully) with pandas and JavaScript+(d3 or
jQuery), loops are the enemy. You want to operate on large chunks of
data simultaneously. In pandas, those chunks are thinly disguised
numpy arrays. In JS+(ds or jQuery), those chunks are selections from
the DOM.

I should have paid closer attention to the APL unit of my programming
languages survey class in college.

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


Re: speed up pandas calculation

2014-07-30 Thread Rustom Mody
On Thursday, July 31, 2014 7:58:59 AM UTC+5:30, Skip Montanaro wrote:
 As I am learning (often painfully) with pandas and JavaScript+(d3 or
 jQuery), loops are the enemy. You want to operate on large chunks of
 data simultaneously. In pandas, those chunks are thinly disguised
 numpy arrays. In JS+(ds or jQuery), those chunks are selections from
 the DOM.

 I should have paid closer attention to the APL unit of my programming
 languages survey class in college.

Much more within reach than you may imagine
http://baruchel.hd.free.fr/apps/apl/

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


Re: How to loop through nodes of xml through xslt

2014-07-30 Thread Dan Stromberg
On Wed, Jul 30, 2014 at 5:16 AM, varun bhatnagar varun292...@gmail.com wrote:
 Hi,

 I have two xml files.

 I am trying to fetch an output file which looks like this:

 Output.xml

 The number of Procedure tag (Procedure) can be different every time. So I
 have to read this tag every time from each xml and then merge it
 sequentially.
 Can anyone tell me how to achieve this. How can I loop every Procedure tag
 and and append the attrProc attribute value in a sequential order?

Did you mean to send this to an XSLT mailing list?  You came through
on the python-list.

If you want to make this about Python, you could try xmltodict or
lxml.  I've done two projects with xmltodict recently, and liked it
quite a bit.

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


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread Dan Stromberg
I like to think of pylint as an expert system about how to write
better Python.  Some of the warnings are pointless (superfluous-parens
really bugs me), but much of it is quite valuable.  And for the
-really- pointless stuff, you can create a pylintrc to ignore them
forever.  Personally, I prefer to add # pylint: disable=whatever for
the warnings I'm willing to ignore, rather than create a pylintrc
though.

Happily, Python is a very googleable language.  You can probably
just pick a project and start coding, and google your way out of any
sticking points.

You might also find some portions of
http://stromberg.dnsalias.org/~strombrg/Intro-to-Python/ useful,
perhaps especially the 2.x/3.x compatibility and common pitfalls.  You
might get something out of the one about generators too.

HTH

On Wed, Jul 30, 2014 at 1:20 PM,  guirec.cor...@gmail.com wrote:
 Hello,

 I am a Ruby developer and I want to program in Python. I know how to do 
 simple things like create classes, methods, variables and all the basics. I 
 want to know more. I want to know what is the Python philosophy, how to test, 
 how to create maintenable software, etc.

 I'm looking for online courses and any ressources I can have on the subject.

 Can you help me?

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


Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread Abhiram R
 I'm looking for online courses and any ressources I can have on the
 subject.


​If you can get your hands on the Python course on www.lynda.com, that'd do
the job.​


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


Re: login: optional

2014-07-30 Thread Kev Dwyer
John Bliss wrote:

 Noob here:
 
 Started new Python project via Google AppEngine which produced project
 files including:
 
 \app.yaml
 
 handlers:
 - url: /.*
   script: main.app
   secure: always
 
 Currently, navigating to project root forces me to authenticate with
 Google oAuth2 process. I'd like to turn that off so that I can navigate to
 project root without authenticating. Per:
 
 
https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Requiring_login_or_administrator_status
 
 ...I added:
 
 login: optional
 
 ...but that did not seem to make a difference. What am I doing wrong?

Hello,

I can't reproduce your problem on the dev server using this minimal setup:

app.yaml


application: test
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.* 
  script: main.app
  secure: always
  login: optional


main.py

import webapp2


class IndexHandler(webapp2.RequestHandler):

def get(self):
self.response.write('Hello world!')


app = webapp2.WSGIApplication([('/', IndexHandler)], debug=True)


Are you sure that there's nothing in your code or environment that could be 
causing the authentication challenge?

Cheers,

Kev



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


Re: rpath alike feature for python scripts

2014-07-30 Thread dieter
dieter die...@handshake.de writes:

 Olaf Hering o...@aepfle.de writes:
 On Mon, Jul 28, Albert-Jan Roskam wrote:
 does this help: https://nixos.org/patchelf.html. It is not specific to 
 Python, though.

 No, this does not help because its not about patching the result.
 The questions is how to obtain the value with should be patched into the
 result.
 ...
 The primary ways to interact with Python's import mechanism
 are sys.path and the envvar PYTHONPATH (which corresponds
 to the envvar LD_LIBRARY_PATH).

You may also have a look at the *.pth feature.
It allows package installers to influence the way how sys.path is
set up. A main example is easy-install.pth (used for egg installation).

I remember to have seen a documentation - however, I no longer remember where.

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


Re: speed up pandas calculation

2014-07-30 Thread Vincent Davis
On Wed, Jul 30, 2014 at 5:57 PM, Skip Montanaro skip.montan...@gmail.com
wrote:

  df = pd.read_csv('nhamcsopd2010.csv' , index_col='PATCODE',
 low_memory=False)
  col_init = list(df.columns.values)
  keep_col = ['PATCODE', 'PATWT', 'VDAY', 'VMONTH', 'VYEAR', 'MED1',
 'MED2', 'MED3', 'MED4', 'MED5']
  for col in col_init:
  if col not in keep_col:
  del df[col]

 I'm no pandas expert, but a couple things come to mind. First, where is
 your code slow (profile it, even with a few well-placed prints)? If it's in
 read_csv there might be little you can do unless you load those data
 repeatedly, and can save a pickled data frame as a caching measure. Second,
 you loop over columns deciding one by one whether to keep or toss a column.
 Instead try

 df = df[keep_col]

 Third, if deleting those other columns is costly, can you perhaps just
 ignore them?

 Can't be more investigative right now. I don't have pandas on Android. :-)


So the df = df[keep_col] is not fast but it is not that slow. You made me
think of a solution to that part. just slice and copy. The only gotya is
that the keep_col have to actually exist
 keep_col = ['PATCODE', 'PATWT', 'VDAYR', 'VMONTH', 'MED1', 'MED2', 'MED3',
'MED4', 'MED5']
df = df[keep_col]

The real slow part seems to be
for n in drugs:
df[n] = df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)



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


[issue22029] argparse - CSS white-space: like control for individual text blocks

2014-07-30 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


Added file: http://bugs.python.org/file36160/issue22029_2.patch

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



[issue22104] test_asyncio unstable in refleak mode

2014-07-30 Thread STINNER Victor

STINNER Victor added the comment:

It may be related to the issue #17911.

--

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



[issue22085] Drop support of Tk 8.3

2014-07-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm even not sure that current code works with Tk 8.3. We have no buildbots 
with Tk 8.3 and compatibility with it was not tested for years.

Here is a patch which drops support of Tk 8.3.

--
stage:  - patch review
title: Update deprecated Tcl commands in Tkinter - Drop support of Tk 8.3
Added file: http://bugs.python.org/file36161/tkinter_drop_83.patch

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-07-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +loewis

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



[issue11077] Tkinter is not thread safe

2014-07-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage: test needed - resolved
status: pending - closed

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



[issue21951] tcl test change crashes AIX

2014-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7de64def6565 by Serhiy Storchaka in branch '2.7':
Issue #21951: Temporary skip crashing test_user_command on AIX.
http://hg.python.org/cpython/rev/7de64def6565

New changeset 31f4cb1fede9 by Serhiy Storchaka in branch '3.4':
Issue #21951: Temporary skip crashing test_user_command on AIX.
http://hg.python.org/cpython/rev/31f4cb1fede9

New changeset de32cd419174 by Serhiy Storchaka in branch 'default':
Issue #21951: Temporary skip crashing test_user_command on AIX.
http://hg.python.org/cpython/rev/de32cd419174

--
nosy: +python-dev

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



[issue21951] tcl test change crashes AIX

2014-07-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Link to log with a crash:

http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/2442/steps/test/logs/stdio

--
stage: patch review - needs patch

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



[issue22018] signal.set_wakeup_fd() should accept sockets on Windows

2014-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 963214896b22 by Victor Stinner in branch 'default':
Issue #22018: Fix test_signal: use assertEqual() not assertIs()
http://hg.python.org/cpython/rev/963214896b22

--

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



[issue22104] test_asyncio unstable in refleak mode

2014-07-30 Thread STINNER Victor

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


--
components: +asyncio

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



[issue22104] test_asyncio unstable in refleak mode

2014-07-30 Thread STINNER Victor

STINNER Victor added the comment:

 It may be related to the issue #17911.

I checked: it is. The strange reference count can be seen with a single test. 
Example:

$ ./python -m test -R 3:3: -m test_default_exc_handler_coro test_asyncio 
[1/1] test_asyncio
beginning 6 repetitions
123456
..
test_asyncio leaked [53, 53, -106] references, sum=0
test_asyncio leaked [15, 15, -30] memory blocks, sum=0
1 test failed:
test_asyncio

This test uses a coroutine which raises an exception. The exception is stored 
in a Task object. But the exception contains also a traceback which indirectly 
creates a reference cycle. For example, the zero_error_coro() coroutine of the 
test uses the free variable self.

It's very difficult to find all objects of a reference cycle. We can try to 
break some cycles, it's already done Task._step() which sets self to None, but 
it's a waste of time. IMO the correct fix is to not store frame objects in an 
exception: see the issue #17911.

--

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



[issue22085] Drop support of Tk 8.3

2014-07-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The patch looks fine, please apply.

--

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-07-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The 3.4 patch looks fine, please apply.

I'm -1 on the 2.7 patch. I think it would be better to add a _tkinter helper 
function to create Tcl byte array objects. Alternatively, the binary format 
command might help. OTOH, I don't care about 2.7, so feel free to do whatever 
you consider appropriate.

--

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



[issue2052] Allow changing difflib._file_template character encoding.

2014-07-30 Thread Masato HASHIMOTO

Changes by Masato HASHIMOTO cabezon.hashim...@gmail.com:


--
nosy: +hashimo

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread Charles Newey

New submission from Charles Newey:

URL: https://docs.python.org/2/tutorial/controlflow.html#pass-statements

Quoted verbatim:

The pass statement does nothing. It can be used when a statement is required 
syntactically but the program requires no action. For example:


 while True:
... pass  # Busy-wait for keyboard interrupt (Ctrl+C)
...



While the example illustrates the point, it *may* give bad ideas to novice 
programmers reading it - while True: pass is an antipattern as it's very 
inefficient.

--
assignee: docs@python
components: Documentation
messages: 224296
nosy: Charles.Newey, docs@python
priority: normal
severity: normal
status: open
title: Python 2 docs 'control flow/pass' section contains bad example
type: enhancement
versions: Python 2.7

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Do you have any suggestion?
The section already includes examples about empty classes and as placeholder 
inside functions, and the only other realistic situations I can think of is 
inside an except to ignore errors -- but that might be considered an 
anti-pattern too.
It could be used with for loops if you want to e.g. consume an iterator, or 
with the with statement if you want to create an empty file, but these cases 
are not very common.

--
nosy: +ezio.melotti

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread Charles Newey

Charles Newey added the comment:

Your point about using pass with the with statement sounds like a better 
example than using pass in a loop.

Perhaps even something like adding a note to the example to clarify it:

# Don't use this in Python code - it is for illustrative purposes only
while True:
pass  # Busy-wait for keyboard interrupt (Ctrl+C)


On the other hand -- one could argue that the documentation should not show 
incorrect uses of Python syntax at all.

--

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



[issue10572] Move test sub-packages to Lib/test

2014-07-30 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
stage: needs patch - patch review

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



[issue10572] Move test sub-packages to Lib/test

2014-07-30 Thread Michael Foord

Michael Foord added the comment:

I still dislike moving tests around.

--

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread R. David Murray

R. David Murray added the comment:

How about something like:

   for x in my_generator():
   pass   # Exhaust co-routine generator to make sure all data is processed.

I have no idea if you'd ever actually do that in a well-structured co-routine 
context, though, not having written very much of that kind of code.

--
nosy: +r.david.murray

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



[issue20746] test_pdb fails in refleak mode

2014-07-30 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This is because breakpoints number are class attributes. With the following 
change, the ./python -m test test_pdb test_pdb is ok:

$ hg diff
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -614,6 +614,8 @@
 ... test_function_2()
 ... end = 1
 
+ from bdb import Breakpoint; Breakpoint.next = 1
+
  with PdbTestInput(['break test_function_2',
 ...'continue',
 ...'return',

Attached refleak_3.patch fixes this problem for 
test_next_until_return_at_return_event().

--
Added file: http://bugs.python.org/file36162/refleak_3.patch

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



[issue20746] test_pdb fails in refleak mode

2014-07-30 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Sorry, I posted to the wrong issue, please ignore my previous message.

--

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



[issue20766] reference leaks in pdb

2014-07-30 Thread Xavier de Gaye

Changes by Xavier de Gaye xdeg...@gmail.com:


Added file: http://bugs.python.org/file36163/refleak_3.patch

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



[issue20766] reference leaks in pdb

2014-07-30 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This is because breakpoints number are class attributes. With the following 
change, the ./python -m test test_pdb test_pdb is ok:

$ hg diff
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -614,6 +614,8 @@
 ... test_function_2()
 ... end = 1
 
+ from bdb import Breakpoint; Breakpoint.next = 1
+
  with PdbTestInput(['break test_function_2',
 ...'continue',
 ...'return',

Attached refleak_3.patch fixes this.

--

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



[issue22107] tempfile module misinterprets access denied error on Windows

2014-07-30 Thread Roger Upole

New submission from Roger Upole:

_mkstemp_inner assumes that an access denied error means that it
has generated a filename that matches an existing foldername.
However, in the case of a folder for which you don't have permissions to
create a file, this means it will loop thru the maximum possible number of 
files.
This causes it to hang for several seconds and eventually return a bogus
FileExistsError.

Similar behaviour exists in 2.7.7, but it throws an IOError instead.

http://bugs.python.org/issue18849 seems to be where this was introduced.

--
components: Windows
messages: 224304
nosy: rupole
priority: normal
severity: normal
status: open
title: tempfile module misinterprets access denied error on Windows
versions: Python 2.7, Python 3.4

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



[issue21591] exec(a, b, c) not the same as exec a in b, c in nested functions

2014-07-30 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: patch review - resolved

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



[issue22104] test_asyncio unstable in refleak mode

2014-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 30/07/2014 06:08, STINNER Victor a écrit :

 This test uses a coroutine which raises an exception. The exception
 is
stored in a Task object. But the exception contains also a traceback
which indirectly creates a reference cycle.

regrtest calls gc.collect().

--

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread Charles Newey

Charles Newey added the comment:

@David I have no idea either (no having written much of that sort of code 
myself either), but that looks more sensible.

I'm just nitpicking really, anyway.

--

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



[issue22106] Python 2 docs 'control flow/pass' section contains bad example

2014-07-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Keep in mind that this is in one of the first sections of the tutorial, where 
try/except, with, and generators have not been introduced yet.
Maybe the comment could be changed to a simpler loop forever (use ctrl+c to 
stop) so that it doesn't suggest that this is the way to wait for keyboard 
interrupts and/or a note like note that this will use 100% of the CPU could 
be added as well.

--

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



[issue20170] Derby #1: Convert 137 sites to Argument Clinic in Modules/posixmodule.c

2014-07-30 Thread Larry Hastings

Larry Hastings added the comment:

Here's a fresh diff.  I did some cleanup this time (Clinic now generates the 
#ifndef versions of the METHODDEF structures) and I believe solved everything 
MSVC complains about.

Zachary, can you try this one?

--
Added file: http://bugs.python.org/file36164/larry.clinicize.posixmodule.5.diff

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



[issue20341] Argument Clinic: add nullable ints

2014-07-30 Thread Larry Hastings

Larry Hastings added the comment:

Here's a fresh patch.  After discussing with Martin at EuroPython, I moved the 
implementation into Python/getargs.c, and the prototypes into modsupport.h.  
I'm still using the example of repeat.new to show what it looks like and how 
it works.  However I don't plan on checking the changes to repeat.new in when I 
check in the patch--I'd want to discuss it with Raymond first.

--
nosy: +loewis

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



[issue20341] Argument Clinic: add nullable ints

2014-07-30 Thread Larry Hastings

Larry Hastings added the comment:

Whoops, here's the patch.

--
Added file: http://bugs.python.org/file36165/larry.nullable.ints.4.txt

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



[issue22104] test_asyncio unstable in refleak mode

2014-07-30 Thread Zachary Ware

Zachary Ware added the comment:

I checked on my theory, and removing the extra reference to 'tests' from the 
runtest_inner scope fixes it for me:

$ python -m test -R 3:3: test_asyncio
Running Debug|Win32 interpreter...
[1/1] test_asyncio
beginning 6 repetitions
123456
..
1 test OK.

Here's the patch.

--
keywords: +patch
Added file: http://bugs.python.org/file36166/issue22104.diff

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



[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-30 Thread Guido van Rossum

Guido van Rossum added the comment:

Is this at all related to the use of GNU readline?

--
nosy: +gvanrossum

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



[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, it is. GNU readline will use a FILE*. Apparently, one can customize this 
behaviour, see http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC25

Variable: rl_getc_func_t * rl_getc_function
If non-zero, Readline will call indirectly through this pointer to get a 
character from the input stream. By default, it is set to rl_getc, the default 
Readline character input function (see section 2.4.8 Character Input). In 
general, an application that sets rl_getc_function should consider setting 
rl_input_available_hook as well. 

It is not obvious how that interacts with special keys, e.g. arrows.

--

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

@Christoph please raise a new issue regarding the problem you describe in 
msg219788.

--
nosy: +BreamoreBoy

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9474f2971855 by Serhiy Storchaka in branch '3.4':
Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk.
http://hg.python.org/cpython/rev/9474f2971855

New changeset b9d249316f29 by Serhiy Storchaka in branch 'default':
Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk.
http://hg.python.org/cpython/rev/b9d249316f29

--
nosy: +python-dev

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

@Christoph sorry #21652 has already been raised to address the problem of mixed 
str and unicode objects.

--

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2014-07-30 Thread Brian Curtin

Changes by Brian Curtin br...@python.org:


--
nosy:  -brian.curtin

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



[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

Ben you're correct.  The other issues have been addressed in #10162 and #9291 
so I believe this can be closed.  One 2.7 regression regarding mixed str and 
unicode objects is addressed in #21652.

--

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



[issue16328] win_add2path.py sets wrong user path

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

Should we create the scripts dir during install?  Is it that big a deal?

--
nosy: +BreamoreBoy, steve.dower, zach.ware

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-07-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Martin for your reviews. Here is updated 2.7 patch which implements 
your suggestion.

The disadvantage of this patch in comparison with first version is that it will 
not work with statically compiled embedded Python, when only stdlib is updated. 
I once broke re in bugfix release in such manner (by moving one constant from 
Python sources to C sources). On other hand, it is very unlikely that anyone 
uses Tkinter in such circumstances, and in any case this part of code is broken 
for now, so patch should not introduce new regression.

--
Added file: http://bugs.python.org/file36167/tkinter_bytes-2.7_2.patch

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



[issue2771] Test issue

2014-07-30 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
priority: normal - 

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



[issue2771] Test issue

2014-07-30 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
status: closed - 

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



[issue2771] Test issue

2014-07-30 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
status:  - closed

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



[issue20170] Derby #1: Convert 137 sites to Argument Clinic in Modules/posixmodule.c

2014-07-30 Thread Zachary Ware

Zachary Ware added the comment:

Close, but no cigar :).  Posted Rietveld comments to address the last two 
compile issues (one of which also appears to be a major bug, but only a warning 
at compile time).

Also, Victor has added os.get_blocking() and os.set_blocking(), which prevent 
your patch from applying cleanly (I tested against the parent of Victor's 
changeset).

After fixing the two issues I pointed out on Rietveld, I still get major 
failure on test:

==
ERROR: test_1565150 (__main__.StatAttributeTests)
--
Traceback (most recent call last):
  File P:\ath\to\cpython\lib\test\test_os.py, line 214, in tearDown
os.rmdir(support.TESTFN)
OSError: [WinError 145] The directory is not empty: '@test_13492_tmp'

==
ERROR: test_1686475, test_file_attributes, test_large_time, 
test_stat_attributes, test_stat_attributes_bytes, test_stat_result_pickle, 
test_utime, test_utime_dir, test_utime_invalid_arguments, test_utime_ns, 
test_utime_subsecond, test_exist_ok_existing_directory, 
test_exist_ok_existing_regular_file, test_exist_ok_s_isgid_directory, 
test_makedir (All the same error)
--
Traceback (most recent call last):
  File P:\ath\to\cpython\lib\test\test_os.py, line ###, in setUp
os.mkdir(support.TESTFN)
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: '@test_13492_tmp'

==
ERROR: test_urandom_fd_reopened (__main__.URandomTests)
--
Traceback (most recent call last):
  File P:\ath\to\cpython\lib\test\test_os.py, line 1138, in 
test_urandom_fd_reopened
with open(support.TESTFN, 'wb') as f:
PermissionError: [Errno 13] Permission denied: '@test_13492_tmp'

==
FAIL: test_chdir (__main__.Win32ErrorTests)
--
Traceback (most recent call last):
  File P:\ath\to\cpython\lib\test\test_os.py, line 1274, in test_chdir
self.assertRaises(OSError, os.chdir, support.TESTFN)
AssertionError: OSError not raised by chdir

--
Ran 164 tests in 5.122s

The problem appears to be in unlink or rmdir, but I can't see anything amiss in 
either one.  I'll keep looking, but you may have a better idea what's going 
wrong.

--

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



[issue22085] Drop support of Tk 8.3

2014-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1aa6ac23340d by Serhiy Storchaka in branch 'default':
Issue #22085: Dropped support of Tk 8.3 in Tkinter.
http://hg.python.org/cpython/rev/1aa6ac23340d

--
nosy: +python-dev

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



[issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded

2014-07-30 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The 2.7_2 patch looks good to me. I won't rule on the backwards compatibility 
implications, although I agree that this is unlikely to cause a regression (it 
would only if somebody updated the standard library only, *and* would use data= 
for PhotoImage). I'm unsure whether it was possible at all so far to use data= 
(with whatever argument); if you could have passed a non-buffer object 
successfully, this would break now.

--

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



[issue22085] Drop support of Tk 8.3

2014-07-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue16383] Python 3.3 Permission Error with User Library on Windows

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

Works fine for me on Windows 8.1 64 bit using 3.4.1 and 3.5.0a0.  Can one on 
our Windows gurus confirm this please.

--
nosy: +BreamoreBoy, steve.dower, tim.golden, zach.ware

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



[issue1776160] Buffer overflow when listing deeply nested directory

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

I suggest we close this as won't fix since I don't see how we can justify 
spending time working around a known limitation of Windows.

--
nosy: +BreamoreBoy

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



[issue7833] bdist_wininst installers fail to load extensions built with Issue4120 patch

2014-07-30 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
components:  -Distutils2
nosy: +dstufft
versions: +Python 3.4, Python 3.5 -3rd party, Python 3.2, Python 3.3

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



[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2014-07-30 Thread Mark Lawrence

Mark Lawrence added the comment:

Could somebody respond to the originator please.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.3

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



[issue18885] handle EINTR in the stdlib

2014-07-30 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

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



[issue1776160] Buffer overflow when listing deeply nested directory

2014-07-30 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
nosy:  -loewis

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



[issue22007] sys.stdout.write on Python 2.7 is not EINTR safe

2014-07-30 Thread Piotr Dobrogost

Piotr Dobrogost added the comment:

@hypo
Is there any reason you keep this PEP secret :) by not mentioning it on bug 
18885?

--
nosy: +piotr.dobrogost

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



[issue22108] python c api wchar_t*/char* passing contradiction

2014-07-30 Thread Jonas Jelten

New submission from Jonas Jelten:

The documentation and the code example at
https://docs.python.org/3.5/extending/embedding.html#very-high-level-embedding

#include Python.h

int
main(int argc, char *argv[])
{
  Py_SetProgramName(argv[0]);  /* optional but recommended */
  Py_Initialize();
  PyRun_SimpleString(from time import time,ctime\n
 print('Today is', ctime(time()))\n);
  Py_Finalize();
  return 0;
}

contradicts the actual implementation of the code:
http://hg.python.org/cpython/file/tip/Include/pythonrun.h#l25

which leads to compiler errors. To fix them, ugly wchar_t to char conversions 
are needed.

Also, I was hoping, Python 3.3 finally switched from wchar_t to char and UTF-8.
at least that's how I understood PEP 393 http://python.org/dev/peps/pep-0393/

see also:

http://stackoverflow.com/questions/21591908/python-3-3-c-string-handling-wchar-t-vs-char


= Are the docs wrong (which i hope are not, the example is straightforward and 
simple-stupid with a char*),
or is cpython wrong?

--
components: Unicode
messages: 224327
nosy: ezio.melotti, haypo, thejj
priority: normal
severity: normal
status: open
title: python c api wchar_t*/char* passing contradiction
type: compile error
versions: Python 3.3, Python 3.4, Python 3.5

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



  1   2   >