PySide Becomes a Qt Add-on

2012-03-07 Thread Matti Airas
PySide [1] has now finished migration from its previous standalone setup 
to Qt Project [2] infrastructure.


Being a Qt Add-on provides PySide a permanent home and perfect alignment 
with Qt Frameworks. Furthermore, the project gets improved visibility, 
as well as a simple, carefully thought out meritocratic project 
structure. In addition to the wiki that is already hosted by Qt, the 
PySide mailing list [3] and the bug tracker [4] are also now hosted by 
Qt. More information on the Qt Project can be found on the project web 
site [2].


The PySide project now follows Qt Project's governance model [5]. The 
Maintainer for API Extractor, Generatorrunner, and Shiboken is Marcelo 
Lira. The Maintainer for the PySide component is Hugo Parente Lima. 
Paulo Alcantara is an Approver for PySide. All other project roles are 
informal. Srini Kommoori has kindly volunteered to be the webmaster and 
wikimaster for the project.


To developers using PySide the migration is mostly transparent. PySide 
is still available under the same licensing terms, and the project 
facilities are still the mostly unchanged. Instead of having a separate 
Bugzilla instance, the PySide project now utilizes Qt's Jira bug tracker 
[4]. Also the mailing list address has changed to pys...@qt-project.org 
[3].


Qt Project uses Gerrit [6] for code reviews. Developers contributing 
code to PySide should do it using Gerrit from now on. Read-only access 
to the git source code repositories is still provided via Gitorious [7].


*About PySide*

PySide is a Python Qt bindings project initiated by Nokia. PySide 
provides access to not only the complete Qt framework but also Qt 
Mobility, as well as to generator tools for rapidly generating Python 
bindings for any

C++ libraries.

The PySide project is a Qt Add-on, sharing the same infrastructure and 
governance model as the open Qt Project itself. PySide is developed in 
the open, with all facilities you would expect from any modern open 
source project such as all code in a git repository [7], and an open bug 
tracker [4] for reporting bugs.



[1] http://www.pyside.org
[2] http://qt-project.org
[3] http://lists.qt-project.org/mailman/listinfo/pyside
[4] https://bugreports.qt-project.org
[5] http://wiki.qt-project.org/The_Qt_Governance_Model
[6] http://codereview.qt-project.org
[7] http://qt.gitorious.org/pyside

Best regards,

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

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


ANN: Yappi 0.62 released

2012-03-07 Thread Sumer Cip
Hi all,

A new version of Yappi (a thread-aware profiler for Python) has been
released: 0.62. This version's most important feature is that Yappi,
finally supports per-thread CPU time profiling.

Can be installed via easy_install, pip or from the source directly.

See:
http://code.google.com/p/yappi/

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

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


Monthly Python Meeting in Madrid (Spain)

2012-03-07 Thread Jesus Cea
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Next Thursday, 8th March.

http://www.python-madrid.es/post/reunion-marzo-2012-python-madrid/

- -- 
Jesus Cea Avion _/_/  _/_/_/_/_/_/
j...@jcea.es - http://www.jcea.es/ _/_/_/_/  _/_/_/_/  _/_/
jabber / xmpp:j...@jabber.org _/_/_/_/  _/_/_/_/_/
.  _/_/  _/_/_/_/  _/_/  _/_/
Things are not so easy  _/_/  _/_/_/_/  _/_/_/_/  _/_/
My name is Dump, Core Dump   _/_/_/_/_/_/  _/_/  _/_/
El amor es poner tu felicidad en la felicidad de otro - Leibniz
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBT1Y7SJlgi5GaxT1NAQKOmQQAmRSz5Kk1ZAE5iEBiUiB5XRKVVntPfcA1
FflzHu2ZawULVlcnLMj2mh6USzOSqrRqz5mFZA9RFQWjeN6s1wa/x8hUytUFH90t
BirdqeLjzZMoU1eyRlGggSjqR+VLDqqpxFq8aWbKDC3+t5u+UmZMjvHQo0zBGbcZ
CDcITqWR2Ds=
=e495
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: pickle/unpickle class which has changed

2012-03-07 Thread Peter Otten
Gelonida N wrote:

 Is there anyhing like a built in signature which would help to detect,
 that one tries to unpickle an object whose byte code has changed?

No. The only thing that is stored is the protocol, the format used to 
store the data.
 
 The idea is to distinguish old and new pickled data and start some
 'migration code' fi required

 The only thing, that I thought about so far was adding an explicit
 version number to each class in order to detect such situations.

If you know in advance that your class will undergo significant changes you 
may also consider storing more stable data in a file format that can easily 
be modified, e. g. json.


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


Help: how to protect the module 'sys' and 'os'

2012-03-07 Thread q q
Hi~ alls,
I have to limit somebody modify the attr of 'sys''os'? e.g. you can't
append sys.path. Someone has a good method?
now my way: modified the source code of python
,_PyObject_GenericSetAttrWithDict, because if you want to reset the
value,
you need to invoke this function.


---
best regards
pytom
-- 
http://mail.python.org/mailman/listinfo/python-list


Decoding unicode is not supported in unusual situation

2012-03-07 Thread John Nagle

I'm getting

line 79, in tounicode
return(unicode(s, errors='replace'))
TypeError: decoding Unicode is not supported

from this, under Python 2.7:

def tounicode(s) :
if type(s) == unicode :
return(s)
return(unicode(s, errors='replace'))

That would seem to be impossible.  But it's not.
s is generated from the suds SOAP client.  The documentation
for suds says:

Suds leverages python meta programming to provide an intuative API for 
consuming web services. Runtime objectification of types defined in the 
WSDL is provided without class generation.


I think that somewhere in suds, they subclass the unicode type.
That's almost too cute.

The proper test is

isinstance(s,unicode)


John Nagle


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


Re: Why this recursive import fails?

2012-03-07 Thread INADA Naoki
I found it is a bug http://bugs.python.org/issue13187
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Get tkinter text to the clipboard

2012-03-07 Thread Peter Otten
bugzilla-mail-...@yandex.ru wrote:

 How can I get something from tkinter gui to another program ?
 tkinter on python 3.2 on kde4

How about 

import tkinter
root = tkinter.Tk()

root.clipboard_clear()
root.clipboard_append(whatever)


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


Re: help: confused about python flavors....

2012-03-07 Thread Mark Lawrence

On 07/03/2012 06:24, Steven D'Aprano wrote:

On Tue, 06 Mar 2012 20:06:37 -0800, amar Singh wrote:


Hi,

I am confused between plain python, numpy, scipy, pylab, matplotlib.


Python is a programming language. It comes standard with many libraries
for doing basic mathematics, web access, email, etc.

Numpy is a library for doing scientific numerical maths work and fast
processing of numeric arrays.

Scipy is another library for scientific work. It is separate from, but
uses, Numpy.

Matplotlib is a project for making graphing and plotting of numeric data
easy in Python.

Pylab is a project to be Python's version of Matlab: it intends to be an
integrated bundle of Python the programming language, Numpy, Scipy, and
Matplotlib all in one easy-to-use application.



I have high familiarity with matlab, but the computer I use does not
have it. So moving to python.
What should I use? and the best way to use it. I will be running
matlab-like scripts sometimes on the shell prompt and sometimes on the
command line.


Pylab is intended to be the closest to Matlab, but I don't know how close
it is. Also, Pylab is NOT compatible with Matlab: its aim is to be an
alternative to Matlab, not to be a clone. So it cannot run Matlab scripts.

You might also like to look at Sage:

http://www.sagemath.org/

Sage is a Python project aimed to be an alternative to Mathematica.


Ultimately, you will have to look at the packages, see their features,
perhaps try them for a while (they are all free software, so the only
cost is your time), and decide for yourself which one meets your needs.
We can't answer that, because we don't know what you need.




Matplotlib is excellent, it has an extensive pile of docs and examples, 
and the mailing list is extremely helpful.


--
Cheers.

Mark Lawrence.

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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Diez B. Roggisch
John Nagle na...@animats.com writes:

 I think that somewhere in suds, they subclass the unicode type.
 That's almost too cute.

 The proper test is

   isinstance(s,unicode)


Woot, you finally discovered polymorphism - congratulations!

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


Re: Error importing __init__ declared variable from another package

2012-03-07 Thread Fabio Zadrozny
On Wed, Feb 29, 2012 at 1:38 AM, Jason Veldicott
jasonveldic...@gmail.com wrote:
  Hi,
 
  I have a simple configuration of modules as beneath, but an import error
  is reported:
 
  /engine
     (__init__ is empty here)
     engine.py
  /sim
     __init__.py
 
 
  The module engine.py imports a variable instantiated in sim.__init__ as
  follows:
 
     from sim import var_name
     var_name.func()
 
  The following error messaged is received on the func() call above
  (Eclipse
  PyDev):
 
  undefined variable from import: func
 Are you rephrasing or is this really the error message? If so run your
 program again on the command-line. Then please cut and paste the error
 message together with the traceback.
  Any idea why this is causing an error?
 What version of Python are you using?
 What does sim/__init__.py contain?



 Thanks Peter.

 I'm using Python 2.6, but it works at the command line.  The error only
 appears in Eclipse as a red cross in the margin.  The exact error msg, as
 appears in a floating text caption on mouse over, is as I mentioned
 (capitalised).

 Perhaps it is some issue in PyDev, maybe related to the version of Python
 I'm using.

 I'm in the process of trying to solve another related import problem, and
 wished to resolve this one in the hope that it might shed light on the
 other. But as it works beside the error icon appearing, I might just ignore
 it and spare the trouble of precise identification of cause.

Please report that as a bug in the PyDev sf tracker (please attach a
sample project where this problem can be reproduced).

Cheers,

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


Re: What's the best way to write this regular expression?

