ANN: cssutils 0.9.7final

2010-11-29 Thread Christof

what is it
--
A Python package to parse and build CSS Cascading Style Sheets.
(Not a renderer though!)

about this release
--
0.9.7 is the final 0.9.7 release. Work on 0.9.8 has begun.

main changes

No real change but CSSValue and related classes will not be supported in 
0.9.8
anymore. 0.9.8 will feature a simplified API. Please follow its 
development if

you need any currently supported or new feature. Thanks!

license
---
cssutils is published under the LGPL version 3 or later, see
http://cthedot.de/cssutils/

If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 and higher or Jython 2.5 and higher (tested with
Python 2.7(x64), 2.6.5(x64), 2.5.4(x32), 2.4.4(x32) and Jython 2.5.1 on 
Win7x64

only)


Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


Christof
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANN] guidata v1.2.4

2010-11-29 Thread Pierre.RAYBAUT
Hi all,

I am pleased to announce that `guidata` v1.2.4 has been released.
More than a bug fix release, this version of `guiqwt` includes a brand new 
documentation with examples, API reference, etc.:
http://packages.python.org/guidata/

Based on the Qt Python binding module PyQt4, guidata is a Python library 
generating graphical user interfaces for easy dataset editing and display. It 
also provides helpers and application development tools for PyQt4.

guidata also provides the following features:

* guidata.qthelpers: PyQt4 helpers
* guidata.disthelpers: py2exe helpers
* guidata.userconfig: .ini configuration management helpers (based on 
Python standard module ConfigParser)
* guidata.configtools: library/application data management
* guidata.gettext_helpers: translation helpers (based on the GNU tool 
gettext)
* guidata.guitest: automatic GUI-based test launcher
* guidata.utils: miscelleneous utilities


guidata has been successfully tested on GNU/Linux and Windows platforms.

Python package index page:
http://pypi.python.org/pypi/guidata/

Documentation, screenshots:
http://packages.python.org/guidata/

Downloads (source + Python(x,y) plugin):
http://sourceforge.net/projects/guidata/

Cheers,
Pierre

---

Dr. Pierre Raybaut
CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


[ANN] guiqwt v2.0.7

2010-11-29 Thread Pierre.RAYBAUT
Hi all,

I am pleased to announce that `guiqwt` v2.0.7 has been released.
More than a bug fix release, this version of `guiqwt` includes a brand new 
documentation with examples, API reference, etc.:
http://packages.python.org/guiqwt/

Based on PyQwt (plotting widgets for PyQt4 graphical user interfaces) and on 
the scientific modules NumPy and SciPy, guiqwt is a Python library providing 
efficient 2D data-plotting features (curve/image visualization and related 
tools) for interactive computing and signal/image processing application 
development.

When compared to the excellent module `matplotlib`, the main advantage of 
`guiqwt` is performance: see 
http://packages.python.org/guiqwt/overview.html#performances.

But `guiqwt` is more than a plotting library; it also provides:

  * Helper functions for data processing: see the example 
http://packages.python.org/guiqwt/examples.html#curve-fitting

  * Framework for signal/image processing application development: see 
http://packages.python.org/guiqwt/examples.html

  * And many other features like making executable Windows programs easily 
(py2exe helpers): see http://packages.python.org/guiqwt/disthelpers.html


guiqwt plotting features are the following:

guiqwt.pyplot: equivalent to matplotlib's pyplot module (pylab)

supported plot items:

* curves, error bar curves and 1-D histograms
* images (RGB images are not supported), images with non-linear x/y 
scales, images with specified pixel size (e.g. loaded from DICOM files), 2-D 
histograms, pseudo-color images (pcolor)
* labels, curve plot legends
* shapes: polygon, polylines, rectangle, circle, ellipse and segment
* annotated shapes (shapes with labels showing position and 
dimensions): rectangle with center position and size, circle with center 
position and diameter, ellipse with center position and diameters (these items 
are very useful to measure things directly on displayed images)

curves, images and shapes:

* multiple object selection for moving objects or editing their 
properties through automatically generated dialog boxes (guidata)
* item list panel: move objects from foreground to background, 
show/hide objects, remove objects, ...
* customizable aspect ratio
* a lot of ready-to-use tools: plot canvas export to image file, image 
snapshot, image rectangular filter, etc.

curves:

* interval selection tools with labels showing results of computing on 
selected area
* curve fitting tool with automatic fit, manual fit with sliders, ...

images:

* contrast adjustment panel: select the LUT by moving a range selection 
object on the image levels histogram, eliminate outliers, ...
* X-axis and Y-axis cross-sections: support for multiple images, 
average cross-section tool on a rectangular area, ...
* apply any affine transform to displayed images in real-time 
(rotation, magnification, translation, horizontal/vertical flip, ...)

application development helpers:

* ready-to-use curve and image plot widgets and dialog boxes
* load/save graphical objects (curves, images, shapes)
* a lot of test scripts which demonstrate guiqwt features


guiqwt has been successfully tested on GNU/Linux and Windows platforms.

Python package index page:
http://pypi.python.org/pypi/guiqwt/

Documentation, screenshots:
http://packages.python.org/guiqwt/

Downloads (source + Python(x,y) plugin):
http://sourceforge.net/projects/guiqwt/

Cheers,
Pierre

---

Dr. Pierre Raybaut
CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


py-1.4.0: cross python lib for localpath/io/dynamic/... code functionality

2010-11-29 Thread holger krekel
py-1.4.0: cross-python lib for path, code, io, ... manipulations
===

py is a small library comprising APIs for filesystem and svn path
manipulations, dynamic code construction and introspection, a Py2/Py3
compatibility namespace (py.builtin), IO capturing, terminal colored printing
(on windows and linux), ini-file parsing and a lazy import mechanism.
It runs unmodified on all Python interpreters compatible to Python2.4 up
until Python 3.2.  The general goal with py is to provide stable APIs
for some common tasks that are continously tested against many Python
interpreters and thus also to help transition. Here are some docs:

http://pylib.org

NOTE: The prior py-1.3.X versions contained py.test which now comes
as its own separate pytest distribution and was just released
as pytest-2.0.0, see here for the revamped docs:

http://pytest.org

And py.cleanup|py.lookup|py.countloc etc. helpers are now part of
the pycmd distribution, see http://pypi.python.org/pypi/pycmd

This makes py-1.4.0 a simple library which does not install
any command line utilities anymore.

cheers,
holger

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

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


pycmd-1.0: tools for managing/searching Python related files

2010-11-29 Thread holger krekel
Hi all, 

i released pycmd-1.0, some tools for working with Python source code:

py.cleanup: remove .pyc and $py.class etc. files
py.lookup: grep in python files
py.countloc: give Lines of Code for code and tests
py.which: print location of an importable package or module

All tools have command line options with help strings
and have automated tests running against them.

see also: http://pypi.python.org/pypi/pycmd

cheers,
holger
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: Spyder v2.0.0

2010-11-29 Thread Pierre Raybaut
Hi all,

I am pleased to announced that Spyder v2.0.0 has just been released.

Spyder (previously known as Pydee) is a free open-source Python
development environment providing MATLAB-like features in a simple and
light-weighted software, available for Windows XP/Vista/7, GNU/Linux
and MacOS X:
http://spyderlib.googlecode.com/

Spyder is part of spyderlib, a Python module based on PyQt4, pyflakes
and rope (QScintilla's dependency has been removed in version 2.0 and
rope features have been integrated since this version as well).

Some of Spyder basic features:

* Python, C/C++, Fortran source editor with class/function
browser, code completion and calltips
* consoles:
  o open as many Python interpreters, IPython consoles or
command windows as you need
  o code completion and calltips
  o variable explorer with GUI-based editors for a lot of data
types (numbers, strings, lists, arrays, dictionaries, ...)
* object inspector: provide documentation or source code on any
Python object (class, function, module, ...)
* online documentation: automatically generated html documentation
on installed Python modules
* find in files
* file explorer
* project manager
* MATLAB-like PYTHONPATH management dialog box (works with all
consoles)
* Windows only: current user environment variables editor
* direct links to documentation (Python, Qt, Matplotlib, NumPy,
Scipy, etc.)
* direct link to Python(x,y) launcher
* direct links to QtDesigner, QtLinguist and QtAssistant (Qt
documentation)

Some of the new key features introduced with Spyder v2.0:

* IPython integration is no longer experimental: only v0.10
release is supported
* a brand new GUI layout: clearer menus and options structure
* source editor:
  o powerful dynamic code introspection features (powered by
rope):
+ improved code completion and calltips
+ go-to-definition: go to an object definition with a
simple mouse click!
  o breakpoints and conditional breakpoints
* object inspector: new rich text mode (powered by sphinx)
* variable explorer may now open multiple array/list/dict editor
instances at once, thus allowing to compare variable contents
* preferences dialog box:
  o keyboard shortcuts
  o syntax coloring schemes (source editor, history log,
object inspector)
  o console: background color (black/white), automatic code
completion, etc.
  o and a lot more...

Cheers,
Pierre
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


oejskit 0.8.9, javascript testing support, consolidation release

2010-11-29 Thread Samuele Pedroni
I have just uploaded to pypi a new release 0.8.9 of oejskit, this is
just a consolidation release.

The main changes it that it is packaged as source tarball, making it
easier to install with Python 2.7, and that it drops support for
Python 2.5.

This release doesn't support yet py.test 2.0, I have started
investigating what is required to support it, it will take a bit of time to
release something working with it.

unittest.py support is working and unchanged.

About OE jskit:

jskit contains infrastructure and in particular a py.test plugin to
enable running unit tests for JavaScript code inside browsers.
It contains also glue code to run JavaScript tests from unittest.py
based test suites.

The approach also enables to write integration tests such that the
JavaScript code is tested against server-side Python code mocked as
necessary. Any server-side framework that can already be exposed through
WSGI can play.

The plugin requires py.test 1.3.4 or slightly older.

More information and downloading at:

http://pypi.python.org/pypi/oejskit

including a changelog and  documentation.

regards, Samuele Pedroni
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: STARTTLS extension not supported by server

2010-11-29 Thread Michele Simionato
For future googlers: it turns out in my case the call to .starttls()
was not needed: I removed it and everything worked. Dunno why I was
there in the first place, the original code was written by somebody
else.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: remote control firefox with python

2010-11-29 Thread Simon Brunning
On 28 November 2010 15:22, News123 news1...@free.fr wrote:

 I wondered whether there is a simpe way to
 'remote' control fire fox with python.

Selenium might be worth a look, too:
http://code.google.com/p/selenium/wiki/PythonBindings

-- 
Cheers,
Simon B.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: remote control firefox with python

2010-11-29 Thread Daniel Molina Wegener
On Domingo 28 Noviembre 2010 18:58,
News123 wrote:

 On 11/28/2010 06:19 PM, Tim Harig wrote:
 On 2010-11-28, News123 news1...@free.fr wrote:
 Thanks in advance for any pointers ideas.
 
 google XPCOM
 thanks a lot

For XPCOM (I've worked with it), you can try the following
articles and references:

XPCOM
http://en.wikipedia.org/wiki/XPCOM

XPCOM Part 1: An introduction to XPCOM:
http://www.ibm.com/developerworks/webservices/library/co-xpcom.html

XPCOM Part 2: XPCOM component basics:
http://www.ibm.com/developerworks/webservices/library/co-xpcom2.html

XPCOM Part 3: Setting up XPCOM
http://www.ibm.com/developerworks/webservices/library/co-xpcom3.html

Mozilla Reference Documentation
https://developer.mozilla.org/en/XPCOM

Best regards,
-- 
Daniel Molina Wegener dmw [at] coder [dot] cl
System Programmer  Web Developer
Phone: +56 (2) 979-0277 | Blog: http://coder.cl/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standard module implementation

2010-11-29 Thread Daniel Molina Wegener
On Domingo 28 Noviembre 2010 11:08,
candide wrote:

 I was wondering if all the standard module are implemented in C. For
 instance, I can't find a C implementation for the minidom xml parser
 under Python 2.6.

  If you are looking for a C implementation of DOM as Python Extension,
you can try the lxml extension, which uses the LibXML2 bindings:

  http://codespeak.net/lxml/

Best regards,
-- 
Daniel Molina Wegener dmw [at] coder [dot] cl
System Programmer  Web Developer
Phone: +56 (2) 979-0277 | Blog: http://coder.cl/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using property() to extend Tkinter classes but Tkinter classes are old-style classes?

2010-11-29 Thread Michele Simionato
On Nov 29, 12:15 am, Terry Reedy tjre...@udel.edu wrote:
 On 11/28/2010 3:47 PM, pyt...@bdurham.com wrote:

  I had planned on subclassing Tkinter.Toplevel() using property() to wrap
  access to properties like a window's title.
  After much head scratching and a peek at the Tkinter.py source, I
  realized that all Tkinter classes are old-style classes (even under
  Python 2.7).
  1. Is there a technical reason why Tkinter classes are still old-style
  classes?

 To not break old code. Being able to break code by upgrading all classes
 in the stdlib was one of the reasons for 3.x.

 --
 Terry Jan Reedy

Notice that you can upgrade a Tkinter class to a new-style class
simply by deriving from object.
For instance you could define a new-style Label class as:

class Label(Tkinter.Label, object):
   pass


then you can attach properties to it. You have a good chance of not
breaking anything in doing so,
but you cannot know for sure unless you try. I don't know if Tkinter
uses features of old-style classes which are inconsistent with new-
style classes, but probably the answer is not much.

 Michele Simionato
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-29 Thread Michele Simionato
On Nov 28, 2:01 pm, m...@distorted.org.uk (Mark Wooding) wrote:
 Steve Holden st...@holdenweb.com writes:
  It isn't. Even inheritance itself isn't as useful as it at first
  appears, and composition turns out in practice to be much more useful.
  That goes double for multiple inheritance.

 Composition /with a convenient notation for delegation/ works fairly
 well.  Indeed, this can be seen as the basis of Self.  But downwards
 delegation -- where a superclass leaves part of its behaviour
 unspecified and requires (concrete) subclasses to fill in the resulting
 blanks -- is hard to express like this without some kind of means of
 identifying the original recipient of the delegated message.  Once
 you've done that, there isn't much of a difference between a superclass
 and a component with implicit delegation.

 -- [mdw]

For a long time I had the feeling that in a language with pattern
matching inheritance (both single and double) is basically useless.
You can easily define objects as functions responding to messages and
classes becomes useless. However I have never implemented a large
project with such techniques, so I
am not sure how much my gut feeling is sound. Apparently here at work
we are going to use Erlang in the near future and I hope to get my
hand dirty and see in practice how well one can work with a language
without inheritance. BTW, is there anybody here with experience on
such languages and caring to share his learned lessons?

Michele Simionato
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing floats

2010-11-29 Thread Marco Nawijn
On 29 nov, 00:20, Nobody nob...@nowhere.com wrote:
 On Sat, 27 Nov 2010 18:23:48 -0500, Terry Reedy wrote:
  Therefore, to implement this multiplication operation I need to have a
  way to verify that the float tuples C and D are equal.

  I might try the average relative difference:
  sum(abs((i-j)/(i+j)) for i,j in zip(C,D))/n # assuming lengths constant

 The division is unstable if i and j are close to zero.

 For scalars, I'd use:

         abs(i-j) = epsilon * (1 + abs(i+j))

 This amounts to a relative error check for large values and an absolute
 error check for values close to zero.

 For a vector, I'd check that the above holds for all pairs.

Hi All,

Why don't you treat the C and D tuples as vectors? You can than check
dot product
and norm (length) for equality. Using scipy (www.scipy.org), you even
get very nice
performance.

Marco
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TDD in python

2010-11-29 Thread rustom
On Nov 28, 7:52 pm, Stefan Behnel stefan...@behnel.de wrote:
 Rustom Mody, 28.11.2010 11:58:

  Does anyone know of something like this for python?

 http://www.vimeo.com/13240481

 The page seems to require a recent version of the Flash player. Could you
 describe what exactly you are looking for?

 Stefan

Well most modern languages have TDD frameworks.
However TDD is learnt by doing and not from books (like swimming/
cycling).
This screencast gives a detailed demo of *doing it* in eclipse/C++
I was hoping for something similar for python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7.1

2010-11-29 Thread Kent Johnson
On Nov 27, 11:33 pm, Benjamin Peterson benja...@python.org wrote:
 On behalf of the Python development team, I'm happy as a clam to announce the
 immediate availability of Python 2.7.1.

Will there be Mac binaries for 2.7.1 and 3.1.3? Currently the web site
shows only source and Windows binaries.

Thanks,
Kent
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TDD in python

2010-11-29 Thread André
On Nov 29, 7:31 am, rustom rustompm...@gmail.com wrote:
 On Nov 28, 7:52 pm, Stefan Behnel stefan...@behnel.de wrote:

  Rustom Mody, 28.11.2010 11:58:

   Does anyone know of something like this for python?

  http://www.vimeo.com/13240481

  The page seems to require a recent version of the Flash player. Could you
  describe what exactly you are looking for?

  Stefan

 Well most modern languages have TDD frameworks.
 However TDD is learnt by doing and not from books (like swimming/
 cycling).
 This screencast gives a detailed demo of *doing it* in eclipse/C++
 I was hoping for something similar for python


Go to showmedo.com and do a search for python tdd; you'll find many
such screencasts.

André
-- 
http://mail.python.org/mailman/listinfo/python-list


hashlib in one line

2010-11-29 Thread Thomas Guettler
Hi,

I think it would be nice if you could use the hashlib in one line:

hashlib.sha256().update('abc').hexdigest()

Unfortunately update() returns None.

Is there a way to convert a string to the hexdigest of sha256 in one line?

  Thomas


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hashlib in one line

2010-11-29 Thread J. Gerlach
Am 29.11.2010 14:50, schrieb Thomas Guettler:
 Hi,
 
 I think it would be nice if you could use the hashlib in one line:
 
 hashlib.sha256().update('abc').hexdigest()
 
 Unfortunately update() returns None.
 
 Is there a way to convert a string to the hexdigest of sha256 in one line?
 
   Thomas
 
 
Yeah, something like this would be nice: ;)

hashlib.sha256('abc').hexdigest()

(tested in 2.6.6)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hashlib in one line