2012-03-07 Thread Paul Rubin
John Salerno johnj...@gmail.com writes:
 The Beautiful Soup 4 documentation was very clear, and BS4 itself is
 so simple and Pythonic. And best of all, since version 4 no longer
 does the parsing itself, you can choose your own parser, and it works
 with lxml, so I'll still be using lxml, but with a nice, clean overlay
 for navigating the tree structure.

I haven't used BS4 but have made good use of earlier versions.

Main thing to understand is that an awful lot of HTML in the real world
is malformed and will break an XML parser or anything that expects
syntactically invalid HTML.  People tend to write HTML that works well
enough to render decently in browsers, whose parsers therefore have to
be tolerant of bad errors.  Beautiful Soup also tries to make sense of
crappy, malformed, HTML.  Partly as a result, it's dog slow compared to
any serious XML parser.  But it works very well if you don't mind the
low speed.
-- 
http://mail.python.org/mailman/listinfo/python-list


Need help in wx.ListBox edit

2012-03-07 Thread PATIL, Praveen (LT)
Hi ,

I am using wxWidget for GUI programming.

I need help in editing text appended in wx.ListBox().  Which  wx API's  do I 
need to use ?

I would like to edit text  on mouse double click event .

Thanks in advance.

Praveen.


The information in this e-mail is confidential. The contents may not be 
disclosed or used by anyone other than the addressee. Access to this e-mail by 
anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and 
delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of 
this e-mail as it has been sent over public networks. If you have any concerns 
over the content of this message or its Accuracy or Integrity, please contact 
Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus 
scanning software but you should take whatever measures you deem to be 
appropriate to ensure that this message and any attachments are virus free.

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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Ben Finney
de...@web.de (Diez B. Roggisch) writes:

 John Nagle na...@animats.com writes:

  I think that somewhere in suds, they subclass the unicode type.
  That's almost too cute.
 
  The proper test is
 
  isinstance(s,unicode)

 Woot, you finally discovered polymorphism - congratulations!

If by “discovered” you mean “broke”.

John, polymorphism entails that it *doesn't matter* whether the object
inherits from any particular type; it only matters whether the object
behaves correctly.

So rather than testing whether the object inherits from ‘unicode’, test
whether it behaves how you expect – preferably by just using it as
though it does behave that way.

-- 
 \ Lucifer: “Just sign the Contract, sir, and the Piano is yours.” |
  `\ Ray: “Sheesh! This is long! Mind if I sign it now and read it |
_o__)later?” —http://www.achewood.com/ |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Steven D'Aprano
On Wed, 07 Mar 2012 22:18:50 +1100, Ben Finney wrote:

 de...@web.de (Diez B. Roggisch) writes:
 
 John Nagle na...@animats.com writes:

  I think that somewhere in suds, they subclass the unicode type.
  That's almost too cute.
 
  The proper test is
 
 isinstance(s,unicode)

 Woot, you finally discovered polymorphism - congratulations!
 
 If by “discovered” you mean “broke”.
 
 John, polymorphism entails that it *doesn't matter* whether the object
 inherits from any particular type; it only matters whether the object
 behaves correctly.
 
 So rather than testing whether the object inherits from ‘unicode’, test
 whether it behaves how you expect – preferably by just using it as
 though it does behave that way.


I must admit that I can't quite understand John Nagle's original post, so 
I could be wrong, but I *think* that both you and Diez have misunderstood 
the nature of John's complaint.

I *think* he is complaining that some other library -- suds? -- has a 
broken test for Unicode, by using:

if type(s) is unicode: ...

instead of

if isinstance(s, unicode): ...

Consequently, when the library passes a unicode *subclass* to the 
tounicode function, the type() is unicode test fails. That's a bad bug.

It's arguable that the library shouldn't even use isinstance, but that's 
an argument for another day.


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


Re: RotatingFileHandler Fails

2012-03-07 Thread arun1
Hi nac,

NTSafeLogging.py is working fine without any errors, but its not rotating
the log files as rotatingfilehandler does.
Do you have any working sample with  NTSafeLogging which rotates the log
file.

logging issue with subprocess.Popen  can be solved using  this code

import threading
lock = threading.RLock()
def acquire_lock():
lock.acquire()

def release_lock():
lock.release()

call the  acquire_lock()   at the begining  of method and release_lock() at
the end





--
View this message in context: 
http://python.6.n6.nabble.com/RotatingFileHandler-Fails-tp4542769p4554381.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


GUI components in python

2012-03-07 Thread janaki rajamani
Hi

I am stuck with the brain workshop software implemented using python.
The code involves a lot of GUI elements and i am familar only with the
basic python programming.
I would like to know whether there are built in classes to support GUI
elements or arethey project dependant.

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


Porting the 2-3 heap data-structure library from C to Python

2012-03-07 Thread Alec Taylor
I am planning to port the 2-3 heap data-structure as described by
Professor Tadao Takaoka in Theory of 2-3 Heaps published in 1999 and
available in PDF:
http://www.cosc.canterbury.ac.nz/tad.takaoka/2-3heaps.pdf

The source-code used has been made available:
http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.h
http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.c

I plan on wrapping it in a class.

This tutorial I used to just test out calling C within Python
(http://richizo.wordpress.com/2009/01/25/calling-c-functions-inside-python/)
and it seems to work, but this might not be the recommended method.

Any best practices for how best to wrap the 2-3 heap data-structure
from C to Python?

Thanks for all suggestions,

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


Re: Porting the 2-3 heap data-structure library from C to Python

2012-03-07 Thread Stefan Behnel
Alec Taylor, 07.03.2012 15:25:
 I am planning to port the 2-3 heap data-structure as described by
 Professor Tadao Takaoka in Theory of 2-3 Heaps published in 1999 and
 available in PDF:
 http://www.cosc.canterbury.ac.nz/tad.takaoka/2-3heaps.pdf
 
 The source-code used has been made available:
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.h
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.c
 
 I plan on wrapping it in a class.
 
 This tutorial I used to just test out calling C within Python
 (http://richizo.wordpress.com/2009/01/25/calling-c-functions-inside-python/)
 and it seems to work, but this might not be the recommended method.
 
 Any best practices for how best to wrap the 2-3 heap data-structure
 from C to Python?

For data structures, where performance tends to matter, it's usually best
to start with Cython right away, instead of using ctypes.

http://cython.org/

Here's a tutorial for wrapping a C library with it:

http://docs.cython.org/src/tutorial/clibraries.html

Stefan

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


Python 3.2 and MS Outlook

2012-03-07 Thread Greg Lindstrom
Is there documentation showing how to read from a Microsoft Outlook server
using Python 3.2.  I've done it with 2.x, but can't find anything to help
me with 3.2.

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


Re: RotatingFileHandler Fails

2012-03-07 Thread arun1
Hi,

Actually NonInheritedRotatingFileHandler is rotating the log files but some
times it falis and showing I/O errors while the log file limit reaches the
given size.

Thanks

Arun 


--
View this message in context: 
http://python.6.n6.nabble.com/RotatingFileHandler-Fails-tp4542769p4554781.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Porting the 2-3 heap data-structure library from C to Python

2012-03-07 Thread Hrvoje Niksic
Alec Taylor alec.tayl...@gmail.com writes:

 The source-code used has been made available:
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.h
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.c

 I plan on wrapping it in a class.

You should get acquainted with the Python/C API, which is the standard
way of extending Python with high-performance (and/or system-specific) C
code.  See Extending and Embedding and Python/C API sections at
http://docs.python.org/.

There is also a mailing list for help with the C API, see
http://mail.python.org/mailman/listinfo/capi-sig for details.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Porting the 2-3 heap data-structure library from C to Python

2012-03-07 Thread Stefan Behnel
Hrvoje Niksic, 07.03.2012 16:48:
 Alec Taylor writes:
 
 The source-code used has been made available:
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.h
 http://www.cosc.canterbury.ac.nz/research/RG/alg/ttheap.c

 I plan on wrapping it in a class.
 
 You should get acquainted with the Python/C API

If it proves necessary, yes.


 which is the standard way of extending Python with high-performance
 (and/or system-specific) C code.

Well, it's *one* way. Certainly not the easiest way, neither the most
portable and you'll have a hard time making it the fastest.

Stefan

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


deal with cookie in python 2.3

2012-03-07 Thread 胡峻
Dear All,
 
right now I use python to capture data from a internal website. The website 
uses cookie to store authorization data. But there is no HttpCookieProcessor in 
python 2.3? Is there anybody know, how to deal with cookie in python 2.3? and 
could give me a sample code?
 
thanks a lot
 
Julian-- 
http://mail.python.org/mailman/listinfo/python-list


Project

2012-03-07 Thread Dev Dixit
Please, tell me how to develop project on how people intract with
social networing sites.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help: confused about python flavors....

2012-03-07 Thread amar Singh
On Mar 7, 9:41 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Tue, 6 Mar 2012 20:06:37 -0800 (PST), amar Singh
 jagteraho2...@gmail.com declaimed the following in
 gmane.comp.python.general:

  Hi,

  I am confused between plain python, numpy, scipy, pylab, matplotlib.

  I have high familiarity with matlab, but the computer I use does not
  have it. So moving to python.
  What should I use? and the best way to use it. I will be running
  matlab-like scripts sometimes on the shell prompt and sometimes on the
  command line.

         If Matlab compatibility is a high constraint, I'll speak heresy and
 suggest you might look at Octavehttp://en.wikipedia.org/wiki/GNU_Octave

         Python is stand-alone programming/scripting language. Numpy is an
 extension package adding array/matrix math operations but the syntax
 won't be a direct match to Matlab; Scipy is an extension package that,
 well, extends Numpy. Matplotlib is a separate package for graphical
 plotting of array data. {simplistic explanation}

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

Thanks everyone for helping me on this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Project

2012-03-07 Thread John Gordon
In mailman.475.1331137499.3037.python-l...@python.org Dev Dixit 
devdixit1...@gmail.com writes:

 Please, tell me how to develop project on how people intract with
 social networing sites.

First you need a more detailed description of exactly what you want.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Python-2.6.1 ctypes test cases failing

2012-03-07 Thread Naresh Bhat
Hi All,

I have the following setup

Kernel version: linux-2.6.32.41
Python Version: Python-2.6.1
Hardware target: MIPS 64bit

I am just trying to run python test cases,  Observed that on my MIPS
64bit system only _ctypes related test cases are failing.

Is there any available patch for this issue ??


Only _ctypes test cases are failing:

root@cavium-octeonplus:~#
root@cavium-octeonplus:~# python /usr/lib32/python2.6/test/test_ctypes.py
.
..
test_doubleresult (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_floatresult (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_intresult (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_longdoubleresult (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_longlongresult (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_wchar_parm (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_wchar_result (ctypes.test.test_functions.FunctionTestCase) ... FAIL
test_longdouble (ctypes.test.test_callbacks.Callbacks) ... FAIL
test_integrate (ctypes.test.test_callbacks.SampleCallbacksTestCase) ... FAIL
test_wchar_parm
(ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) ...
FAIL
test_wchar_parm (ctypes.test.test_as_parameter.AsParamWrapperTestCase) ... FAIL
test_wchar_parm (ctypes.test.test_as_parameter.BasicWrapTestCase) ... FAIL
test_qsort (ctypes.test.test_libc.LibTest) ... FAIL
test_sqrt (ctypes.test.test_libc.LibTest) ... FAIL
test_double (ctypes.test.test_cfuncs.CFunctions) ... FAIL
test_double_plus (ctypes.test.test_cfuncs.CFunctions) ... FAIL
test_float (ctypes.test.test_cfuncs.CFunctions) ... FAIL
test_float_plus (ctypes.test.test_cfuncs.CFunctions) ... FAIL
test_longdouble (ctypes.test.test_cfuncs.CFunctions) ... FAIL
test_longdouble_plus (ctypes.test.test_cfuncs.CFunctions) ... FAIL


--Thanks and Regards
For things to change, we must change
-Naresh Bhat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Project

2012-03-07 Thread Rodrick Brown
Pay a smart developer!

Sent from my iPhone

On Mar 7, 2012, at 4:46 AM, Dev Dixit devdixit1...@gmail.com wrote:

 Please, tell me how to develop project on how people intract with
 social networing sites.
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: are int, float, long, double, side-effects of computer engineering?

2012-03-07 Thread Prasad, Ramit
Dennis Lee Bieber wrote: 

   It wouldn't surprise me to find out that modern CompSci degrees
 don't even discuss machine representation of numbers.

As a fairly recent graduate, I can assure you that they still do.
Well, I should say at least my school did since I cannot speak
for every other school.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-2.6.1 ctypes test cases failing

2012-03-07 Thread Terry Reedy

On 3/7/2012 12:43 PM, Naresh Bhat wrote:

Hi All,

I have the following setup

Kernel version: linux-2.6.32.41
Python Version: Python-2.6.1
Hardware target: MIPS 64bit

I am just trying to run python test cases,  Observed that on my MIPS
64bit system only _ctypes related test cases are failing.

Is there any available patch for this issue ??


There have been patches to ctypes since 2.6.1. At minimum, you should be 
using the latest version of 2.6. Even better, perhaps, would be the 
latest version of 2.7, since it contain patches applied after 2.6 went 
to security fixes only.


--
Terry Jan Reedy

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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread John Nagle

On 3/7/2012 3:42 AM, Steven D'Aprano wrote:


I *think* he is complaining that some other library -- suds? -- has a
broken test for Unicode, by using:

if type(s) is unicode: ...

instead of

if isinstance(s, unicode): ...

Consequently, when the library passes a unicode *subclass* to the
tounicode function, the type() is unicode test fails. That's a bad bug.


   No, that was my bug.

   The library bug, if any, is that you can't apply

unicode(s, errors='replace')

to a Unicode string. TypeError(Decoding unicode is not supported) is 
raised.  However


unicode(s)

will accept Unicode input.

The Python documentation
(http://docs.python.org/library/functions.html#unicode;) does not 
mention this.  It is therefore necessary to check the type before

calling unicode, or catch the undocumented TypeError exception
afterward.


John Nagle

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


sys.stdout.detach() results in ValueError

2012-03-07 Thread Peter Kleiweg

I want to write out some binary data to stdout in Python3. I 
thought the way to do this was to call detach on sys.stdout. But 
apparently, you can't. Here is a minimal script:

#!/usr/bin/env python3.1
import sys
fp = sys.stdout.detach()

Not yet using fp in any way, this script gives the following error:

Exception ValueError: 'underlying buffer has been detached' in

Same in Python 3.1.4 and Python 3.2.2

So, what do I do if I want to send binary data to stdout? 



-- 
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
-- 
http://mail.python.org/mailman/listinfo/python-list


Python recursive tree, linked list thingy

2012-03-07 Thread Wanderer
I have a list of defective CCD pixels and I need to find clusters
where a cluster is a group of adjacent defective pixels. This seems to
me to be a classic linked list tree search.I take a pixel from the
defective list and check if an adjacent pixel is in the list. If it is
I add the pixel to the cluster and remove it from the defective list.
I then check an adjacent pixel of the new pixel and so on down the
branch until I don't find a defective pixel. The I move up to the
previous pixel and check the next adjacent pixel  and so on until I'm
back at the head I can't find any more defective adjacent pixels. How
do you handle this sort of thing in Python?
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Project

2012-03-07 Thread Prasad, Ramit
  Please, tell me how to develop project on how people intract with
  social networing sites.
 
   This sounds more like a social sciences study than anything
 programming related...
 
   And since I don't do such sites, it may be intractable...

Or he could be wanting to know how to use something like Facebook
API, but with such a vague description it is hard to say. Even
harder to be interested in helping since that is such a broad scope.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python recursive tree, linked list thingy

2012-03-07 Thread Ian Kelly
On Wed, Mar 7, 2012 at 12:49 PM, Wanderer wande...@dialup4less.com wrote:
 I have a list of defective CCD pixels and I need to find clusters
 where a cluster is a group of adjacent defective pixels. This seems to
 me to be a classic linked list tree search.I take a pixel from the
 defective list and check if an adjacent pixel is in the list. If it is
 I add the pixel to the cluster and remove it from the defective list.
 I then check an adjacent pixel of the new pixel and so on down the
 branch until I don't find a defective pixel. The I move up to the
 previous pixel and check the next adjacent pixel  and so on until I'm
 back at the head I can't find any more defective adjacent pixels. How
 do you handle this sort of thing in Python?

A set of defective pixels would be the probable choice, since it
offers efficient membership testing.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python recursive tree, linked list thingy

2012-03-07 Thread MRAB

On 07/03/2012 19:49, Wanderer wrote:

I have a list of defective CCD pixels and I need to find clusters
where a cluster is a group of adjacent defective pixels. This seems to
me to be a classic linked list tree search.I take a pixel from the
defective list and check if an adjacent pixel is in the list. If it is
I add the pixel to the cluster and remove it from the defective list.
I then check an adjacent pixel of the new pixel and so on down the
branch until I don't find a defective pixel. The I move up to the
previous pixel and check the next adjacent pixel  and so on until I'm
back at the head I can't find any more defective adjacent pixels. How
do you handle this sort of thing in Python?


Something like this could work:

clusters = []

while defective_set:
to_do = {defective_set.pop()}
done = set()

while to_do:
pixel = to_do.pop()

neighbours = {n for n in defective_set if are_adjacent(n, pixel)}

defective_set -= neighbours
to_do |= neighbours

done.add(pixel)

clusters.append(done)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python recursive tree, linked list thingy

2012-03-07 Thread Alexander Blinne

Am 07.03.2012 20:49, schrieb Wanderer:

I have a list of defective CCD pixels and I need to find clusters
where a cluster is a group of adjacent defective pixels. This seems to
me to be a classic linked list tree search.I take a pixel from the
defective list and check if an adjacent pixel is in the list. If it is
I add the pixel to the cluster and remove it from the defective list.
I then check an adjacent pixel of the new pixel and so on down the
branch until I don't find a defective pixel. The I move up to the
previous pixel and check the next adjacent pixel  and so on until I'm
back at the head I can't find any more defective adjacent pixels. How
do you handle this sort of thing in Python?


I'd do something like (code not tested):

defective_list = [(x1, y1), (x2, y2), ...]   #list of coordinates of
 #defective pixel
#build one cluster:
cluster_start = defective_list.pop() #starting point
buf = [] #buffer for added pixels
buf.push(cluster_start)
cluster = []
cluster.push(cluster_start)
while len(buf)0:
i = buf.pop()
for b, d in itertools.product(xrange(2), [-1,1]):  #4 neighbours
j = list(i)
j[b] += d
j = tuple(j)
if outside_lcd(j) or j in cluster or j not in defective_list:
continue
defective_list.remove(j)
cluster.push(j)
buf.push(j)
return cluster

and repeat it until defective_list is empty.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python recursive tree, linked list thingy

2012-03-07 Thread Ian Kelly
On Wed, Mar 7, 2012 at 1:03 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 A set of defective pixels would be the probable choice, since it
 offers efficient membership testing.

Some actual code, using a recursive generator:

def get_cluster(defective, pixel):
yield pixel
(row, column) = pixel
for adjacent in [(row - 1, column), (row, column - 1),
 (row, column + 1), (row + 1, column)]:
if adjacent in defective:
defective.remove(adjacent)
for cluster_pixel in get_cluster(defective, adjacent):
yield cluster_pixel


defective = {(327, 415), (180, 97), (326, 415), (42, 15),
 (180, 98), (325, 414), (325, 415)}
clusters = []

while defective:
pixel = defective.pop()
clusters.append(list(get_cluster(defective, pixel)))

from pprint import pprint
pprint(clusters)


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


Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
Ok, first major roadblock. I have no idea how to install Beautiful
Soup or lxml on Windows! All I can find are .tar files. Based on what
I've read, I can use the easy_setup module to install these types of
files, but when I went to download the setuptools package, it only
seemed to support Python 2.7. I'm using 3.2. Is 2.7 just the minimum
version it requires? It didn't say something like 2.7+, so I wasn't
sure, and I don't want to start installing a bunch of stuff that will
clog up my directories and not even work.

What's the best way for me to install these two packages? I've also
seen a reference to using setup.py...is that a separate package too,
or is that something that comes with Python by default?

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


what is best method to set sys.stdout to utf-8?

2012-03-07 Thread Peter Kleiweg

In Python 3, there seem to be two ways to set sys.stdout to 
utf-8 after the script has started:

sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach())

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')

I guess the second is better. At start-up, type(sys.stdout) is 
class '_io.TextIOWrapper', and it's also after using the 
second method.

After using the first method, type(sys.stdout) is changed to 
class 'encodings.utf_8.StreamWriter'. 

Should I always use the second method?

-- 
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread Ian Kelly
On Wed, Mar 7, 2012 at 1:39 PM, John Salerno johnj...@gmail.com wrote:
 Ok, first major roadblock. I have no idea how to install Beautiful
 Soup or lxml on Windows! All I can find are .tar files. Based on what
 I've read, I can use the easy_setup module to install these types of
 files, but when I went to download the setuptools package, it only
 seemed to support Python 2.7. I'm using 3.2. Is 2.7 just the minimum
 version it requires? It didn't say something like 2.7+, so I wasn't
 sure, and I don't want to start installing a bunch of stuff that will
 clog up my directories and not even work.

There is a fork of setuptools called distribute that supports Python 3.

 What's the best way for me to install these two packages? I've also
 seen a reference to using setup.py...is that a separate package too,
 or is that something that comes with Python by default?

setup.py is a file that should be included at the top-level of the
.tar files you downloaded.  Generally, to install something in that
manner, you would navigate to that top-level folder and run python
setup.py install.  If you have multiple Python versions installed and
want to install the package for a specific version, then you would use
that version of Python to run the setup.py file.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python site-packages permission denied?

2012-03-07 Thread Shane Neeley
What do I need to do to successfully install a package onto python so that I 
can use it as a module? 

I have tried in terminal in the correct directory python2.7 ./setup.py 
install but it says permission denied.

Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 
./setup.py install
-bash: python2.7.1: command not found
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python 
./setup.py install
running install
running build
running build_py
running install_lib
copying build/lib/urllib2_file.py - /Library/Python/2.7/site-packages
error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Wed, Mar 7, 2012 at 3:01 PM, Ian Kelly ian.g.ke...@gmail.com wrote:

 There is a fork of setuptools called distribute that supports Python 3.

Thanks, I guess I'll give this a try tonight!

 setup.py is a file that should be included at the top-level of the
 .tar files you downloaded.  Generally, to install something in that
 manner, you would navigate to that top-level folder and run python
 setup.py install.  If you have multiple Python versions installed and
 want to install the package for a specific version, then you would use
 that version of Python to run the setup.py file.

The only files included in the .tar.gz file is a .tar file of the same
name. So I guess the setup option doesn't exist for these particular
packages. I'll try distribute tonight when I have some time to mess
with all of this.

So much work just to get a 3rd party module installed!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Project

2012-03-07 Thread HoneyMonster
On Wed, 07 Mar 2012 13:06:38 -0500, Rodrick Brown wrote:

 Pay a smart developer!

What? For homework?

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


Re: What's the best way to write this regular expression?

2012-03-07 Thread Benjamin Kaplan
On Wed, Mar 7, 2012 at 4:11 PM, John Salerno johnj...@gmail.com wrote:

 On Wed, Mar 7, 2012 at 3:01 PM, Ian Kelly ian.g.ke...@gmail.com wrote:

  There is a fork of setuptools called distribute that supports Python
  3.

 Thanks, I guess I'll give this a try tonight!

  setup.py is a file that should be included at the top-level of the
  .tar files you downloaded.  Generally, to install something in that
  manner, you would navigate to that top-level folder and run python
  setup.py install.  If you have multiple Python versions installed and
  want to install the package for a specific version, then you would use
  that version of Python to run the setup.py file.

 The only files included in the .tar.gz file is a .tar file of the same
 name. So I guess the setup option doesn't exist for these particular
 packages. I'll try distribute tonight when I have some time to mess
 with all of this.

 So much work just to get a 3rd party module installed!
 --


It's because your extraction program is weird. Gzip is a compression
algorithm that operates on a single file. Tar is an archive format
that combines multiple files into a single file. When we say extract
the .tar.gz, what we mean is both uncompress the tar file and then
extract everything out of that. A lot of programs will do that in one
step. If you look inside the tar file, you should find the setup.py.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python site-packages permission denied?

2012-03-07 Thread Chris Rebert
On Wed, Mar 7, 2012 at 1:02 PM, Shane Neeley shane.nee...@gmail.com wrote:
 What do I need to do to successfully install a package onto python so that I 
 can use it as a module?

 I have tried in terminal in the correct directory python2.7 ./setup.py 
 install but it says permission denied.

 Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python2.7.1 
 ./setup.py install
 -bash: python2.7.1: command not found
 Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$ python 
 ./setup.py install
 running install
 running build
 running build_py
 running install_lib
 copying build/lib/urllib2_file.py - /Library/Python/2.7/site-packages
 error: /Library/Python/2.7/site-packages/urllib2_file.py: Permission denied
 Shanes-MacBook-Pro:seisen-urllib2_file-cf4c4c8 chimpsarehungry$

You generally shouldn't mess with Mac OS X's system copies of Python.
Typically, one installs a separate copy using MacPorts, Fink, or
whatever, and uses that instead.
In any case, you generally need to `sudo` when installing stuff system-wide.

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


RE: What's the best way to write this regular expression?

2012-03-07 Thread Prasad, Ramit
 The only files included in the .tar.gz file is a .tar file of the same
 name.

gz stands for gzip and is a form of compression (like rar/zip ). 
tar stands for a tape archive. It is basically a box that holds the
files. So you need to unzip and then open the box.

Normally programs like WinZip / WinRar / 7-zip will do both in one step
so you do not need to. Not sure what program you are using...

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Project

2012-03-07 Thread Prasad, Ramit
  Pay a smart developer!
 
 What? For homework?

Sure why not? Smart developers could use extra money ;)

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread Ian Kelly
On Wed, Mar 7, 2012 at 2:11 PM, John Salerno johnj...@gmail.com wrote:
 The only files included in the .tar.gz file is a .tar file of the same
 name. So I guess the setup option doesn't exist for these particular
 packages.

The setup.py file (as well as the other files) would be inside the
.tar file.  Unlike a Windows zip file, which does both archival and
compression, Unix files are typically archived and compressed in two
separate steps: tar denotes the archival format, and gz denotes
the compression format.  Some decompression programs are smart enough
to recognize the .tar file and automatically extract it when
decompressing.  Others require you to decompress the .gz and extract
the .tar separately -- it sounds like yours is one of the latter.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Wed, Mar 7, 2012 at 3:34 PM, Ian Kelly ian.g.ke...@gmail.com wrote:

 The setup.py file (as well as the other files) would be inside the
 .tar file.  Unlike a Windows zip file, which does both archival and
 compression, Unix files are typically archived and compressed in two
 separate steps: tar denotes the archival format, and gz denotes
 the compression format.  Some decompression programs are smart enough
 to recognize the .tar file and automatically extract it when
 decompressing.  Others require you to decompress the .gz and extract
 the .tar separately -- it sounds like yours is one of the latter.

Ah, I see now. After opening the gz file, there was a tar file inside,
and then I just opened that file (I use 7zip for these types) and
there was a whole host of stuff inside. I didn't realize the tar file
itself was an archive, I thought it was the module! ::blush::

Maybe I don't need to mess with the distribute utility then, if I
can just run the setup file. I'll try that first and see what happens.

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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Ben Finney
John Nagle na...@animats.com writes:

The library bug, if any, is that you can't apply

   unicode(s, errors='replace')

 to a Unicode string. TypeError(Decoding unicode is not supported) is
 raised.  However

   unicode(s)

 will accept Unicode input.

I think that's a Python bug. If the latter succeeds as a no-op, the
former should also succeed as a no-op. Neither should ever get any
errors when ‘s’ is a ‘unicode’ object already.

 The Python documentation
 (http://docs.python.org/library/functions.html#unicode;) does not
 mention this. It is therefore necessary to check the type before
 calling unicode, or catch the undocumented TypeError exception
 afterward.

Yes, this check should not be necessary; calling the ‘unicode’
constructor with an object that's already an instance of ‘unicode’
should just return the object as-is, IMO. It shouldn't matter that
you've specified how decoding errors are to be handled, because in that
case no decoding happens anyway.

Care to report that bug to URL:http://bugs.python.org/, John?

-- 
 \  “Those who write software only for pay should go hurt some |
  `\ other field.” —Erik Naggum, in _gnu.misc.discuss_ |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Project