2010-11-29 Thread Stefan Sonnenberg-Carstens

Am 29.11.2010 14:50, schrieb Thomas Guettler:

Hi,

I think it would be nice if you could use the hashlib in one line:

hashlib.sha256().update('abc').hexdigest()

Unfortunately update() returns None.

Is there a way to convert a string to the hexdigest of sha256 in one line?

   Thomas



Like so ?

 hashlib.sha256('abc').hexdigest()
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using property() to extend Tkinter classes but Tkinter classes are old-style classes?

2010-11-29 Thread python
Michele and Terry,

 From: Michele Simionato michele.simion...@gmail.com

 Notice that you can upgrade a Tkinter class to a new-style class simply by 
 deriving from object. For instance you could define a new-style Label class 
 as:

 class Label(Tkinter.Label, object):
   pass

Michele - your technique is *exactly* what I was searching for (and
works well so far!). Terry - your explanation why Tkinter still uses old
style classes (for compatibility with existing code) makes sense.

Thank you both.

Malcolm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hashlib in one line

2010-11-29 Thread Thomas Guettler
Thank you, I was blind:

See condensed:
http://docs.python.org/library/hashlib.html


Stefan Sonnenberg-Carstens wrote:
 Am 29.11.2010 14:50, schrieb Thomas Guettler:
 Hi,

 I think it would be nice if you could use the hashlib in one line:

 hashlib.sha256().update('abc').hexdigest()

 Unfortunately update() returns None.

 Is there a way to convert a string to the hexdigest of sha256 in one
 line?

Thomas


 Like so ?
 
 hashlib.sha256('abc').hexdigest()
 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-29 Thread Kirill Simonov

Hi Raymond,

Another example: extensions in Mercurial.  Mercurial is a VCS with a 
typical command line syntax:


$ hg command command arguments and options

Mercurial has an extension mechanism for adding new and modifying 
existing commands.  A big chunk of Mercurial functionality is 
implemented in `ui` and `repo` classes and extensions often patch those 
to override the default behavior.  For instance, you could check the 
`color` extension, which patches `ui` to override `write*` methods:


http://selenic.com/hg/file/3790452d499b/hgext/color.py#l152


Thanks,
Kirill


On 11/24/2010 03:08 PM, Raymond Hettinger wrote:

I'm writing-up more guidance on how to use super() and would like to
point at some real-world Python examples of cooperative multiple
inheritance.

Google searches take me to old papers for C++ and Eiffel, but that
don't seem to be relevant to most Python programmers (i.e. a
WalkingMenu example where a submenu is both a Entry in a Menu and a
Menu itself).  Another published example is in a graphic library where
some widgets inherit GraphicalFeature methods such as location, size
and NestingGroupingFeatures such as finding parents, siblings, and
children.  I don't find either of those examples compelling because
there is no particular reason that they would have to have overlapping
method names.

So far, the only situation I can find where method names necessarily
overlap is for the basics like __init__(), close(), flush(), and
save() where multiple parents need to have their own initialization
and finalization.

If you guys know of good examples, I would appreciate a link or a
recap.

Thanks,


Raymond



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


How to start a windows application minimized (or hidden)

2010-11-29 Thread klausfpga
Hi,

I'd like to start a windows application minimized


As an example I used
calc.exe

what I tried was using the startupinfo field of subprocess.Popen
though I'm not sure, that 'hidden' is really the same as minimized.

st_info = subprocess.STARTUPINFO()
st_info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
st_info.wShowWindow = subprocess.SW_HIDE
proc = Popen( [ cmd.exe ], startupinfo = st_info)





I also tried creating a shortut of calc on my desktop and setting it
to
'start minimized'

if I click on the shortcut, then calc.exe shows up as a visible window

What am I doing wrong/

Thanks in advance for any ideas


somehow I do not see, that
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you find out what's happening in a process?

2010-11-29 Thread Ulrich Eckhardt
Leo Jay wrote:
 I'd like to know how do you guys find out what's happening in your
 code if the process seems not work.
 In java, I will use jstack pid to check stacks of threads and lock
 status. But I don't know how to do it in python.

import pdb
pdb.set_trace()

Generally, searching python debugger howto should turn up a few useful
results. ;)

Uli

-- 
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

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


Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-29 Thread Giampaolo Rodolà
2010/11/24 Raymond Hettinger pyt...@rcn.com:
 I'm writing-up more guidance on how to use super() and would like to
 point at some real-world Python examples of cooperative multiple
 inheritance.

 Google searches take me to old papers for C++ and Eiffel, but that
 don't seem to be relevant to most Python programmers (i.e. a
 WalkingMenu example where a submenu is both a Entry in a Menu and a
 Menu itself).  Another published example is in a graphic library where
 some widgets inherit GraphicalFeature methods such as location, size
 and NestingGroupingFeatures such as finding parents, siblings, and
 children.  I don't find either of those examples compelling because
 there is no particular reason that they would have to have overlapping
 method names.

 So far, the only situation I can find where method names necessarily
 overlap is for the basics like __init__(), close(), flush(), and
 save() where multiple parents need to have their own initialization
 and finalization.

 If you guys know of good examples, I would appreciate a link or a
 recap.

 Thanks,


 Raymond

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


In pyftpdlib I used multiple inheritance to implement FTP over SSL:
http://code.google.com/p/pyftpdlib/source/browse/tags/release-0.5.2/demo/tls_ftpd.py#125

I can't say it's been natural/intuitive though, and it took me a while
to make it work properly.
super() is one of the few things in Python I really don't understand properly.


--- Giampaolo
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Parsing markup.

2010-11-29 Thread Joe Goldthwaite
Hi MRAB,

I was trying to avoid regex because my poor old brain has trouble with it. I
have to admin though, that line is slick!  I'll have to go through my regex
documentation to try and figure out what it actually means.

Thanks!

-Original Message-
From: python-list-bounces+joe=goldthwaites@python.org
[mailto:python-list-bounces+joe=goldthwaites@python.org] On Behalf Of
MRAB
Sent: Thursday, November 25, 2010 9:03 PM
To: python-list@python.org
Subject: Re: Parsing markup.

On 26/11/2010 03:28, Joe Goldthwaite wrote:
  I'm attempting to parse some basic tagged markup.  The output of the
  TinyMCE editor returns a string that looks something like this;
 
  pThis is a paragraph with bbold/b and iitalic/i elements in
  it/ppIt can be made up of multiple lines separated by pagagraph
  tags./p
 
  I'm trying to render the paragraph into a bit mapped image.  I need
  to parse it out into the various paragraph and bold/italic pieces.
  I'm not sure the best way to approach it.  Elementree and lxml seem
  to want a full formatted page, not a small segment like this one.
  When I tried to feed a line similar to the above to lxml I got an
  error; XMLSyntaxError: Extra content at the end of the document.
 
I'd probably use a regex:

  import re
  text = pThis is a paragraph with bbold/b and iitalic/i 
elements in it/ppIt can be made up of multiple lines separated by 
pagagraph tags./p
  re.findall(r/?\w+|[^]+, text)
['p', 'This is a paragraph with ', 'b', 'bold', '/b', ' and ', 
'i', 'italic', '/i', ' elements in it', '/p', 'p', 'It can be 
made up of multiple lines separated by pagagraph tags.', '/p']
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Re: Parsing markup.

2010-11-29 Thread Stefan Behnel

Jon Clements, 26.11.2010 13:58:

On Nov 26, 4:03 am, MRABpyt...@mrabarnett.plus.com  wrote:

On 26/11/2010 03:28, Joe Goldthwaite wrote:
I’m attempting to parse some basic tagged markup.  The output of the
TinyMCE editor returns a string that looks something like this;
  
pThis is a paragraph withbbold/b  andiitalic/i  elements in
it/ppIt can be made up of multiple lines separated by pagagraph
tags./p
  
I’m trying to render the paragraph into a bit mapped image.  I need
to parse it out into the various paragraph and bold/italic pieces.
I’m not sure the best way to approach it.  Elementree and lxml seem
to want a full formatted page, not a small segment like this one.
When I tried to feed a line similar to the above to lxml I got an
error; “XMLSyntaxError: Extra content at the end of the document”.


This exception indicates that the OP is using the XML parser.



lxml works fine for me - have you tried:

from lxml import html
text = pThis is a paragraph withbbold/b  andiitalic/i
elements in it/ppIt can be made up of multiple lines separated by
pagagraph tags./p
tree = html.fromstring(text)
print tree.findall('p')
# should print [Element p at 2b7b458,Element p at 2b7b3e8]


Yep, either use lxml.etree's HTML parser or lxml.html.

Stefan

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


Re: How do you find out what's happening in a process?

2010-11-29 Thread Michele Simionato
On Nov 29, 7:01 am, Leo Jay python.leo...@gmail.com wrote:
 Hi all,

 I'd like to know how do you guys find out what's happening in your
 code if the process seems not work.
 In java, I will use jstack pid to check stacks of threads and lock status.
 But I don't know how to do it in python.

 --
 Best Regards,
 Leo Jay

If you give a CTRL-C the Python process will die with a traceback
showing the line where the process
got stuck (assuming you started it from the command-line). You can
even run the script under the debugger and give a CTRL-C after a
while, as follows:

$ python -m pdb thescript.py
(Pdb) c
wait a bit ...
CTRL-C
Traceback ...
 ...
(Pdb) inspect the variables and continue if you like
-- 
http://mail.python.org/mailman/listinfo/python-list


sqlite autoincrement of primary key

2010-11-29 Thread tinauser
Dear List
I'm writing an application that has to create and populate an SQLite
database.
I'm doing pretty well, but now I'm facing a problem I can not solve.

I create a table with a primary key autoincrement, something like

sqlcmd=CREATE TABLE foo (id INTEGER PRIMARY KEY AUTOINCREMENT, name
TEXT)
cur.execute(sqlcmd)

Now comes the time of populating the database.
I perfectly know that if I do something like:

sqlcmd=INSERT INTO foo (name) VALUES (?))
cur.execute(sqlcmd, ('xxx',))
The table will automatically insert the value of id.