2012-03-07 Thread Ben Finney
Dev Dixit devdixit1...@gmail.com writes:

 Please, tell me how to develop project on how people intract with
 social networing sites.

Step one: collect data.
Step two: ???
Step three: project!

-- 
 \ “Try to become not a man of success, but try rather to become a |
  `\   man of value.” —Albert Einstein |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RE: What's the best way to write this regular expression?

2012-03-07 Thread Evan Driscoll

On 01/-10/-28163 01:59 PM, Prasad, Ramit wrote:

gz stands for gzip and is a form of compression (like rar/zip ).
tar stands for a tape archive. It is basically a box that holds the
files. So you need to unzip and then open the box.

Normally programs like WinZip / WinRar / 7-zip will do both in one step
so you do not need to. Not sure what program you are using...


I'm not sure what 7-zip you're referring to, because I use 7-zip and 
it's always been a two-step process for me...


(Though I can't say I've looked through the preferences dialog for a 
extract .tar.gz files in one go setting.)


Evan

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


BitSet Redis

2012-03-07 Thread Christian
I play around with redis. Isn't it  possible to handle BitSet with
Python as in Java?

BitSet users = BitSet.valueOf(redis.get(key.getBytes()));
all.or(users);
System.out.println(all.cardinality())

I try something with the struct and bitstring libs , but haven't any
success. Even the follow snippet didn't work, beacause
bitset[0] isn't approriate.

bitset = r.get('bytestringFromRedis')
x =  {0:b}.format(ord(bitset[0]))

Thanks in advance
Christian





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


Re: are int, float, long, double, side-effects of computer engineering?

2012-03-07 Thread Russ P.
On Mar 6, 7:25 pm, rusi rustompm...@gmail.com wrote:
 On Mar 6, 6:11 am, Xah Lee xah...@gmail.com wrote:

  some additional info i thought is relevant.

  are int, float, long, double, side-effects of computer engineering?

 It is a bit naive for computer scientists to club integers and reals
 as mathematicians do given that for real numbers, even equality is
 undecidable!
 Mostly when a system like mathematica talks of real numbers it means
 computable real numbers which is a subset of mathematical real numbers
 (and of course a superset of floats)

 Seehttp://en.wikipedia.org/wiki/Computable_number#Can_computable_numbers...

I might add that Mathematica is designed mainly for symbolic
computation, whereas IEEE floating point numbers are intended for
numerical computation. Those are two very different endeavors. I
played with Mathematica a bit several years ago, and I know it can do
numerical computation too. I wonder if it resorts to IEEE floating
point numbers when it does.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Dave Angel

On 03/07/2012 02:41 PM, Peter Kleiweg wrote:

I want to write out some binary data to stdout in Python3. I
thought the way to do this was to call detach on sys.stdout. But
apparently, you can't. Here is a minimal script:

 #!/usr/bin/env python3.1
 import sys
 fp = sys.stdout.detach()

Not yet using fp in any way, this script gives the following error:

 Exception ValueError: 'underlying buffer has been detached' in

Same in Python 3.1.4 and Python 3.2.2

So, what do I do if I want to send binary data to stdout?





sys.stdout.write(  some_binary_data )

Why should you need to do some funny manipulation?

If you have some other unstated motivation, better ask a clearer question.



--

DaveA

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


Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Peter Kleiweg
Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012:

 On 03/07/2012 02:41 PM, Peter Kleiweg wrote:
  I want to write out some binary data to stdout in Python3. I
  thought the way to do this was to call detach on sys.stdout. But
  apparently, you can't. Here is a minimal script:
  
   #!/usr/bin/env python3.1
   import sys
   fp = sys.stdout.detach()
  
  Not yet using fp in any way, this script gives the following error:
  
   Exception ValueError: 'underlying buffer has been detached' in
  
  Same in Python 3.1.4 and Python 3.2.2
  
  So, what do I do if I want to send binary data to stdout?
  
  
  
 
 sys.stdout.write(  some_binary_data )

TypeError: must be str, not bytes




-- 
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Steven D'Aprano
On Thu, 08 Mar 2012 08:48:58 +1100, Ben Finney wrote:

 John Nagle na...@animats.com writes:
 
The library bug, if any, is that you can't apply

  unicode(s, errors='replace')

 to a Unicode string. TypeError(Decoding unicode is not supported) is
 raised.  However

  unicode(s)

 will accept Unicode input.
 
 I think that's a Python bug. If the latter succeeds as a no-op, the
 former should also succeed as a no-op. Neither should ever get any
 errors when ‘s’ is a ‘unicode’ object already.

No. The semantics of the unicode function (technically: a type 
constructor) are well-defined, and there are two distinct behaviours:

unicode(obj)

is analogous to str(obj), and it attempts to convert obj to a unicode 
string by calling obj.__unicode__, if it exists, or __str__ if it 
doesn't. No encoding or decoding is attempted in the event that obj is a 
unicode instance.

unicode(obj, encoding, errors) 

is explicitly stated in the docs as decoding obj if EITHER of encoding or 
errors is given, AND that obj must be either an 8-bit string (bytes) or a 
buffer object.

It is true that u''.decode() will succeed, in Python 2, but the fact that 
unicode objects have a decode method at all is IMO a bug. It has also 
been corrected in Python 3, where (unicode) str objects no longer have a 
decode method, and bytes objects no longer have an encode method.


 The Python documentation
 (http://docs.python.org/library/functions.html#unicode;) does not
 mention this.

Yes it does. It is is the SECOND sentence, immediately after the summary 
line:

unicode([object[, encoding[, errors]]])
Return the Unicode string version of object using one of the
following modes:

If encoding and/or errors are given, unicode() will decode the object
which can either be an 8-bit string or a character buffer using the
codec for encoding. ...


Admittedly, it doesn't *explicitly* state that TypeError will be raised, 
but what other exception kind would you expect when you supply an 
argument of the wrong type?


 It is therefore necessary to check the type before
 calling unicode, or catch the undocumented TypeError exception
 afterward.
 
 Yes, this check should not be necessary; calling the ‘unicode’
 constructor with an object that's already an instance of ‘unicode’
 should just return the object as-is, IMO. It shouldn't matter that
 you've specified how decoding errors are to be handled, because in that
 case no decoding happens anyway.

I don't believe that it is the job of unicode() to Do What I Mean, but 
only to Do What I Say. If I *explicitly* tell unicode() to decode the 
argument (by specifying either the codec or the error handler or both) 
then it should not double-guess me and ignore the extra parameters.

End-user applications may, with care, try to be smart and DWIM, but 
library functions should be dumb and should do what they are told.



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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Terry Reedy

On 3/7/2012 6:26 PM, Steven D'Aprano wrote:

On Thu, 08 Mar 2012 08:48:58 +1100, Ben Finney wrote:


John Naglena...@animats.com  writes:


The library bug, if any, is that you can't apply

unicode(s, errors='replace')

to a Unicode string. TypeError(Decoding unicode is not supported) is
raised.  However

unicode(s)

will accept Unicode input.


I think that's a Python bug. If the latter succeeds as a no-op, the
former should also succeed as a no-op. Neither should ever get any
errors when ‘s’ is a ‘unicode’ object already.



No. The semantics of the unicode function (technically: a type
constructor) are well-defined, and there are two distinct behaviours:

unicode(obj)

is analogous to str(obj), and it attempts to convert obj to a unicode
string by calling obj.__unicode__, if it exists, or __str__ if it
doesn't. No encoding or decoding is attempted in the event that obj is a
unicode instance.

unicode(obj, encoding, errors)

is explicitly stated in the docs as decoding obj if EITHER of encoding or
errors is given, AND that obj must be either an 8-bit string (bytes) or a
buffer object.

It is true that u''.decode() will succeed, in Python 2, but the fact that
unicode objects have a decode method at all is IMO a bug. It has also


I believe that is because in Py 2, codecs and .encode/.decode were used 
for same type recoding like base64, uu coding. That was simplified in 
Py3 so that 'decoding' is bytes to string and 'encoding' is string to 
bytes, and base64, etc, are only done in their separate modules and not 
also duplicated in the codecs machinery.



been corrected in Python 3, where (unicode) str objects no longer have a
decode method, and bytes objects no longer have an encode method.



The Python documentation
(http://docs.python.org/library/functions.html#unicode;) does not
mention this.


Yes it does. It is is the SECOND sentence, immediately after the summary
line:

unicode([object[, encoding[, errors]]])
 Return the Unicode string version of object using one of the
 following modes:

 If encoding and/or errors are given, unicode() will decode the object
 which can either be an 8-bit string or a character buffer using the
 codec for encoding. ...


Admittedly, it doesn't *explicitly* state that TypeError will be raised,
but what other exception kind would you expect when you supply an
argument of the wrong type?


What you have correctly pointed out is that there is no discrepancy 
between doc and behavior and hence no bug for the purpose of the 
tracker. Thanks.



It is therefore necessary to check the type before
calling unicode, or catch the undocumented TypeError exception
afterward.


Yes, this check should not be necessary; calling the ‘unicode’
constructor with an object that's already an instance of ‘unicode’
should just return the object as-is, IMO. It shouldn't matter that
you've specified how decoding errors are to be handled, because in that
case no decoding happens anyway.


I don't believe that it is the job of unicode() to Do What I Mean, but
only to Do What I Say. If I *explicitly* tell unicode() to decode the
argument (by specifying either the codec or the error handler or both)
then it should not double-guess me and ignore the extra parameters.

End-user applications may, with care, try to be smart and DWIM, but
library functions should be dumb and should do what they are told.


--
Terry Jan Reedy


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


Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Terry Reedy

On 3/7/2012 5:35 PM, Peter Kleiweg wrote:

Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012:


On 03/07/2012 02:41 PM, Peter Kleiweg wrote:

I want to write out some binary data to stdout in Python3. I
thought the way to do this was to call detach on sys.stdout. But
apparently, you can't. Here is a minimal script:

  #!/usr/bin/env python3.1
  import sys
  fp = sys.stdout.detach()

Not yet using fp in any way, this script gives the following error:

  Exception ValueError: 'underlying buffer has been detached' in

Same in Python 3.1.4 and Python 3.2.2

So, what do I do if I want to send binary data to stdout?





sys.stdout.write(  some_binary_data )


TypeError: must be str, not bytes


Right, you can only send binary data to file opened in binary mode. The 
default sys.stdout is in text mode. I am pretty sure that remains true 
even if stdout is redirected. (You did not mention your OS.) You would 
have to open such a file and make sys.stdout point to it.

sys.stdout = my_binary_file.
But why do that? Just open the file and write to it directly without the 
above.


--
Terry Jan Reedy

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


Re: what is best method to set sys.stdout to utf-8?

2012-03-07 Thread Terry Reedy

On 3/7/2012 3:57 PM, Peter Kleiweg wrote:


In Python 3, there seem to be two ways to set sys.stdout to
utf-8 after the script has started:

 sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach())

 sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')

I guess the second is better. At start-up, type(sys.stdout) is
class '_io.TextIOWrapper', and it's also after using the
second method.

After using the first method, type(sys.stdout) is changed to
class 'encodings.utf_8.StreamWriter'.

Should I always use the second method?


I would. The io module is more recent an partly replaces codecs. The 
latter remains for back compatibility and whatever it can do that io cannot.


--
Terry Jan Reedy

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


Re: pickle/unpickle class which has changed

2012-03-07 Thread Gelonida N
On 03/07/2012 09:04 AM, Peter Otten wrote:
 Gelonida N wrote:

 If you know in advance that your class will undergo significant changes you 
 may also consider storing more stable data in a file format that can easily 
 be modified, e. g. json.
 
Good point, that's what I'm partially doing. I just wondered whether
there were already some kind of pre-existing data migration tools /
concepts / helpers like for example south for Django or whether I had to
roll my own migration scheme for persistent non DB data.





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


Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Mark Tolonen
On Mar 7, 4:10 pm, Terry Reedy tjre...@udel.edu wrote:
 On 3/7/2012 5:35 PM, Peter Kleiweg wrote:









  Dave Angel schreef op de 7e dag van de lentemaand van het jaar 2012:

  On 03/07/2012 02:41 PM, Peter Kleiweg wrote:
  I want to write out some binary data to stdout in Python3. I
  thought the way to do this was to call detach on sys.stdout. But
  apparently, you can't. Here is a minimal script:

        #!/usr/bin/env python3.1
        import sys
        fp = sys.stdout.detach()

  Not yet using fp in any way, this script gives the following error:

        Exception ValueError: 'underlying buffer has been detached' in

  Same in Python 3.1.4 and Python 3.2.2

  So, what do I do if I want to send binary data to stdout?

  sys.stdout.write(  some_binary_data )

  TypeError: must be str, not bytes

 Right, you can only send binary data to file opened in binary mode. The
 default sys.stdout is in text mode. I am pretty sure that remains true
 even if stdout is redirected. (You did not mention your OS.) You would
 have to open such a file and make sys.stdout point to it.
 sys.stdout = my_binary_file.
 But why do that? Just open the file and write to it directly without the
 above.

 --
 Terry Jan Reedy

Write binary data to sys.stdout.buffer.

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


Re: Python 3.2 and MS Outlook

2012-03-07 Thread Mark Hammond

On Thursday, 8 March 2012 1:52:48 AM, Greg Lindstrom wrote:
Is there documentation showing how to read from a Microsoft Outlook 
server using Python 3.2.  I've done it with 2.x, but can't find 
anything to help me with 3.2.


What problems are you having in 3.2?  It should be exactly the same - 
except, obviously, for the general differences between 2 and 3 (ie, any 
differences should not be due to needing to talk to Outlook and would 
exist regardless of the job at hand)


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


Re: Decoding unicode is not supported in unusual situation

2012-03-07 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:

 On Thu, 08 Mar 2012 08:48:58 +1100, Ben Finney wrote:
  I think that's a Python bug. If the latter succeeds as a no-op, the
  former should also succeed as a no-op. Neither should ever get any
  errors when ‘s’ is a ‘unicode’ object already.

 No. The semantics of the unicode function (technically: a type 
 constructor) are well-defined, and there are two distinct behaviours:

That is documented, right. Thanks for drawing my attention to it.

  Yes, this check should not be necessary; calling the ‘unicode’
  constructor with an object that's already an instance of ‘unicode’
  should just return the object as-is, IMO. It shouldn't matter that
  you've specified how decoding errors are to be handled, because in
  that case no decoding happens anyway.

 I don't believe that it is the job of unicode() to Do What I Mean, but 
 only to Do What I Say. If I *explicitly* tell unicode() to decode the 
 argument (by specifying either the codec or the error handler or both) 

That's where I disagree. Specifying what to do in the case of decoding
errors is *not* explicitly requesting to decode.

The decision of whether to decode is up to the object, not the caller.
Specifying an error handler *in case* decoding errors happen is not the
same as specifying that decoding must happen.

In other words: I think specifying an encoding is saying “decode this”,
but I don't think the same is true of specifying an error handler.

 End-user applications may, with care, try to be smart and DWIM, but 
 library functions should be dumb and should do what they are told.

Agreed, and I think this is compatible with my position.

-- 
 \ “Creativity can be a social contribution, but only in so far as |
  `\ society is free to use the results.” —Richard M. Stallman |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


PPC Form Filling Jobs

2012-03-07 Thread reena k
http://internetjobs4u.weebly.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdout.detach() results in ValueError

2012-03-07 Thread Benjamin Peterson
Peter Kleiweg pkleiweg at xs4all.nl writes:
 Not yet using fp in any way, this script gives the following error:
 
 Exception ValueError: 'underlying buffer has been detached' in

You're probably using print() or some such which tries to write to sys.stdout.
It's safest to just write to sys.stdout.buffer rather than using detach.




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


Re: BitSet Redis

2012-03-07 Thread rusi
On Mar 8, 3:02 am, Christian mining.fa...@googlemail.com wrote:
 I play around with redis. Isn't it  possible to handle BitSet with
 Python as in Java?

 BitSet users = BitSet.valueOf(redis.get(key.getBytes()));
 all.or(users);
 System.out.println(all.cardinality())

 I try something with the struct and bitstring libs , but haven't any
 success. Even the follow snippet didn't work, beacause
 bitset[0] isn't approriate.

 bitset = r.get('bytestringFromRedis')
 x =  {0:b}.format(ord(bitset[0]))

 Thanks in advance
 Christian

Redis I dont know.
As for bitset, sets in python should give you whatever bitset in java
does
See http://docs.python.org/library/sets.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread Chris Angelico
On Thu, Mar 8, 2012 at 7:39 AM, John Salerno johnj...@gmail.com wrote:
 it only
 seemed to support Python 2.7. I'm using 3.2. Is 2.7 just the minimum
 version it requires? It didn't say something like 2.7+, so I wasn't
 sure, and I don't want to start installing a bunch of stuff that will
 clog up my directories and not even work.