However, for readibility problem, I need to use the sqlite insert
command giving all the entries. I want, however, to let sqlite to
handle the primary key.
Normally, the sqlite command that works would be

INSERT INTO 'foo' VALUES (NULL, 'yyy' )

however, if in python i try to execute a script like:

cur.execute(
'''
INSERT INTO 'foo' VALUES (?,?)
'''
,('NULL','yyy'))

I get a datatype mismatch error.

Has anyone a workaround ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread Mel
tinauser wrote:

 Normally, the sqlite command that works would be
 
 INSERT INTO 'foo' VALUES (NULL, 'yyy' )
 
 however, if in python i try to execute a script like:
 
 cur.execute(
 '''
 INSERT INTO 'foo' VALUES (?,?)
 '''
 ,('NULL','yyy'))
 
 I get a datatype mismatch error.
 
 Has anyone a workaround ?

Have you tried 

'''INSERT INTO foo VALUES (NULL, ?)'''

Mel.

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


Re: sqlite autoincrement of primary key

2010-11-29 Thread John Bokma
tinauser tinau...@libero.it writes:

 however, if in python i try to execute a script like:

 cur.execute(
 '''
 INSERT INTO 'foo' VALUES (?,?)
 '''
 ,('NULL','yyy'))

,(None, 'yyy'))

Or use VALUES(NULL, ?)

as suggested in another post.


-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, tinauser tinau...@libero.it wrote:
 '''
 INSERT INTO 'foo' VALUES (?,?)
 '''
 ,('NULL','yyy'))

s/'NULL'/None/

 I get a datatype mismatch error.

The sqlite module is smart enough to convert between Python types and
Sqlite types.  If you pass it 'NULL' it thinks you are passing it a string.
Python uses None in much the same way that databases use NULL, so the
module converts None to 'NULL' and vise versa.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread D'Arcy J.M. Cain
On Mon, 29 Nov 2010 13:19:19 -0500
Mel mwil...@the-wire.com wrote:
 tinauser wrote:
 '''INSERT INTO foo VALUES (NULL, ?)'''

Does this work in SQLite:

  INSERT INTO foo (name) VALUES ('xxx')

That's the standard SQL way.

-- 
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Strategies for unit testing an HTTP server.

2010-11-29 Thread Alice Bevan–McGregor

Hello!

Two things are missing from the web server I've been developing before 
I can release 1.0: unit tests and documentation.  Documentation being 
entirely my problem, I've run into a bit of a snag with unit testing; 
just how would you go about it?


Specifically, I need to test things like HTTP/1.0 request/response 
cycles, HTTP/1.0 keep-alives, HTTP/1.1 pipelined reuqest/response 
cycles, HTTP/1.1 connection: close, HTTP/1.1 chunked 
requests/responses, etc.


What is the recommended / best way to test a daemon in Python?  (Note 
that some of the tests need to keep the client socket open.)  Is 
there an easy way to run a daemon in another thread, then kill it after 
running some tests across it?


Even better, are there any dedicated (Python or non-Python) HTTP/1.1 
compliance testing suites?


Thank you for any assistance,

— Alice.


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


Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain da...@druid.net wrote:
 On Mon, 29 Nov 2010 13:19:19 -0500
 Mel mwil...@the-wire.com wrote:
 tinauser wrote:
 '''INSERT INTO foo VALUES (NULL, ?)'''

 Does this work in SQLite:

   INSERT INTO foo (name) VALUES ('xxx')

 That's the standard SQL way.

Yes, it works; but, the OP asked specifically to be able to enter all of
the field values, including the autoincrement field.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread tinauser
On Nov 29, 7:28 pm, Tim Harig user...@ilthio.net wrote:
 On 2010-11-29, tinauser tinau...@libero.it wrote:

  '''
  INSERT INTO 'foo' VALUES (?,?)
  '''
  ,('NULL','yyy'))

 s/'NULL'/None/

  I get a datatype mismatch error.

 The sqlite module is smart enough to convert between Python types and
 Sqlite types.  If you pass it 'NULL' it thinks you are passing it a string.
 Python uses None in much the same way that databases use NULL, so the
 module converts None to 'NULL' and vise versa.

Thanks all of you for the fast answers!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help required with Tranformation of coordinate system

2010-11-29 Thread Terry Reedy

On 11/29/2010 1:55 AM, BansalMaddy wrote:

On Nov 29, 2:03 am, Terry Reedytjre...@udel.edu  wrote:

On 11/28/2010 6:36 PM, BansalMaddy wrote:


hi all!
i need a help in python! i am struggling to implement this since last
2/3 days. suppose i have a 2D plot (say y=x**2).
now on the same plot i want to transform my origin of coordinate
system to a point (x',y' on this curve and again create a new plot
with origin at x',y')
can somebody help me how can i offset my cordinate system ...


Plot y-y' == (x-x')**2 - y' against x-x'.

--
Terry Jan Reedy


Thanks for the reply, but i was looking for some built in function to
offset coordinate system, because my problem is not very simple as i
mentioned in my query, actually i need to plot some kind of closed
loops.
e..g
1. curve will be y=f(x) then i have to search for a point on y=f(x)
curve and i have to plot another function y'=f(x'), where x' and y'
are (-2x) and (-2y) repectively.
2. then again i hve to search for a pont on y'=f(x') and do some third
kind of operations, on that.
in that case if can shift my coordinate system to desired location on
curve the computation becomes simpler.

THanks again, hope i made myself clear :)


You would have to look at the docs for particular third-party plotting 
libraries, such as you might find on PyPI.


--
Terry Jan Reedy

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


Re: Python 2.7.1

2010-11-29 Thread Terry Reedy

On 11/29/2010 6:51 AM, Kent Johnson wrote:

On Nov 27, 11:33 pm, Benjamin Petersonbenja...@python.org  wrote:

On behalf of the Python development team, I'm happy as a clam to announce the
immediate availability of Python 2.7.1.


Will there be Mac binaries for 2.7.1 and 3.1.3? Currently the web site
shows only source and Windows binaries.


I presume yes. Mac binaries typically trail each release. They are done 
by a different volunteer.


--
Terry Jan Reedy

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


Re: sqlite autoincrement of primary key

2010-11-29 Thread Alan Meyer

On 11/29/2010 1:12 PM, tinauser wrote:

Dear List
I'm writing an application that has to create and populate an SQLite
database.
I'm doing pretty well, but now I'm facing a problem I can not solve.

I create a table with a primary key autoincrement, something like

sqlcmd=CREATE TABLE foo (id INTEGER PRIMARY KEY AUTOINCREMENT, name
TEXT)
cur.execute(sqlcmd)

Now comes the time of populating the database.
I perfectly know that if I do something like:

sqlcmd=INSERT INTO foo (name) VALUES (?))
cur.execute(sqlcmd, ('xxx',))
The table will automatically insert the value of id.


However, for readibility problem, I need to use the sqlite insert
command giving all the entries. I want, however, to let sqlite to
handle the primary key.
Normally, the sqlite command that works would be

INSERT INTO 'foo' VALUES (NULL, 'yyy' )

however, if in python i try to execute a script like:

cur.execute(
'''
INSERT INTO 'foo' VALUES (?,?)
'''
,('NULL','yyy'))

I get a datatype mismatch error.

Has anyone a workaround ?


There are two red flags popping up for me here.

The first is your switch from:

   INSERT INTO foo ...
to
   INSERT INTO 'foo' ...

I don't know sqllite, however, quotes around the foo is not standard SQL 
and should cause an error.  datatype mismatch is not exactly the 
message I'd expect, but it could be appropriate.


The second red flag is your desire to increase readability by inserting 
something into an auto-increment field.  That might just confuse me if I 
were reading it and knew that NULL (or None) is an invalid and 
inappropriate value for that column.  To me at least, readability is 
reduced by that, not increased.  I'm a little surprised that sqllite 
would accept it no matter how you did it.


You could do something like this:

   INSERT INTO foo (name) VALUES ('whatever')

as another poster suggested.  That seems to me more readable than 
leaving out the column name list but including an auto-increment field 
in the values list.  It gives more, and more valid, information to the 
programmer who reads your code.


Alan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Use company name for module

2010-11-29 Thread Chris Withers

On 12/11/2010 15:50, Robert Kern wrote:

On 11/12/10 8:12 AM, Micah Carrick wrote:

My company is working on releasing some of our code as open-source python
modules. I don't want my foo module conflicting with other modules
called
foo on PyPi or github or a user's system. Is there anything wrong,
from a
conventions standpoint, with having modules like company.foo and
company.bar
even if foo and bar are not necessarily related other than being
released by us?
I really don't like the cryptic module names or things like foo2 and
the like.


Yes, using namespace packages. You need to use `distribute` in your
setup.py in order to accomplish this.

http://pypi.python.org/pypi/distribute/
http://packages.python.org/distribute/setuptools.html#namespace-packages


...or setuptools.

...or just pick a different naming scheme, the Pyramid guys have gone for:

company_foo

...and I'm inclined to do the same.

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
   - http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list


Re: Use company name for module

2010-11-29 Thread JKPeck
On Nov 29, 1:41 pm, Chris Withers ch...@simplistix.co.uk wrote:
 On 12/11/2010 15:50, Robert Kern wrote:



  On 11/12/10 8:12 AM, Micah Carrick wrote:
  My company is working on releasing some of our code as open-source python
  modules. I don't want my foo module conflicting with other modules
  called
  foo on PyPi or github or a user's system. Is there anything wrong,
  from a
  conventions standpoint, with having modules like company.foo and
  company.bar
  even if foo and bar are not necessarily related other than being
  released by us?
  I really don't like the cryptic module names or things like foo2 and
  the like.

  Yes, using namespace packages. You need to use `distribute` in your
  setup.py in order to accomplish this.

 http://pypi.python.org/pypi/distribute/
 http://packages.python.org/distribute/setuptools.html#namespace-packages

 ...or setuptools.

 ...or just pick a different naming scheme, the Pyramid guys have gone for:

 company_foo

 ...and I'm inclined to do the same.

 Chris

 --
 Simplistix - Content Management, Batch Processing  Python Consulting
             -http://www.simplistix.co.uk

You might want to check with your company legal folks before adopting
a naming rule
base on the company name.  Some companies whose names are trademarked
will not allow their name to be used in
certain contexts, possibly including this.

(I am not a lawyer!)
-- 
http://mail.python.org/mailman/listinfo/python-list


Reading lines of null-terminated text?

2010-11-29 Thread Dan Stromberg
What's the best way of reading lines of null terminated (ASCII NUL, \0) text
in Python 2.x?  How about for 3.x?

I've been using http://stromberg.dnsalias.org/~strombrg/readline0.html with
2.x, but I'm moving some of my stuff to 3.x, and am wondering if there's a
way that would obviate readline0.

TIA!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread D'Arcy J.M. Cain
On Mon, 29 Nov 2010 19:11:18 + (UTC)
Tim Harig user...@ilthio.net wrote:
INSERT INTO foo (name) VALUES ('xxx')
 
  That's the standard SQL way.
 
 Yes, it works; but, the OP asked specifically to be able to enter all of
 the field values, including the autoincrement field.

You're right, I missed that.  However reading the OP's message I am
still confused.  How does removing the field name and adding a
positional NULL or None improve readability.  I now wonder if it was
more of an assignment requirement rather than a real one.

-- 
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread Tim Harig
On 2010-11-29, D'Arcy J.M. Cain da...@druid.net wrote:
 On Mon, 29 Nov 2010 19:11:18 + (UTC)
 Tim Harig user...@ilthio.net wrote:
INSERT INTO foo (name) VALUES ('xxx')
 
  That's the standard SQL way.
 
 Yes, it works; but, the OP asked specifically to be able to enter all of
 the field values, including the autoincrement field.

 You're right, I missed that.  However reading the OP's message I am
 still confused.  How does removing the field name and adding a
 positional NULL or None improve readability.  I now wonder if it was
 more of an assignment requirement rather than a real one.

That, I don't know.  I would agree that it seems like a mis-guided
approach; but, it is what he asked for.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help required with Tranformation of coordinate system

2010-11-29 Thread BansalMaddy
On Nov 29, 8:33 pm, Terry Reedy tjre...@udel.edu wrote:
 On 11/29/2010 1:55 AM, BansalMaddy wrote:



  On Nov 29, 2:03 am, Terry Reedytjre...@udel.edu  wrote:
  On 11/28/2010 6:36 PM, BansalMaddy wrote:

  hi all!
  i need a help in python! i am struggling to implement this since last
  2/3 days. suppose i have a 2D plot (say y=x**2).
  now on the same plot i want to transform my origin of coordinate
  system to a point (x',y' on this curve and again create a new plot
  with origin at x',y')
  can somebody help me how can i offset my cordinate system ...

  Plot y-y' == (x-x')**2 - y' against x-x'.

  --
  Terry Jan Reedy

  Thanks for the reply, but i was looking for some built in function to
  offset coordinate system, because my problem is not very simple as i
  mentioned in my query, actually i need to plot some kind of closed
  loops.
  e..g
  1. curve will be y=f(x) then i have to search for a point on y=f(x)
  curve and i have to plot another function y'=f(x'), where x' and y'
  are (-2x) and (-2y) repectively.
  2. then again i hve to search for a pont on y'=f(x') and do some third
  kind of operations, on that.
  in that case if can shift my coordinate system to desired location on
  curve the computation becomes simpler.

  THanks again, hope i made myself clear :)

 You would have to look at the docs for particular third-party plotting
 libraries, such as you might find on PyPI.

 --
 Terry Jan Reedy

OK thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite autoincrement of primary key

2010-11-29 Thread tinauser
On Nov 29, 10:49 pm, D'Arcy J.M. Cain da...@druid.net wrote:
 On Mon, 29 Nov 2010 19:11:18 + (UTC)

 Tim Harig user...@ilthio.net wrote:
     INSERT INTO foo (name) VALUES ('xxx')

   That's the standard SQL way.

  Yes, it works; but, the OP asked specifically to be able to enter all of
  the field values, including the autoincrement field.

 You're right, I missed that.  However reading the OP's message I am
 still confused.  How does removing the field name and adding a
 positional NULL or None improve readability.  I now wonder if it was
 more of an assignment requirement rather than a real one.

 --
 D'Arcy J.M. Cain da...@druid.net         |  Democracy is three 
 wolveshttp://www.druid.net/darcy/               |  and a sheep voting on
 +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


Was not an assignment.
I created a general table class and several specific tables.
The application I'm going to write is going to be used by scientist
that might not have a strong computational background, but they might
be willing of adding some new tables. Their code knowledge might be so
low that they might not go further a copy-paste.
The way I defined the table, they just have to create lists indicating
the name of the columns, their content and eventually some initial
values for instance.
self.colNames= [ 'id',   'name' ,   'surname',
'age']
self.colType   = [INTEGER, TEXT ,TEXT  , INTEGER]
self.init.append([   None,  'john'  ,  'Lennon'   ,
'51'   ])
i.e. the code has to resable the structure of the table and be easily
copy and paste (this last thing makes this system better than,
instead, using python dictionary...also because the future user might
not be familiar at all with dictionary).I might think of doing an
automatic substitution of the primarykey with None, that is not a
problem

Anyhow, as said, thanks for all the answers, you solved my question

Regards
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-29 Thread Gregory Ewing

Paul Rubin wrote:


The classic example though is a window system, where you have a window
class, and a scroll bar class, and a drop-down menu class, etc. and
if you want a window with a scroll bar and a drop-down menu, you inherit
from all three of those classes.


Not in any GUI library I've ever seen. Normally there would
be three objects involved in such an arrangement, a Window,
a ScrollBar and a DropDownMenu, connected to each other in
some way.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Arrays

2010-11-29 Thread Garland Fulton
At the top of the last post I didn't understand how I was supposed to have
my e mail headers or my quotes formatted.

I also would like to change the header to my e mail thread. To LIST NOT
ARRAY

I appolpgize and thank you for clearing up my thinking. I just got  done
with a java class and I should have paid more attention.

Now that I went back and reviewed.

array[]// in java
Is not the same as
list[]   // in python.

I will go back and try my way again.

I have a list of objects built to form numbers given to me already. I would
like to take the list apart iterate over each component and replace it with
the corresponding number, and put it back together again everytime I call
that number(str object) to be printed from my list.

To clear my goals up I don't want to be a bad to this e mail list.

Thank you,

Slie
On Nov 25, 2010 8:43 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Thu, 25 Nov 2010 14:32:57 -0900, Slie stacks...@gmail.com declaimed
 the following in gmane.comp.python.general:

 I have an exercise im working on.
 I have an array of strings, and I would like to take each peace of the
array and assign it to a new array so I can iterate over each of those
pieces and replace the sting I want then put it back together.

 I hope that is not too confusing. This is how im trying to solve the
problem.

 I have a program that takes in integers and it prints out the integers in