Just to clarify: Python 2 and Python 3 are quite different. If
something requires Python 2.7, you cannot assume that it will work
with Python 3.2; anything that supports both branches will usually
list the minimum version of each (eg 2.7 or 3.3).

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


Re: Python site-packages permission denied?

2012-03-07 Thread Ned Deily
In article 
camzyqrtxy3msmxtivue8apyx2zfag3dqp1un+fqwnaywnoa...@mail.gmail.com,
 Chris Rebert c...@rebertia.com wrote:
 You generally shouldn't mess with Mac OS X's system copies of Python.
 Typically, one installs a separate copy using MacPorts, Fink, or
 whatever, and uses that instead.

I don't understand what you mean by mess with.  Certainly one should 
not attempt alter standard library modules provided with the system 
Python but adding additional packages is fully supported.  Apple 
conveniently provides a special directory in user-controlled space 
(/Library/Python) as the default location for Distutils-based installs.  
They even provide versions of easy_install for the system Pythons.

-- 
 Ned Deily,
 n...@acm.org

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


Help with MultipartPostHandler

2012-03-07 Thread Shane Neeley
Hi Python Google Group! I hope someone could help me and then one day when I am 
good I can contribute to the forum as well. Does anyone know what is wrong with 
my syntax here as I am trying to submit this form using MultipartPostHandler 
that I installed? 

import MultipartPostHandler, urllib2

params = { 'Run_Number' : 'NONE', 'MAX_FILE_SIZE' : '200', 'submitForm' : 
'Submit' }

opener.open(http://consurf.tau.ac.il/index_full_form_PROT.php;, params)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Biologist new to cgi in python

2012-03-07 Thread Tim Roberts
Shane Neeley shane.nee...@gmail.com wrote:

Here is the function I am using to insert the variable file text inside the
url. Is it even possible to include the upload command in the url? 

No.  You are trying to simulate a GET request, but files can only be
uploaded via a POST request of type multiport/form-data.  There is a
module called poster that can do the appropriate encoding for you:

http://stackoverflow.com/questions/680305/using-multipartposthandler-to-post-form-data-with-python
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what is best method to set sys.stdout to utf-8?

2012-03-07 Thread Laurent Claessens



I would. The io module is more recent an partly replaces codecs. The
latter remains for back compatibility and whatever it can do that io cannot.



 I've a naive question : what is wrong with the following system ?

class MyStdOut(object):
def __init__(self):
self.old_stdout=sys.stdout
def write(self,x):
try:
if isinstance(x,unicode):
x=x.encode(utf8)
except (UnicodeEncodeError,UnicodeDecodeError):
sys.stderr.write(This should not happen !)
raise
self.old_stdout.write(x)
sys.stdout=MyStdOut()


... well ... a part of the fact that it is much longer ?


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


Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Mar 7, 11:03 pm, Chris Angelico ros...@gmail.com wrote:
 On Thu, Mar 8, 2012 at 7:39 AM, John Salerno johnj...@gmail.com wrote:
  it only
  seemed to support Python 2.7. I'm using 3.2. Is 2.7 just the minimum
  version it requires? It didn't say something like 2.7+, so I wasn't
  sure, and I don't want to start installing a bunch of stuff that will
  clog up my directories and not even work.

 Just to clarify: Python 2 and Python 3 are quite different. If
 something requires Python 2.7, you cannot assume that it will work
 with Python 3.2; anything that supports both branches will usually
 list the minimum version of each (eg 2.7 or 3.3).

 ChrisA

That's why I asked first, because I got the feeling it did NOT support
Python 3 :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Mar 7, 4:02 pm, Evan Driscoll drisc...@cs.wisc.edu wrote:
 On 01/-10/-28163 01:59 PM, Prasad, Ramit wrote:

  gz stands for gzip and is a form of compression (like rar/zip ).
  tar stands for a tape archive. It is basically a box that holds the
  files. So you need to unzip and then open the box.

  Normally programs like WinZip / WinRar / 7-zip will do both in one step
  so you do not need to. Not sure what program you are using...

 I'm not sure what 7-zip you're referring to, because I use 7-zip and
 it's always been a two-step process for me...

 (Though I can't say I've looked through the preferences dialog for a
 extract .tar.gz files in one go setting.)

 Evan

Same here, because that's what I used. I looked through the settings
but didn't see anything. What seems to happen is that 7-Zip recognizes
the .gz extension and opens that automatically. But then that simply
opens up another window with the .tar file in it, which you have to
then open again.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue14216] ImportError: No module named binascii

2012-03-07 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

You probably did something wrong when installing Python. How exactly did you 
get it into ~/PythonInstall?

--
nosy: +loewis

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



[issue13897] Move fields relevant to sys.exc_info out of frame into generator/threadstate

2012-03-07 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Jim Jewett wrote:
  http://bugs.python.org/review/13897/diff/4186/14521
  File Python/sysmodule.c (right):
 
  http://bugs.python.org/review/13897/diff/4186/14521#newcode211
  Python/sysmodule.c:211: while ((exc_info-exc_type == NULL ||
  exc_info-exc_type == Py_None) 
  This while loop is new, but it isn't clear how it is related to
  encapsulating the exception state.  Is this fixing an unrelated bug, or
  is it from generators, or ..?
 
  http://bugs.python.org/review/13897/show

Running generators form a stack, much like frames.
Calling a generator with next or send, pushes it onto the stack,
yielding pops it.

Now consider, if you will, the threadstate object as a sort of
non-yielding (it cannot be popped) generator which forms the base
of this stack.

In this patch, rather than swapping the exception state between 
generator-owned frame and threadstate whenever entering or leaving a 
generator, each generator (and the threadstate) has its own exception state.

It order to find the topmost exception state, sys.exc_info searches the 
stack of generators until it finds one.
In practice the generator stack will be very shallow, only 1 or 2 deep,
as it is rare to have generators calling other generators
(although this will become a bit more common with PEP 380).

--
title: Move fields relevant to sys.exc_info out of frame into 
generator/threadstate - Move fields relevant to sys.exc_info out of frame into 
  generator/threadstate

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



[issue7652] Merge C version of decimal into py3k.

2012-03-07 Thread Case Van Horsen

Case Van Horsen cas...@gmail.com added the comment:

I've found some differences between decimal and cdecimal. 

cdecimal 2.3 does not support the __ceil__ and __floor__ methods that exist in 
decimal. math.ceil converts a cdecimal.Decimal instance into a float before 
finding the ceiling. This can generate incorrect results.

 import decimal
 import math
 math.ceil(decimal.Decimal(12345678901234567890.1))
12345678901234567168

The decimal module in previous versions returns the correct answer 
12345678901234567891

cdecimal.Decimal instances do not emulate the various single-underscore methods 
of a decimal.Decimal instance. In gmpy2, I use _int, _exp, _sign, and 
_is_special to convert a decimal.Decimal into an exact fraction. I realize the 
issue is with gmpy2 and I will fix gmpy2, but there may be other code that uses 
those methods.

--

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



[issue14216] ImportError: No module named binascii

2012-03-07 Thread Qian Liu

Qian Liu liuq0...@e.ntu.edu.sg added the comment:

Dear Martin,

Thanks for your reply.

I went to the folder of python after tar -zxvf Python-2.7.2.tgz and do
the following operations:
./configure --prefix=~/PythonInstall
make
make install
where ~ represent the path in my computer and it is long in the report;
so, I replaced it by ~.

Then, I put ~/PythonInstallbin
and ~/PythonInstall/lib/python2.7/site-packages into PATH and PYTHONPATH.

Anything wrong here?

Thanks for your help.

Best regards,
Qian Liu

On Wed, Mar 7, 2012 at 4:23 PM, Martin v. Löwis rep...@bugs.python.orgwrote:


 Martin v. Löwis mar...@v.loewis.de added the comment:

 You probably did something wrong when installing Python. How exactly did
 you get it into ~/PythonInstall?

 --
 nosy: +loewis

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue14216
 ___



--

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



[issue992389] attribute error due to circular import

2012-03-07 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue14218] include rendered output in addition to markup

2012-03-07 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe tshep...@gmail.com:

For devguide/documenting, If you show me markup, also show me what output it 
gives me. It's kinda tedious to keep building the markup just to verify how 
it's rendered.

--
components: Devguide
messages: 155061
nosy: ezio.melotti, tshepang
priority: normal
severity: normal
status: open
title: include rendered output in addition to markup
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-07 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

 optparse, which argparse attempts to replace, permitted positional 
 arguments to be intermixed with optional arguments

Sure, but optparse didn't actually parse positional arguments - it just threw 
them into a bag, and then you had to group them and convert them however you 
wanted afterwards. Argparse, instead, was designed to let you specify the 
groups of positional arguments. Your situation is a little different because 
you just want to throw all the positional arguments into a bag again. Not that 
there's anything wrong with that - it's just not the primary use case argparse 
had in mind.

 The only definition of positional parameters I could find...

Yeah, it looks like there's no good documentation on positional vs. optional 
parameters. Somewhere obvious, perhaps right at the beginning of the 
add_argument() documentation, there should probably be something like:

Argparse groups the command line argument strings into two types of groups: 
optional arguments, which are a sequence of command line strings that begin 
with a flag like -v or --verbose, and positional arguments, which are a 
sequence of command line strings that do not begin with a flag. The 
add_argument() method allows you to specify how many command line strings each 
of your optional or positional arguments should consume, how those strings 
should be converted into Python objects, etc.

--

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



[issue14216] ImportError: No module named binascii

2012-03-07 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