bigger ones made up of asterisks. Im supposed to alter the program so so
that instead of asterisks it prints them in bigger ones made up of the
number itself.

 I am given arrays built to look like the numbers, already.

 {Note: this newsgroup/list prefers the trim and follow method of
 quoting; persist ant top-posting will earn the ire of the readers}

 We still have the problem that you are referring to arrays which
 are NOT native data types in Python... There is an importable module for
 arrays, and most of the numerics packages (a la numpy) define arrays,
 but Python itself has dynamically sized lists (and lists of lists...
 to add additional dimensions).

 Off-hand, it sounds like you are just substituting a list-of-lists
 (of strings) of asterisks with a list-of-lists containing characters of
 each digit...

 Now which part are you having problems with? Extracting the digits
 from the input number, indexing into the list of digit data, indexing
 into the row of digit data, collecting the data into one output
 structure?

 I'm probably giving away too much here but using just 0/1 and input
 as a string...

 -=-=-=-=-=-

 digits = [ [  000 ,
 0 0,
 0 0,
 0 0,
 0 0,
  000  ],
 [  1 ,
  11 ,
  1 ,
  1 ,
  1 ,
  111  ] ]

 output = []

 DATA = 01101

 for row in range(6):
 rowparts = []
 for d in DATA:
 dint = int(d, 10)
 rowparts.append(digits[dint][row])
 output.append( .join(rowparts))

 print output
 print

 for rout in output:
 print rout
 -=-=-=-=-=-=- (use fixed width font to view)
 [' 000 1 1 000 1 ', '0 0 11 11 0 0 11
 ', '0 0 1 1 0 0 1 ', '0 0 1 1 0 0 1
 ', '0 0 1 1 0 0 1 ', ' 000 111 111 000 111
 ']

 000 1 1 000 1
 0 0 11 11 0 0 11
 0 0 1 1 0 0 1
 0 0 1 1 0 0 1
 0 0 1 1 0 0 1
 000 111 111 000 111

 --
 Wulfraed Dennis Lee Bieber AF6VN
 wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

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


Re: Python 2.7.1

2010-11-29 Thread Spider
 2.7 includes many features that were first released in Python 3.1. The faster 
 io module ...

I understand that I/O in Python 3.0 was slower than 2.x (due to quite
a lot of the code being in Python rather than C, I gather), and that
this was fixed up in 3.1. So, io in 3.1 is faster than in 3.0.

Is it also true that io is faster in 2.7 than 2.6? That's what the
release notes imply, but I wonder whether that comment has been back-
ported from the 3.1 release notes, and doesn't actually apply to 2.7.

Of course, I probably should benchmark it, but if someone who knows
the history of the io module can respond, that would be great. My
specific interest is in file read/write speeds.

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading lines of null-terminated text?

2010-11-29 Thread MRAB

On 29/11/2010 21:44, Dan Stromberg wrote:


What's the best way of reading lines of null terminated (ASCII NUL, \0)
text in Python 2.x?  How about for 3.x?

I've been using http://stromberg.dnsalias.org/~strombrg/readline0.html
with 2.x, but I'm moving some of my stuff to 3.x, and am wondering if
there's a way that would obviate readline0.


You could read as binary data and then split on b\x00.

In Python 3 it's possible to specify the newline character, but I've
found that it won't accept the null character as newline. I don't know
why. :-(
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading lines of null-terminated text?

2010-11-29 Thread Ian Kelly
On Mon, Nov 29, 2010 at 4:17 PM, MRAB pyt...@mrabarnett.plus.com wrote:
 In Python 3 it's possible to specify the newline character, but I've
 found that it won't accept the null character as newline. I don't know
 why. :-(

Because it isn't a legal value.

newline controls how universal newlines works (it only applies to
text mode). It can be None, '', '\n', '\r', and '\r\n'.

Why it was designed that way, I don't know.  Maybe to avoid scenarios
where the selected newline has more than one representation in the
selected encoding.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing markup.

2010-11-29 Thread Alan Meyer

On 11/29/2010 11:20 AM, Joe Goldthwaite wrote:

Hi MRAB,

I was trying to avoid regex because my poor old brain has trouble with it. I
have to admin though, that line is slick!  I'll have to go through my regex
documentation to try and figure out what it actually means.


Personally, I'd be hesitant to use a regex.  It can be done and I've 
done it myself on occasion when I had a simple job to do and a very, 
very, very well defined target.


The problem with using regular expressions is that there is are many 
variations in the text of valid XML.  There can be namespaces, 
attributes, newlines in surprising places, unexpected character 
encodings, alternative quoting styles (e.g. id='123' or id = 123), 
character entities (lt;) and possibly other things that I haven't 
thought of.


The parser authors have thought of those things and written parsing code 
that works properly on legal XML, even in these surprising cases that 
rarely show up in your data but can.  You might think there won't ever 
be any surprises that break your regexes, but then some new programmer 
appears on the project and thinks, Aha, this is XML, I can solve my 
problem by adding a new attribute to that 'p' tag.  He will be tearing 
his hair and muttering sentences that happen to have your name in them 
when he discovers that his perfectly legal XML content won't parse 
correctly in your regex based parser.  The muttering will get much 
louder if he only discovers this after much data has been processed and 
important items silently skipped over by the parser.


Alan
--
http://mail.python.org/mailman/listinfo/python-list


Re: TDD in python

2010-11-29 Thread rustom
On Nov 29, 4:59 pm, André andre.robe...@gmail.com wrote:
 On Nov 29, 7:31 am, rustom rustompm...@gmail.com wrote:



  On Nov 28, 7:52 pm, Stefan Behnel stefan...@behnel.de wrote:

   Rustom Mody, 28.11.2010 11:58:

Does anyone know of something like this for python?

   http://www.vimeo.com/13240481

   The page seems to require a recent version of the Flash player. Could you
   describe what exactly you are looking for?

   Stefan

  Well most modern languages have TDD frameworks.
  However TDD is learnt by doing and not from books (like swimming/
  cycling).
  This screencast gives a detailed demo of *doing it* in eclipse/C++
  I was hoping for something similar for python

 Go to showmedo.com and do a search for python tdd; you'll find many
 such screencasts.

 André

Looking around I found this:
http://bytes.com/topic/python/answers/43330-unittest-vs-py-test
where Raymond Hettinger no less says quite unequivocally that he
prefers test.py to builtin unittest
because it is not so heavy-weight

Is this the general consensus nowadays among pythonistas?
[Note I tend to agree but Ive no experience so asking]
-- 
http://mail.python.org/mailman/listinfo/python-list


regular expression help

2010-11-29 Thread goldtech
Hi,

say:
 import re
 m=cccvlvlvlvnnnflfllffccclfnnnooo
 re.compile(r'ccc.*nnn')
 rtt=.sub(||,m)
 rtt
'||ooo'

The regex is eating up too much. What I want is every non-overlapping
occurrence I think.

so rtt would be:

'||flfllff||ooo'

just like findall acts but in this case I want sub to act like that.

Thanks

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


Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-29 Thread Dan Stromberg
I've got a couple of programs that read filenames from stdin, and then
open those files and do things with them.  These programs sort of do
the *ix xargs thing, without requiring xargs.

In Python 2, these work well.  Irrespective of how filenames are
encoded, things are opened OK, because it's all just a stream of
single byte characters.

In Python 3, I'm finding that I have encoding issues with characters
with their high bit set.  Things are fine with strictly ASCII
filenames.  With high-bit-set characters, even if I change stdin's
encoding with:

      import io
      STDIN = io.open(sys.stdin.fileno(), 'r', encoding='ISO-8859-1')

...even with that, when I read a filename from stdin with a
single-character Spanish n~, the program cannot open that filename
because the n~ is apparently internally converted to two bytes, but
remains one byte in the filesystem.  I decided to try ISO-8859-1 with
Python 3, because I have a Java program that encountered a similar
problem until I used en_US.ISO-8859-1 in an environment variable to
set the JVM's encoding for stdin.

Python 2 shows the n~ as 0xf1 in an os.listdir('.').  Python 3 with an
encoding of ISO-8859-1 wants it to be 0xc3 followed by 0xb1.

Does anyone know what I need to do to read filenames from stdin with
Python 3.1 and subsequently open them, when some of those filenames
include characters with their high bit set?

TIA!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regular expression help

2010-11-29 Thread Yingjie Lan
--- On Tue, 11/30/10, goldtech goldt...@worldpost.com wrote:

 From: goldtech goldt...@worldpost.com
 Subject: regular expression help
 To: python-list@python.org
 Date: Tuesday, November 30, 2010, 9:17 AM
 The regex is eating up too much. What I want is every
 non-overlapping
 occurrence I think.
 
 so rtt would be:
 
 '||flfllff||ooo'
 

Hi, I'll just let Python do most of the talk here.

 import re
 m=cccvlvlvlvnnnflfllffccclfnnnooo
 p=re.compile(r'ccc.*?nnn')
 p.sub(||, m)
'||flfllff||ooo'

Cheers,

Yingjie


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


Re: regular expression help

2010-11-29 Thread Tim Harig
On 2010-11-30, goldtech goldt...@worldpost.com wrote:
 Hi,

 say:
 import re
 m=cccvlvlvlvnnnflfllffccclfnnnooo
 re.compile(r'ccc.*nnn')
 rtt=.sub(||,m)
 rtt
 '||ooo'

 The regex is eating up too much. What I want is every non-overlapping
 occurrence I think.

 so rtt would be:

 '||flfllff||ooo'

Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import re
 m=cccvlvlvlvnnnflfllffccclfnnnooo
 pattern = re.compile(r'ccc[^n]*nnn')
 pattern.sub(||, m)
'||flfllff||ooo'

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


Re: regular expression help

2010-11-29 Thread Tim Harig
Python 3.1.2 (r312:79147, Oct  9 2010, 00:16:06)
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import re
 m=cccvlvlvlvnnnflfllffccclfnnnooo
 pattern = re.compile(r'ccc[^n]*nnn')
 pattern.sub(||, m)
'||flfllff||ooo'
 # or, assuming that the middle sequence might contain singular or
 # double 'n's
 pattern = re.compile(r'ccc.*?nnn')
 pattern.sub(||, m)
'||flfllff||ooo'

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


Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-29 Thread Yingjie Lan
--- On Tue, 11/30/10, Dan Stromberg drsali...@gmail.com wrote:
 In Python 3, I'm finding that I have encoding issues with
 characters
 with their high bit set.  Things are fine with strictly
 ASCII
 filenames.  With high-bit-set characters, even if I
 change stdin's
 encoding with:

Co-ask. I have also had problems with file names in
Chinese characters with Python 3. I unzipped the 
turtle demo files into the desktop folder (of
course, the word 'desktop' is in Chinese, it is
a windows XP system, localization is Chinese), then
all in a sudden some of the demos won't work
anymore. But if I move it to a folder whose 
path contains only english characters, everything
comes back to normal.

Another related issue on the same platform is this: 
if you have your source file in the chinese 'desktop'
folder, and when you run the code and got some 
exceptions, the path information printed out
by the tracer wrongly encoded the chinese name 
for 'desktop'.

Yingjie



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


[ANNOUNCE] Twisted 10.2.0 Released

2010-11-29 Thread Glyph Lefkowitz
Twisted 10.2.0, the third Twisted release of 2010, has emerged from the 
mysterious depths of Twisted Matrix Labs, as so many releases before it.  
Survivors of the release process - what few there were of them - have been 
heard to claim that this version is awesome, even more robust, fun-sized 
and oven fresh.

Crossing several things that shouldn't ought to be, including the streams and 
the rubicon, I have assumed the triple responsibilities of feature author, 
project leader, *and* release manager for 10.2: with this dark and terrible 
power - a power which no man ought to wield alone - I have wrought a release 
which contains many exciting new features, including:

- A plug-in API for adding new types of endpoint descriptions. 
http://tm.tl/4695
- A new, simpler, substantially more robust CoreFoundation reactor.  
http://tm.tl/1833
- Improvements to the implementation of Deferred which should both improve 
performance
  and fix certain runtime errors with long callback chains. 
http://tm.tl/411
- Deferred.setTimeout is (finally) gone.  To quote the author of this 
change:
  A new era of peace has started.  http://tm.tl/1702
- NetstringReceiver is substantially faster. http://tm.tl/4378

And, of course, nearly one hundred smaller bug fixes, documentation updates, 
and general improvements.  See the NEWS file included in the release for more 
details.

Look upon our Twisted, ye mighty, and make your network applications 
event-driven: get it now, from:

http://twistedmatrix.com/

... or simply install the 'Twisted' package from PyPI.

Many thanks to Christopher Armstrong, for his work on release-automation tools 
that made this possible; to Jonathan Lange, for thoroughly documenting the 
process and thereby making my ascent to the throne of release manager possible, 
and to Jean-Paul Calderone for his tireless maintenance of our build and test 
infrastructure as well as his help with the release.

Most of all, thanks to everyone who contributed a patch, reported a bug or 
reviewed a ticket for 10.2.  Not including those already thanked, there are 41 
of you, so it would be a bit tedious to go through everyone, but you know who 
you are and we absolutely couldn't do it without you!  Thanks a ton!

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


Re: regular expression help

2010-11-29 Thread goldtech
 .*?  fixed it. Every occurrence of the pattern is now affected, which
is what I want.

Thank you very much.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue9162] License for multiprocessing files

2010-11-29 Thread Daniel Tavares

Daniel Tavares danielmtava...@gmail.com added the comment:

Replaced all entries of --- see COPYING.txt with the BSD license. See patch 
attached.

--
keywords: +patch
Added file: http://bugs.python.org/file19866/issue9162.patch

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



[issue10535] Enable warnings by default in unittest

2010-11-29 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Attached a new patch.

A few comments about it:
1) A new category for UnittestWarnings could still be added to make it easier 
to filter warnings using the -W python flags and thus providing more control;
2) I didn't change the deprecation message in the patch -- I will probably do 
it in a separate commit;
3) The patch touches a few unrelated unittest/test/test_*.py files that were 
checking for the number of args explicitely;
4) In order to test the different combinations of flags/args I created a new 
_test_warnings.py file called from test_runner.py via subprocess;
5) unittest warnings are now printed only once even when 'always' is passed as 
an arg, but not when it's set with -W (this somehow addresses the limitation 
described in my previous message);