There are some minor errors indeed: the syntax for PATH and PYTHONPATH is wrong 
(don't use quotes () in the middle of the value). Also, putting site-packages 
into PYTHONPATH should not be necessary.

I think the main cause might be the incorrect --prefix argument. Don't use 
~/PythonInstall, but $HOME/PythonInstall. Also, when I try this, I get

configure: error: expected an absolute directory name for --prefix: 
~/PythonInstall

so you must have made something different (or you have used a shell different 
from bash), else you would have gotten the same error.

--

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



[issue14216] ImportError: No module named binascii

2012-03-07 Thread Qian Liu

Qian Liu liuq0...@e.ntu.edu.sg added the comment:

Dear Martin,

Many thanks for your help and your reply. I will correct the errors and let
you know the result.

best regards,
Qian Liu

On Wed, Mar 7, 2012 at 5:07 PM, Martin v. Löwis rep...@bugs.python.orgwrote:


 Martin v. Löwis mar...@v.loewis.de added the comment:

 There are some minor errors indeed: the syntax for PATH and PYTHONPATH is
 wrong (don't use quotes () in the middle of the value). Also, putting
 site-packages into PYTHONPATH should not be necessary.

 I think the main cause might be the incorrect --prefix argument. Don't use
 ~/PythonInstall, but $HOME/PythonInstall. Also, when I try this, I get

 configure: error: expected an absolute directory name for --prefix:
 ~/PythonInstall

 so you must have made something different (or you have used a shell
 different from bash), else you would have gotten the same error.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue14216
 ___



--

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



[issue14219] start the Class tutorial in a more gentle manner

2012-03-07 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe tshep...@gmail.com:

Looking at Doc/tutorial/classes, the section Python Scopes and Namespaces is 
full of heavy/deep information. I expect that people who would be able to 
properly digest that info are people who are already advanced at Python, and 
therefore maybe it should be moved to some cookbook (or language reference). I 
would prefer something gentler, since the tutorial is for Python newbies who 
aren't necessarily conversant with OO concepts.

There can of course be links to heavier material for deeper understanding.

--
assignee: docs@python
components: Documentation
messages: 155065
nosy: docs@python, tshepang
priority: normal
severity: normal
status: open
title: start the Class tutorial in a more gentle manner
type: enhancement

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



[issue14219] start the Class tutorial in a more gentle manner

2012-03-07 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue14216] ImportError: No module named binascii

2012-03-07 Thread Qian Liu

Qian Liu liuq0...@e.ntu.edu.sg added the comment:

Dear Martin,

I did the following operations
./configure --prefix=
/img01/home/liuqian1/PLAprediction/software/PythonInstall
make
make install

and then

MPYTHONHOME=/img01/home/liuqian1/PLAprediction/software/PythonInstall
PATH=$MPYTHONHOME/bin:$PATH

However, when I try ' python -c import binascii; ', *I still got the same
error.*

By the way, I can run ' python -c import binascii; ' on Window XP and in
python 2.5.5.

Our technician also installed python 3.0 in our Linux server without the
'prefex' in the ./configure but we got the same error also.

Any more comments about this?

Thanks for your help in advance.

Best regards,
Qian Liu

On Wed, Mar 7, 2012 at 5:12 PM, Qian Liu rep...@bugs.python.org wrote:


 Qian Liu liuq0...@e.ntu.edu.sg added the comment:

 Dear Martin,

 Many thanks for your help and your reply. I will correct the errors and let
 you know the result.

 best regards,
 Qian Liu

 On Wed, Mar 7, 2012 at 5:07 PM, Martin v. Löwis rep...@bugs.python.org
 wrote:

 
  Martin v. Löwis mar...@v.loewis.de added the comment:
 
  There are some minor errors indeed: the syntax for PATH and PYTHONPATH is
  wrong (don't use quotes () in the middle of the value). Also, putting
  site-packages into PYTHONPATH should not be necessary.
 
  I think the main cause might be the incorrect --prefix argument. Don't
 use
  ~/PythonInstall, but $HOME/PythonInstall. Also, when I try this, I
 get
 
  configure: error: expected an absolute directory name for --prefix:
  ~/PythonInstall
 
  so you must have made something different (or you have used a shell
  different from bash), else you would have gotten the same error.
 
  --
 
  ___
  Python tracker rep...@bugs.python.org
  http://bugs.python.org/issue14216
  ___
 
 

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue14216
 ___



--

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



[issue14218] include rendered output in addition to markup

2012-03-07 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

3.1 and 2.6 as in security fix only: please don't add those versions for 
non-sec issue

--
nosy: +sandro.tosi
versions:  -Python 2.6, Python 3.1

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



[issue14218] include rendered output in addition to markup

2012-03-07 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

additionally, devguide has no version associated with it.

--
versions:  -Python 2.7, Python 3.2, Python 3.3

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



[issue14219] start the Class tutorial in a more gentle manner

2012-03-07 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

see msg155067

--
nosy: +sandro.tosi
versions:  -Python 2.6, Python 3.1

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



[issue7652] Merge C version of decimal into py3k.

2012-03-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Jim Jewett rep...@bugs.python.org wrote:
 Whether you need *additional* subdirectories within _cdecimal to
 subcategorize the .c and .h files, I'm not sure -- because I didn't
 get in deep enough to know what they should be.  If the categorization
 let people focus on the core, that would be helpful, but it wasn't
 clear to me which files were part of the exported API and which were
 implementation details.  Are there are clear distinctions (type
 info/python bindings/basic arithmetic/advanced
 algorithms/internal-use-only/???)

OK, as a basis for discussion I've added:

http://hg.python.org/features/cdecimal/file/8b75c2825508/Modules/_decimal/FILEMAP.txt

I didn't mention the main reason why _decimal.c and libmpdec are in a flat
directory: Building the library first and then the module from the library
led to problems on at least Windows and AIX. That's why I started to treat
all libmpdec files as part of the module, list them as dependencies in setup.py
and let distutils figure everything out. Distutils also can figure out
automatically if a Mac OS build happens to be a universal build and things
like that.

The build process is very well tested by now and it took quite a while
to figure everything out, so I'd be reluctant to change the flat hierarchy.

  ??python/ ?? ?? ??- ??extended module tests
 
 I would really expect that to still be under tests, and I would expect
 a directory called python to contain code written in python, or at
 least python bindings.

Could you explain? The python/ directory contains deccheck.py, formathelper.py
etc.

 Would it at least be OK to wrap them in stubs for exporting, so that
 the test logic could be places with the others tests?  (I worry that
 some tests may stop getting run if someone else modifies the build
 process and doesn't notice the unusual location.)

tests/runtest.c won't compile then. I'll look into the stub and also
the _testhelp suggestions.

  Infinity, InFinItY, iNF are all allowed by the specification.
 
 OK; so is io.c part of the library, or part of the python binding?

I see a potential source of confusion: io.c is firmly part of the
library. All PEP 3101 formatting is part of libmpdec, because I like
the mini language. io.c only understands ASCII and UTF-8 fill characters.

It is the *library* tests that would fail under the Turkish locale
(if not for _mpd_strneq).

 Good enough, though I would rather see that as a comment near the assembly.

Comments how to enforce an ANSI build (much slower!) are in LIBTEST.txt
and now also in FILEMAP.txt.

 I'm not worried about the header files.  I am worried about what is
 exposed to python, but just documenting it (docstrings and the module
 .rst) may be OK.
 
 But I'm also worried that there may be fair amounts of code that are
 effectively dead after the remove any names not in decimal.py
 importing trick.  If so, I would at least like that in some sort of
 #ifdef, so that people don't spend too much time trying to make sense
 of it.

It's the opposite: names from decimal.py starting with an underscore
that are not in _decimal are removed. If I don't use that trick, I
end up with about 50 additional symbols from decimal.py:

import decimal # the C version
dir(decimal)

... '_ContextManager', '_Infinity', '_Log10Memoize', ...

--

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



[issue7652] Merge C version of decimal into py3k.

2012-03-07 Thread Marc-Andre Lemburg

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

Does the C version have a C API importable as capsule ?
If not, could you add one and a decimal.h to go with it ?

This makes integration in 3rd party modules a lot easier.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com


2012-02-13: Released eGenix pyOpenSSL 0.13http://egenix.com/go26
2012-02-09: Released mxODBC.Zope.DA 2.0.2 http://egenix.com/go25

::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--
nosy: +lemburg

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



[issue14220] yield from kills generator on re-entry

2012-03-07 Thread Stefan Behnel

New submission from Stefan Behnel sco...@users.sourceforge.net:

Based on the existing test_attempted_yield_from_loop in 
Lib/test/test_pep380.py, I wrote this test and I wonder why it does not work:


def test_attempted_reentry():

 for line in test_attempted_reentry(): print(line)
g1: starting
Yielded: y1
g1: about to yield from g2
g2: starting
Yielded: y2
g2: about to yield from g1
g2: caught ValueError
Yielded: y3
g1: after delegating to g2
Yielded: y4

trace = []
def g1():
trace.append(g1: starting)
yield y1
trace.append(g1: about to yield from g2)
yield from g2()
trace.append(g1: after delegating to g2)
yield y4

def g2():
trace.append(g2: starting)
yield y2
trace.append(g2: about to yield from g1)
try:
yield from gi
except ValueError:
trace.append(g2: caught ValueError)
else:
trace.append(g1 did not raise ValueError on reentry)
yield y3
gi = g1()
for y in gi:
trace.append(Yielded: %s % (y,))
return trace


In current CPython, I get this:


Failed example:
for line in test_attempted_reentry(): print(line)
Expected:
g1: starting
Yielded: y1
g1: about to yield from g2
g2: starting
Yielded: y2
g2: about to yield from g1
g2: caught ValueError
Yielded: y3
g1: after delegating to g2
Yielded: y4
Got:
g1: starting
Yielded: y1
g1: about to yield from g2
g2: starting
Yielded: y2
g2: about to yield from g1
g2: caught ValueError
Yielded: y3


Even though I catch the ValueError (raised on generator reentry) at the 
position where I run the yield from, the outer generator (g1) does not 
continue to run after the termination of g2. It shouldn't normally have an 
impact on the running g1 that someone attempts to jump back into it, but it 
clearly does here.

I noticed this while trying to adapt the implementation for Cython, because the 
original test was one of the few failing cases and it made the code jump 
through the generator support code quite wildly.

--
components: Interpreter Core
messages: 155072
nosy: scoder
priority: normal
severity: normal
status: open
title: yield from kills generator on re-entry
type: behavior
versions: Python 3.3

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



[issue14208] No way to recover original argv with python -m

2012-03-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

In framing a question for Raymond regarding his preference for avoiding the 
__argv__ name, I realised I agreed with him. My reasoning is that, when a 
Python process starts, sys.stdin is sys.__stdin__, sys.stdout is sys.__stdout__ 
and sys.stderr is sys.__stderr__. The dunder versions capture the original 
values as created by the interpreter initialisation, not the raw OS level file 
descriptors.

The new attribute proposed here is different - it's not an immutable copy of 
the original value of sys.argv, it's a *different* sequence altogether. The 
analogy with the standard stream initial value capture created by the use of 
sys.__argv__ would actually be misleading rather than helpful.

For the same reason, Raymond's specific argv_original suggestion doesn't really 
work for me. Alas, I can think of several other possible colours for that 
particular bikeshed (such as argv_os, argv_main, argv_raw, argv_platform, 
argv_executable) without having any particular good way of choosing between 
them.

--

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



[issue11379] Remove lightweight from minidom description

2012-03-07 Thread Éric Araujo

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

FYI, note that http://wiki.python.org/moin/MiniDom says this about minidom: 
“slow and very memory hungry DOM implementation”.

As you have seen, I have applied my ToC order change.  Now in order to commit 
my s/lightweight/minimal/ change and close this report, can you Eli say if 
minidom-desc-2 is okay (I’m asking you because this patch touches text you just 
added, contrary to minidom-desc)?

--

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



[issue14202] The docs of xml.dom.pulldom are almost nonexistent

2012-03-07 Thread Éric Araujo

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

Merged Florian’s version with the original file to create a patch.

--
Added file: http://bugs.python.org/file24752/pulldom-documentation.rst

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



[issue14218] include rendered output in addition to markup

2012-03-07 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe tshep...@gmail.com added the comment:

 Sandro Tosi sandro.t...@gmail.com added the comment:

 3.1 and 2.6 as in security fix only: please don't add those versions for 
 non-sec issue

Sorry, I thought there was an exception for documentation issues.

--

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



[issue11379] Remove lightweight from minidom description

2012-03-07 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 FYI, note that http://wiki.python.org/moin/MiniDom says this about  
 minidom: “slow and very memory hungry DOM implementation”.

Thanks for the notice; I have now fixed that wording.

--

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



[issue11379] Remove lightweight from minidom description

2012-03-07 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Éric,

I'm ok with replacing lightweight by minimal, unless others have 
objections. Regarding the specifics of the minidom-desc-2.diff patch:

   proficient with the DOM

I'm not sure the DOM is semantically correct. the W3C-DOM interface is more 
precise.

Also, I still think that a note would be more appropriate, but I don't care 
enough to argue about it :)

--

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



  1   2   >