--
Added file: http://bugs.python.org/file19867/issue10535-2.diff

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



[issue10571] setup.py upload --sign broken: TypeError: 'str' does not support the buffer interface

2010-11-29 Thread Jakub Wilk

Jakub Wilk jw...@jwilk.net added the comment:

Matthias: Nope, this one is OK.

--
assignee:  - tarek
components: +Distutils -Library (Lib)

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



[issue10570] curses.tigetstr() returns bytes, but curses.tparm() expects a string

2010-11-29 Thread Jakub Wilk

Jakub Wilk jw...@jwilk.net added the comment:

Ugh. Please disregard the first message. What I wanted to write is:

In Python 3.1.3, curses.tigetstr() returns bytes (which makes sense), but
curses.tparm() expects a Unicode string as first argument. As a consequence
even the example given in the documentation doesn't work:

 from curses import *
 setupterm()
 tparm(tigetstr(cup), 5, 3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: must be string, not bytes

--

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



[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input

2010-11-29 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

ISTM that the new name is worse than the old name.  I hadn't followed this 
issue, heard assertCountEqual the first time today, and couldn't guess what it 
does.  I'd have assumed that it checks only for equality of the number of items 
in a sequence, not for equality of the actual items.

I appreciate that it's hard finding good short names, but just because the 
implementation uses collections.Counter does not mean that Count needs to be in 
the method name :)

--
nosy: +georg.brandl

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



[issue10559] NameError in tutorial/interpreter

2010-11-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

On Sun, Nov 28, 2010 at 05:48:20AM +, Éric Araujo wrote:
 I’m not committing directly because I’d like feedback: Is the
 wording okay for the beginning of the tutorial?

It seems fine and useful. Please go ahead.

--
nosy: +orsenthil

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



[issue3243] Support iterable bodies in httplib

2010-11-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

xuanji, the issue you stumbled upon was just fixed by Raymond for the report 
Issue10565.

--

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



[issue10535] Enable warnings by default in unittest

2010-11-29 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


Removed file: http://bugs.python.org/file19867/issue10535-2.diff

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



[issue10535] Enable warnings by default in unittest

2010-11-29 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


Added file: http://bugs.python.org/file19868/issue10535-2.diff

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



[issue10557] Malformed error message from float()

2010-11-29 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Alexander Belopolsky wrote:
 
 Alexander Belopolsky belopol...@users.sourceforge.net added the comment:
 
 After a bit of svn archeology, it does appear that Arabic-Indic digits' 
 support was deliberate at least in the sense that the feature was tested for 
 when the code was first committed. See r15000.

As I mentioned on python-dev 
(http://mail.python.org/pipermail/python-dev/2010-November/106077.html)
this support was added intentionally.

 The test migrated from file to file over the last 10 years, but it is still 
 present in test_float.py:
 
 self.assertEqual(float(b  \u0663.\u0661\u0664  
 .decode('raw-unicode-escape')), 3.14)
 
 (It should probably be now rewritten using a string literal.)
 
 I am now attaching the patch (issue10557.diff) that fixes the bug without 
 sacrificing non-ASCII digit support.
 If this approach is well-received, I would like to replace all calls to 
 PyUnicode_EncodeDecimal() with the calls to the new 
 _PyUnicode_EncodeDecimalUTF8() and deprecate Latin-1-oriented 
 PyUnicode_EncodeDecimal().

It would be better to copy and iterate over the Unicode string first,
replacing any decimal code points with ASCII ones and then call the
UTF-8 encoder.

The code as it stands is very inefficient, since it will most likely
run the memcpy() part for every code point after the first non-ASCII
decimal one.

 For the future, I note that starting with Unicode 6.0.0, the Unicode 
 Consortium promises that
 
 
 Characters with the property value Numeric_Type=de (Decimal) only occur in 
 contiguous ranges of 10 characters, with ascending numeric values from 0 to 9 
 (Numeric_Value=0..9).
 
 
 This makes it very easy to check a numeric string does not contain a mix of 
 digits from different scripts.

I'm not sure why you'd want to check for such ranges.

 I still believe that proper API should require explicit choice of language or 
 locale before allowing digits other than 0-9 just as int() would not accept 
 hexadecimal digits without explicit choice of base = 16.  But this would be 
 a subject of a feature request.

Since when do we require a locale or language to be specified when
using Unicode ?

The codecs, Unicode methods and other Unicode support features
happily work with all kinds of languages, mixed or not, without any
such specification.

--

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



[issue10575] makeunicodedata.py does not support Unihan digit data

2010-11-29 Thread Marc-Andre Lemburg

New submission from Marc-Andre Lemburg m...@egenix.com:

The script only patches numeric data into the table (field 8), but does not 
update the digit field (field 7).

As a result, ideographs used for Chinese digits are not recognized as digits 
and not evaluated by int(), long() and float():

http://en.wikipedia.org/wiki/Numbers_in_Chinese_culture

 unicode('三', 'utf-8')
u'\u4e09'

 int(unicode('三', 'utf-8'))
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'decimal' codec can't encode character u'\u4e09' in 
position 0: invalid decimal Unicode string
 stdin(1)module()

 import unicodedata
 unicodedata.digit(unicode('三', 'utf-8'))
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: not a digit

The code point refers to the digit 3.

--
components: Unicode
messages: 122786
nosy: lemburg
priority: normal
severity: normal
status: open
title: makeunicodedata.py does not support Unihan digit data
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue3243] Support iterable bodies in httplib

2010-11-29 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

What a timely coincidence. I'll try out the change soon.

--

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



[issue10273] Clean-up Unittest API

2010-11-29 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Raymond - I created a new issue for moving the tests: issue 10572

However, it seems that you are incorrect in saying that Python practise is to 
avoid putting tests inside standard library packages. In fact current Python 
practise seems to be that where tests themselves are a package they are 
*always* inside the standard library package and *not* inside Lib/test. For 
example:  email, distutils, ctypes, importlib, json, lib2to3, sqlite3, tkinter, 

I couldn't see any counter-examples. There are no test packages inside Lib/test 
(other than leakers that are obviously a category of tests and not tests for a 
particular package).

--

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



[issue10566] gdb debugging support additions (Tools/gdb/libpython.py)

2010-11-29 Thread Mark Florisson

Mark Florisson markflorisso...@gmail.com added the comment:

I forgot to mention, this patch works with gdb 7.2 or higher, but it does not 
prevent using other libpython functionality with gdb 7.1 or running the tests 
with gdb 7.1.

--

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread MizardX

MizardX miza...@gmail.com added the comment:

Would if I could. But, No.

--

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



[issue10561] The pdb command 'clear bpnumber' may delete more than one breakpoint

2010-11-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Fixed in r86861. Xavier, I noticed that pdb.py itself was not calling the 
proper method. Added the tests to the patch. Thanks.

BTW, please provide patches against py3k as that is development version.

--
assignee:  - orsenthil
nosy: +orsenthil
resolution:  - fixed
stage:  - committed/rejected
versions: +Python 3.2 -Python 2.7

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



[issue10262] Add --disable-abi-flags option to `configure`

2010-11-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

I agree with the intent: package maintainers, or people compiling python for 
their own need, should have the right to choose the suffix used by extension 
modules.

I suggest another option though, one that directly sets the SOABI used in 
extension file names. This would override both the default SOABI (python3.2) 
and the flags added to it.
For example, when no flag is passed to ./configure, the default is equivalent 
to 
--soabi=cpython3.2m
And we can get the 2.x naming scheme back simply with:
--soabi=
Yes, this flag should be only used when you know what you are doing.  This 
builds a version of python that will be unable to load extensions built by 
other people.

--
nosy: +amaury.forgeotdarc

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



[issue10262] Add --disable-abi-flags option to `configure`

2010-11-29 Thread Matthias Klose

Matthias Klose d...@debian.org added the comment:

I still fail to see the rationale for being able to build with a different 
soabi name.  But anyway, as long as the default is to build with the soabi 
name, I'm +/-0 on this option.

Note that the soabi name isn't fixed but changes with other configure options.

--

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



[issue10262] Add --disable-abi-flags option to `configure`

2010-11-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

 Note that the soabi name isn't fixed but changes with other configure options.
The default value, yes.
But my proposal of a --soabi option would not respect this. The caller is 
responsible for changing the --soabi value when he adds other options.

--

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



[issue10576] Add a progress callback to gcmodule

2010-11-29 Thread Kristján Valur Jónsson

New submission from Kristján Valur Jónsson krist...@ccpgames.com:

As discussed here: 
http://mail.python.org/pipermail/python-ideas/2010-November/008813.html:

Adding the ability to register callbacks to be invoked before and after garbage 
collection runs.  This can be used to gather run-time statistics such as timing 
information and frequency of garbage collection runs, and to perform 
application-specific cleanup of uncollecatable objects from gc.garbage.

The first patch is the code as currently in use in our codebase at CCP (ported 
from 2.7).  There is only one callback registered and the callback signature is 
perhaps a bit lame.  Also, no error checking.  But it is shown here for 
reference and as a basis for discussion.

--
components: Interpreter Core
files: gccallback1.patch
keywords: patch
messages: 122795
nosy: krisvale
priority: normal
severity: normal
status: open
title: Add a progress callback to gcmodule
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file19869/gccallback1.patch

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



[issue10561] The pdb command 'clear bpnumber' may delete more than one breakpoint

2010-11-29 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

r86862 - release31-maint and r86863 - release27-maint.

--
status: open - closed
versions: +Python 2.7, Python 3.1

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



[issue10572] Move unittest test package to Lib/test

2010-11-29 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

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



[issue10566] gdb debugging support additions (Tools/gdb/libpython.py)

2010-11-29 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
assignee:  - dmalcolm
nosy: +dmalcolm

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



[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

That’s a perfectly fine reply.  Someone will see this feature request and 
propose a patch eventually.  Another way to help is to write tests, since those 
are in Python.

--

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



[issue10571] setup.py upload --sign broken: TypeError: 'str' does not support the buffer interface

2010-11-29 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
Removed message: http://bugs.python.org/msg122777

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



[issue10571] setup.py upload --sign broken: TypeError: 'str' does not support the buffer interface

2010-11-29 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
Removed message: http://bugs.python.org/msg122780

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



[issue10262] Add --disable-abi-flags option to `configure`

2010-11-29 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

+0 for Amaury's suggestion in msg122792.  Who wants to write that patch?  I'd 
happily review it.

--

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



[issue10262] Add --soabi option to `configure`

2010-11-29 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
title: Add --disable-abi-flags option to `configure` - Add --soabi option to 
`configure`

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



[issue10577] (Fancy) URL opener stucks whet try to open page

2010-11-29 Thread xhresko

New submission from xhresko juraj.hre...@gmail.com:

(Fancy) URL opener stucks whet try to open page, which is automaticaly 
forwarded. I tried url http://www.ihned.cz;, which stuck while 
http://ihned.cz; is ok. This type of behavior is different from one in the 
Python 2.7, which works ok. 

/ CODE
opener = urllib.FancyURLopener({})
f = opener.open(http://www.ihned.cz/;)
/

--
components: Library (Lib)
messages: 122799
nosy: xhresko
priority: normal
severity: normal
status: open
title: (Fancy) URL opener stucks whet try to open page
type: behavior
versions: Python 3.1

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



[issue6671] webbrowser doesn't respect xfce default browser

2010-11-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Gajim lists processes thanks to /proc, which is platform-specific; a Web search 
shows the use of pidof, to the same effect; I looked for an envvar (I use Xfce) 
and found nothing.

--
nosy: +eric.araujo
title: webbrowser.py doesn't respect xfce default browser - webbrowser doesn't 
respect xfce default browser

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



[issue10576] Add a progress callback to gcmodule

2010-11-29 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
nosy: +asvetlov

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



[issue10577] (Fancy) URL opener stuck when trying to open redirected url

2010-11-29 Thread SilentGhost

Changes by SilentGhost michael.mischurow+...@gmail.com:


--
title: (Fancy) URL opener stucks whet try to open page - (Fancy) URL opener 
stuck when trying to open redirected url

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



[issue10578] Add mock PyPI server to test distutils

2010-11-29 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

In distutils2, we have a mock PyPI server to test index-related behavior, but 
in distutils we fix such things without automated tests.  I would like to add 
the mock server to distutils.

--
assignee: tarek
components: Distutils, Tests
messages: 122801
nosy: eric.araujo, tarek
priority: normal
severity: normal
status: open
title: Add mock PyPI server to test distutils
versions: Python 2.7, Python 3.1, Python 3.2

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



[issue10571] setup.py upload --sign broken: TypeError: 'str' does not support the buffer interface

2010-11-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thank you for the report.  Do you want to propose a patch?

--
assignee: tarek - eric.araujo
stage:  - needs patch
type:  - behavior
versions: +Python 3.2

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



[issue10559] NameError in tutorial/interpreter

2010-11-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

What about:

“You need to execute ``import sys`` before you can use ``sys.argv``.”

--

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



[issue10577] (Fancy) URL opener stuck when trying to open redirected url

2010-11-29 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

@xhresko: This is not valid py3k code.

It is 302 redirect. I get the following error:

IOError: [Errno socket error] [Errno 10060] A connection attempt failed because 
the connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to respond

--
nosy: +SilentGhost

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



[issue10577] (Fancy) URL opener stuck when trying to open redirected url

2010-11-29 Thread SilentGhost

SilentGhost michael.mischurow+...@gmail.com added the comment:

@xhresko: why are you passing empty dict to the constructor? it works just fine 
with opener = urllib.request.FancyURLopener() 

resolution: invalid ?

--

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



[issue4214] no extension debug info with msvc9compiler.py

2010-11-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for explaining.  Is someone willing to add a test in test_msvc9compiler?

--
nosy: +loewis

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



  1   2   3   >