ANN: HDF5 for Python (h5py) 1.3.0

2010-03-17 Thread Andrew Collette
HDF5 for Python (h5py) 1.3.0 HDF5 for Python 1.3.0 is now available. This is a significant release introducing a number of new features, including support for soft/external links as well as object and region references. What is h5py? - HDF5 for Python

Re: Dynamic Class Creation

2010-03-17 Thread Josh English
Chris, Thanks. This worked for the attributes, but I think the tactic is still misleading. There are child elements I can't quite determine how to deal with: market code='anlg' tier='ProMarket' mail='True' title field=prefAnalog Science Fiction and Fact/title nicknameAnalog/nickname

Re: Converting Python CGI to WSGI scripts

2010-03-17 Thread John Nagle
Sebastian Bassi wrote: On Tue, Mar 16, 2010 at 2:18 PM, pyt...@bdurham.com wrote: I have a few dozen simple Python CGI scripts. Are there any advantages or disadvantages to rewriting these CGI scripts as WSGI scripts? It depends of the script. WSGI should be faster since you don't start a

Re: C-API PyObject_Call

2010-03-17 Thread Stefan Behnel
moerchendiser2k3, 16.03.2010 19:25: Hi, currently I am not at home, I will post some stuff when I am back. Just the note: I throw an exception with the C API. Looks like that PyObject *result = PyObject_Call(my_isntance, , NULL); if(result==NULL) { PyErr_Print(); //when this happens, the

Re: import antigravity

2010-03-17 Thread Stefan Behnel
Michael Rudolf, 17.03.2010 00:48: Am 16.03.2010 21:44, schrieb Mark Lawrence: Who actually *IS* running the time machine? Are there any bugs?? My is. And as I'm a lazy hacker: sure. there are bugs. lets just call them features and move on. nothing to see here ;) I'll know it, I'll just know

Re: C++ code generation

2010-03-17 Thread Stefan Behnel
CHEN Guang, 17.03.2010 02:54: - Original Message - From: Dan Goodmandg.gm...@thesamovar.net I'm doing some C++ code generation using Python, and would be interested in any comments on the approach I'm taking. PythoidC ( http://pythoidc.googlecode.com ) is a C code generator (not C++)

Re: Function that knows its argument's variable name

2010-03-17 Thread Tino Wildenhain
Hi, Am 14.03.2010 12:58, schrieb Helge Stenström: I want to write function that prints a value of a variable, for debugging. Like: with myVariable = parrot otherVariable = dead probe(myVariable) probe(otherVariable) instead of the longer print myVariable = , myVariable print otherVariable

using DictionaryServices module to get work with python2.6 #OSXspecific

2010-03-17 Thread Shashwat Anand
I wanted to use dictionary in my OSX terminal. So I wrote a function dict() in my ~/.bash_profile dict () { python2.5 -c 'import sys, DictionaryServices; word = .join(sys.argv[1:]); print DictionaryServices.DCSCopyTextDefinition(None, word, (0, len(word)))' $@ } here is the output:

Timer

2010-03-17 Thread Sam Bull
I'm writing a pyGTK program, and I need to display the contents of a window for a few seconds before automatically moving on. I have tried using the time.sleep method, but this has problems, such as the program becoming unresponsive. I have now attempted to use a timer, but this does not seem to

Re: Dynamic Class Creation

2010-03-17 Thread Gerard Flanagan
Josh English wrote: Chris, Thanks. This worked for the attributes, but I think the tactic is still misleading. There are child elements I can't quite determine how to deal with: market code='anlg' tier='ProMarket' mail='True' title field=prefAnalog Science Fiction and Fact/title

Re: using DictionaryServices module to get work with python2.6 #OSXspecific

2010-03-17 Thread Mark Lawrence
Shashwat Anand wrote: I wanted to use dictionary in my OSX terminal. So I wrote a function dict() in my ~/.bash_profile dict () { python2.5 -c 'import sys, DictionaryServices; word = .join(sys.argv[1:]); print DictionaryServices.DCSCopyTextDefinition(None, word, (0, len(word)))' $@ } here

RE: How to add a library path to pythonpath ?

2010-03-17 Thread Barak, Ron
-Original Message- From: Dave Angel [mailto:da...@ieee.org] Sent: Tuesday, March 16, 2010 6:24 PM To: Barak, Ron Cc: Pablo Recio Quijano; python-list@python.org Subject: Re: How to add a library path to pythonpath ? Barak, Ron wrote: -Original Message- From: Dave

Re: Python bindings tutorial

2010-03-17 Thread mikelisa...@gmail.com
On Mar 16, 3:12 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 16 Mar 2010 13:20:40 -0300, Johny pyt...@hope.cz escribió: Is there any tutorial how to write a bindings for a exe ( dos) program? I would like to run it from a Python directly ( using import command and a

RE: How to handle file uploads with http.server

2010-03-17 Thread Neil Blue
Thanks Gabriel Yep, that looks like the same one. Cheers Neil -Original Message- From: Gabriel Genellina [mailto:gagsl-...@yahoo.com.ar] Sent: 17 March 2010 02:08 To: python-list@python.org Subject: Re: How to handle file uploads with http.server En Thu, 11 Mar 2010 07:30:24

Re: to pass self or not to pass self

2010-03-17 Thread Bruno Desthuilliers
Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry t...@urandom.ca wrote: Why not create the bound methods at instantiation time, rather than using the descriptor protocol which has the overhead of creating a new bound method each time the method attribute is accessed? Well, for

Re: using DictionaryServices module to get work with python2.6 #OSXspecific

2010-03-17 Thread Shashwat Anand
Are you thinking of this? http://pypi.python.org/pypi/pyobjc-framework-DictionaryServices/2.2 I get the same IndexError while working with this wrapper. My guess is python2.6 does not support DictionaryServices on Snow Leopard . -- http://mail.python.org/mailman/listinfo/python-list

Re: Timer

2010-03-17 Thread Peter Otten
Sam Bull wrote: I'm writing a pyGTK program, and I need to display the contents of a window for a few seconds before automatically moving on. I have tried using the time.sleep method, but this has problems, such as the program becoming unresponsive. I have now attempted to use a timer, but

Re: Python bindings tutorial

2010-03-17 Thread Stefan Behnel
mikelisa...@gmail.com, 17.03.2010 10:08: Its interesting you've mentioned the hard work involved in this interface (binding to an EXE instead of a DLL). A year or more ago I was looking at interfacing IPMITOOL to python. Do to the problems incurred with swig/python I switched to a running the

RE: How to add a library path to pythonpath ?

2010-03-17 Thread Barak, Ron
-Original Message- From: Mark Hammond [mailto:skippy.hamm...@gmail.com] Sent: Wednesday, March 17, 2010 2:08 AM To: Barak, Ron Cc: Pablo Recio Quijano; python-list@python.org Subject: Re: How to add a library path to pythonpath ? On 17/03/2010 1:26 AM, Barak, Ron wrote:

Castrated traceback in sys.exc_info()

2010-03-17 Thread Pakal
Hello I've just realized recently that sys.exc_info() didn't return a full traceback for exception concerned : it actually only contains the frame below the point of exception catching. That's very annoying to me, because I planned to log such tracebacks with logging.critical(*,

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 04:32 PM, Steven D'Aprano wrote: On Wed, 17 Mar 2010 15:57:17 +1100, Lie Ryan wrote: Most people probably would never need to use descriptor protocol directly, since the immediate benefit of descriptor protocol are property(), classmethod(), and instancemethod() decorators

Re: datetime string conversion error

2010-03-17 Thread Dave Angel
Gabriel Genellina wrote: En Tue, 16 Mar 2010 20:31:11 -0300, Josh English joshua.r.engl...@gmail.com escribió: On Mar 16, 11:56 am, Jordan Apgar twistedphr...@gmail.com wrote: here's what I'm doing: date = 2010-03-16 14:46:38.409137 olddate = datetime.strptime(date,%Y-%m-%j %H:%M:%S.%f)

Re: Python bindings tutorial

2010-03-17 Thread Dave Angel
Stefan Behnel wrote: div class=moz-text-flowed style=font-family: -moz-fixedmikelisa...@gmail.com, 17.03.2010 10:08: Its interesting you've mentioned the hard work involved in this interface (binding to an EXE instead of a DLL). A year or more ago I was looking at interfacing IPMITOOL to

Swapping Content of Two Dictionaries.

2010-03-17 Thread Hatem Oraby
Hello, I want to swap the content of two dictionaries, the obvious way to do it is: a = {1:I'am A} b = {2:I'm B} temp = a a = b b = temp However, consider the case in which the dictionary we are referencing lives in another module: #external.py # #a = {1:I'am A} import external temp = external.a

Re: Castrated traceback in sys.exc_info()

2010-03-17 Thread Michael Ricordeau
Hi, to log tracebacks, you can probably try traceback module. I use it like this : import traceback # your code for line in traceback.format_exc().splitlines(): log.trace(line) Le Wed, 17 Mar 2010 03:42:44 -0700 (PDT), Pakal chambon.pas...@gmail.com a écrit : Hello I've just

Re: Python bindings tutorial

2010-03-17 Thread Alf P. Steinbach
* Dave Angel: Stefan Behnel wrote: div class=moz-text-flowed style=font-family: -moz-fixedmikelisa...@gmail.com, 17.03.2010 10:08: Its interesting you've mentioned the hard work involved in this interface (binding to an EXE instead of a DLL). A year or more ago I was looking at interfacing

Re: Python bindings tutorial

2010-03-17 Thread Stefan Behnel
Dave Angel, 17.03.2010 12:14: Stefan Behnel wrote: I think the point here is that executable binaries are not supposed to be used as libraries. Libraries are. That's the difference between a DLL and an executable in the first place. To run an executable, execute it. The subprocess module is the

Re: Swapping Content of Two Dictionaries.

2010-03-17 Thread Peter Otten
Hatem Oraby wrote: Hello, I want to swap the content of two dictionaries, the obvious way to do it is: a = {1:I'am A} b = {2:I'm B} temp = a a = b b = temp That can be simplified to a, b = b, a and is almost certainly the right approach. tempKeys = a.keys() diffKeys = a.keys() -

question about tkinter

2010-03-17 Thread robert schaefer
Hello, This is my first posting to this list so please be gentle - I am new to python and am using it on red-hat linux (I am new to that too). I am responsible for installing open source packages (including python) onto a distributed system of linux boxes. My question is, on python

Re: Castrated traceback in sys.exc_info()

2010-03-17 Thread Pascal Chambon
Hello, traceback functions indeed allow the manipulation of exception tracebacks, but the root problem is that anyway, since that traceback is incomplete, your traceback.format_exc().splitlines() will only provide frames for callee (downward) functions, not caller (upward) ones, starting from the

Re: question about tkinter

2010-03-17 Thread Peter Otten
robert schaefer wrote: This is my first posting to this list so please be gentle - I am new to python and am using it on red-hat linux (I am new to that too). I am responsible for installing open source packages (including python) onto a distributed system of linux boxes. My

Re: Web Hosting Python 3

2010-03-17 Thread python
Hidura, Hello list, i am in a project what need hosting, who give hosting to python3? Check out www.webfaction.com. I'm extremely pleased with this vendor. Highly recommended! Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote: Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry t...@urandom.ca wrote: Why not create the bound methods at instantiation time, rather than using the descriptor protocol which has the overhead of creating a new bound method each

Re: Function that knows its argument's variable name

2010-03-17 Thread Helge Stenström
Thank you to all who answered. Inspection is apparently possible, but too complex for me. Greg's solution does what I want, inserting is no problem. /Helge Not exactly, but you can come close with a little hackery. import sys def print_var(name):    print name, =,

Re: Castrated traceback in sys.exc_info()

2010-03-17 Thread Vinay Sajip
On Mar 17, 10:42 am, Pakal chambon.pas...@gmail.com wrote: Hello I've just realized recently that sys.exc_info() didn't return a full traceback for exception concerned : it actually only contains the frame below the point of exception catching. That's very annoying to me, because I planned

Re: question about tkinter

2010-03-17 Thread robert schaefer
Peter, Most of my life has been dealing with recalcitrant HAL's in one guise or another. These days, I think HAL has permanently taken up residence in Toyota's engine and brakes. Stop the car Dave? Have you changed my oil or even washed me lately? Some serious sneak paths are going on.

multiprocessing on freebsd

2010-03-17 Thread Tim Arnold
Hi, I'm checking to see if multiprocessing works on freebsd for any version of python. My server is about to get upgraded from 6.3 to 8.0 and I'd sure like to be able to use multiprocessing. I think the minimal test would be: - import multiprocessing q =

Re: Web Hosting Python 3

2010-03-17 Thread Hidura
I've saw last night in the help area they support Python3.1, thanks anyway On Wed, Mar 17, 2010 at 9:22 AM, pyt...@bdurham.com wrote: Hidura, Hello list, i am in a project what need hosting, who give hosting to python3? Check out www.webfaction.com. I'm extremely pleased with this

Special characters (^M ^[[D) when I read pxssh::before and write it to a file

2010-03-17 Thread ashwini yal
Hi, I am writing a python script which logs into the machine using pxssh, sends a command, reads the response and writes the response to the file. But, when I open the file in the editor like vi, its showing special characters like ^M and ^[[D instead of spaces or newlines. This is how my code

Re: question about tkinter

2010-03-17 Thread Peter Otten
robert schaefer wrote: tkinter is in two parts: 1. a python wrapper 2. c code Both are present in the 2.6.2 python download. It appears to be a I can't find the library path problem not a file existence problem. 1. gcc can't find the libraries that tkinter c code links to ( I could fix

Re: Swapping Content of Two Dictionaries.

2010-03-17 Thread Stefan Behnel
Hatem Oraby, 17.03.2010 12:26: However, consider the case in which the dictionary we are referencing lives in another module: #external.py # #a = {1:I'am A} import external temp = external.a external.a = b b = temp Looks like the interface of your module is broken. It shouldn't export the

Re: Searching for most pythonic/least stupid way to do something simple

2010-03-17 Thread nn
Michael Torrie wrote: david jensen wrote: of course, changing nn's to: def getOutcomes(myList=[2,5,8,3,5]): low_id = int(myList[0]myList[1]) amountToShare = 2*myList[low_id] remainder = myList[not low_id]-myList[low_id] tail=list(myList[2:]) outcomes =

Re: question about tkinter

2010-03-17 Thread robert schaefer
No, And there's a reason (perhaps not a great one - but I'm got some constraints). I am not the system administrator and the tcl installer wants to be installed as root. I tried it. The rationale for not doing this is that the installation packages that I am administrator for, are all

bug in bdist_wininst cross compile?

2010-03-17 Thread Robin Becker
has anyone had any success with cross compilation and bdist_wininst; I have modified build_ext very slightly to fix a small bug in cross compilation related to library order. That seems to fix setup.py build --plat-name=win-amd64 however, when I try to do a clean build of an exe ie rm -rf

Re: to pass self or not to pass self

2010-03-17 Thread Patrick Maupin
On Mar 17, 4:12 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry t...@urandom.ca wrote: Why not create the bound methods at instantiation time, rather than using the descriptor protocol which has the

Re: Special characters (^M ^[[D) when I read pxssh::before and write it to a file

2010-03-17 Thread Benjamin Kaplan
On Wed, Mar 17, 2010 at 9:54 AM, ashwini yal ashwini...@gmail.com wrote: Hi, I am writing a python script which logs into the machine using pxssh, sends a command, reads the response and writes the response to the file. But, when I open the file in the editor like vi, its showing special

Re: highlight words by regex in pdf files using python

2010-03-17 Thread Peng Yu
On Tue, Mar 16, 2010 at 11:12 PM, Patrick Maupin pmau...@gmail.com wrote: On Mar 4, 6:57 pm, Peng Yu pengyu...@gmail.com wrote: I don't find a general pdf library in python that can do any operations on pdfs. I want to automatically highlight certain words (using regex) in a pdf. Could

Re: to pass self or not to pass self

2010-03-17 Thread Bruno Desthuilliers
Lie Ryan a écrit : On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote: Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry t...@urandom.ca wrote: Why not create the bound methods at instantiation time, rather than using the descriptor protocol which has the overhead of creating a new

Structure accessible by attribute name or index

2010-03-17 Thread Wes Santee
I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd. In trying to figure it out, I've only come across C

Re: highlight words by regex in pdf files using python

2010-03-17 Thread Patrick Maupin
On Wed, Mar 17, 2010 at 9:53 AM, Peng Yu pengyu...@gmail.com wrote: Thank you for your long reply! But I'm not sure if you get my question or not. Acrobat can highlight certain words in pdfs. I could add notes to the highlighted words as well. However, I find that I frequently end up with

Re: Structure accessible by attribute name or index

2010-03-17 Thread Christian Heimes
Wes Santee wrote: I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd. In trying to figure it out,

Nested Scopes unintended behaviour ?

2010-03-17 Thread Michael Sparks
Hi, Is the following behaviour expected ? Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. def Toggler(F, B): ... print F(Hello) ... print F(Hello) ... print F(Hello) ... print F(Hello) ...

Re: multiprocessing on freebsd

2010-03-17 Thread Philip Semanchuk
On Mar 17, 2010, at 9:30 AM, Tim Arnold wrote: Hi, I'm checking to see if multiprocessing works on freebsd for any version of python. My server is about to get upgraded from 6.3 to 8.0 and I'd sure like to be able to use multiprocessing. I think the minimal test would be:

Re: Structure accessible by attribute name or index

2010-03-17 Thread Bruno Desthuilliers
Wes Santee a écrit : I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd. In trying to figure it out,

Re: Structure accessible by attribute name or index

2010-03-17 Thread Bruno Desthuilliers
Christian Heimes a écrit : However Python 2.6 has a new factory that creates a similar datatype called named tuple: http://docs.python.org/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields Duh... Should spend some more time reading 2.6's What's New :( --

Re: Nested Scopes unintended behaviour ?

2010-03-17 Thread Emile van Sebille
On 3/17/2010 8:16 AM Michael Sparks said... Hi, Is the following behaviour expected ? In short, yes. Assignment within a function forces the variable to locals. You can get around it like: Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type help, copyright,

Re: execute bash builtins in python

2010-03-17 Thread Nobody
On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: For shell=True I believe you should provide the command as a single string, not a list of arguments. Using shell=True with an argument list is valid. On Unix, it's seldom what you want: it will invoke /bin/sh to execute the first

pkg-config and Windows

2010-03-17 Thread Johny
I have a program that needs to be installed with setup.py. But there is a problem when I am trying to install the program with setup.py in Windows. When I try to install with python setup.py install it goes like this C:\python setup.py install running install running build running build_py

Re: Structure accessible by attribute name or index

2010-03-17 Thread Wes Santee
On Mar 17, 11:14 am, Christian Heimes li...@cheimes.de wrote: Wes Santee wrote: I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index.  For example, the way os.stat() returns a stat_result or

Win32All On 64-Bit Operating Systems

2010-03-17 Thread Tim Daneliuk
I have a pure-Python program developed on a POSIX platform (FreeBSD) that I'd like to make fully compatible with Windows systems as well. The only conflict arises insofar as this program makes considerable use of the stat UID and GID values, as well as their corresponding user- and group names.

Re: Structure accessible by attribute name or index

2010-03-17 Thread Wes Santee
On Mar 17, 11:34 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Wes Santee a écrit : I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index.  For example, the way

Re: Win32All On 64-Bit Operating Systems

2010-03-17 Thread Tim Golden
On 17/03/2010 16:32, Tim Daneliuk wrote: I have a pure-Python program developed on a POSIX platform (FreeBSD) that I'd like to make fully compatible with Windows systems as well. The only conflict arises insofar as this program makes considerable use of the stat UID and GID values, as well as

Python Documentation website layout changed?

2010-03-17 Thread Andrej Mitrovic
Hi, What happened to the sidebar on the left of the documentation website? It seems to be gone: http://docs.python.org/py3k/index.html I found it quite useful since I can quickly swap between Python2/3 documentation, and between other parts of the documentation as well. --

Re: multiprocessing on freebsd

2010-03-17 Thread Tim Arnold
On Mar 17, 11:26 am, Philip Semanchuk phi...@semanchuk.com wrote: On Mar 17, 2010, at 9:30 AM, Tim Arnold wrote: Hi, I'm checking to see if multiprocessing works on freebsd for any version of python. My server is about to get upgraded from 6.3 to 8.0 and I'd sure like to be able to

Re: execute bash builtins in python

2010-03-17 Thread Chris Colbert
On Wed, Mar 17, 2010 at 11:44 AM, Nobody nob...@nowhere.com wrote: On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: For shell=True I believe you should provide the command as a single string, not a list of arguments. Using shell=True with an argument list is valid. On Unix, it's

Re: Python Documentation website layout changed?

2010-03-17 Thread Andrej Mitrovic
On Mar 17, 6:41 pm, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Hi, What happened to the sidebar on the left of the documentation website? It seems to be gone: http://docs.python.org/py3k/index.html I found it quite useful since I can quickly swap between Python2/3 documentation,

Re: Python Documentation website layout changed?

2010-03-17 Thread Steve Holden
Andrej Mitrovic wrote: On Mar 17, 6:41 pm, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Hi, What happened to the sidebar on the left of the documentation website? It seems to be gone: http://docs.python.org/py3k/index.html I found it quite useful since I can quickly swap between

How to access a web site with an authentication template.

2010-03-17 Thread Anthra Norell
Hi all, I have spent the better part of this day reading docs and googling archives to no avail. About this: I understand that I can access password protected sites with urllib2. However, the protocol seems to be: I try without password and catch the error coming back. The header will then

Re: Win32All On 64-Bit Operating Systems

2010-03-17 Thread Tim Daneliuk
On 3/17/2010 12:05 PM, Tim Golden wrote: On 17/03/2010 16:32, Tim Daneliuk wrote: I have a pure-Python program developed on a POSIX platform (FreeBSD) that I'd like to make fully compatible with Windows systems as well. The only conflict arises insofar as this program makes considerable use

Re: to RG - Lisp lunacy and Perl psychosis

2010-03-17 Thread Xah Lee
2010-03-17 On Mar 10, 9:17 am, Ben Morrow b...@morrow.me.uk wrote: Also, flamebait language-comparison xposts involving Lisp are one of Xah Lee's trademarks. You might want to look into not imitating him/her/it. being a professional programer today, typically you know more than just one

Re: multiprocessing on freebsd

2010-03-17 Thread Martin P. Hellwig
On 03/17/10 13:30, Tim Arnold wrote: Hi, I'm checking to see if multiprocessing works on freebsd for any version of python. My server is about to get upgraded from 6.3 to 8.0 and I'd sure like to be able to use multiprocessing. I think the minimal test would be: - import

Re: to pass self or not to pass self

2010-03-17 Thread Terry Reedy
On 3/17/2010 1:35 AM, Patrick Maupin wrote: def a(s, count, lenfunc): ... for i in xrange(count): ...z = lenfunc(s) ... a('abcdef', 1, len) a('abcdef', 1, str.__len__) Running cPython 2.6 on my machine, len() runs about 3 times faster than str.__len__(). The

Re: Win32All On 64-Bit Operating Systems

2010-03-17 Thread Tim Golden
On 17/03/2010 19:07, Tim Daneliuk wrote: That's not really so. Windows definitely has the notions of users and groups, they just don't quite align with the POSIX model exactly. Yes, my comment was a little blase. I know that Windows has users groups:

Re: Python bindings tutorial

2010-03-17 Thread Terry Reedy
On 3/17/2010 8:18 AM, Stefan Behnel wrote: Dave Angel, 17.03.2010 12:14: Stefan Behnel wrote: I think the point here is that executable binaries are not supposed to be used as libraries. Libraries are. That's the difference between a DLL and an executable in the first place. To run an

Re: question about tkinter

2010-03-17 Thread Terry Reedy
On 3/17/2010 10:33 AM, robert schaefer wrote: No, And there's a reason (perhaps not a great one - but I'm got some constraints). Related to that I tailored Ipython to work with gtk (ipython's default was tkinter) - tailoring was by a command - is there any way to command idle to use gtk?

Re: Nested Scopes unintended behaviour ?

2010-03-17 Thread Terry Reedy
On 3/17/2010 11:44 AM, Emile van Sebille wrote: On 3/17/2010 8:16 AM Michael Sparks said... Hi, Is the following behaviour expected ? In short, yes. Assignment within a function forces the variable to locals. In 3.x, one can declare names to be nonlocal (ie, local to some outer function,

Re: Converting Python CGI to WSGI scripts

2010-03-17 Thread python
Sebastian/John, Thank you very much for your feedback. John: I initially missed the nuance of WSGI scripts being function calls. I suspect your tip has saved me a lot of pain :) Regards, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32All On 64-Bit Operating Systems

2010-03-17 Thread Tim Daneliuk
On 3/17/2010 2:59 PM, Tim Golden wrote: On 17/03/2010 19:07, Tim Daneliuk wrote: That's not really so. Windows definitely has the notions of users and groups, they just don't quite align with the POSIX model exactly. Yes, my comment was a little blase. I know that Windows has users groups:

Re: to pass self or not to pass self

2010-03-17 Thread Patrick Maupin
On Mar 17, 2:55 pm, Terry Reedy tjre...@udel.edu wrote: On 3/17/2010 1:35 AM, Patrick Maupin wrote: def a(s, count, lenfunc): ...     for i in xrange(count): ...        z = lenfunc(s) ...  a('abcdef', 1, len)  a('abcdef', 1, str.__len__) Running cPython 2.6 on my

What Does sys.platform Return On 64 Bit Windows Systems?

2010-03-17 Thread Tim Daneliuk
On older 32 bit Windows systems, sys.platform returns: 'win32' What does it return on 64-bit Windows systems? I'd check myself, but I don't have access to 64-bit Windows. TIA, -- Tim Daneliuk

Re: bug in bdist_wininst cross compile?

2010-03-17 Thread Gabriel Genellina
En Wed, 17 Mar 2010 11:38:16 -0300, Robin Becker ro...@reportlab.com escribió: has anyone had any success with cross compilation and bdist_wininst; I have modified build_ext very slightly to fix a small bug in cross compilation related to library order. Please post your bug report +

os.walk restart

2010-03-17 Thread Keir Vaughan-taylor
I am traversing a large set of directories using for root, dirs, files in os.walk(basedir): run program Being a huge directory set the traversal is taking days to do a traversal. Sometimes it is the case there is a crash because of a programming error. As each directory is processed the name

Re: to pass self or not to pass self

2010-03-17 Thread Joaquin Abian
On Mar 17, 3:43 pm, Patrick Maupin pmau...@gmail.com wrote: On Mar 17, 4:12 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry t...@urandom.ca wrote: Why not create the bound methods at instantiation

Re: How to access a web site with an authentication template.

2010-03-17 Thread Gabriel Genellina
En Wed, 17 Mar 2010 15:43:00 -0300, Anthra Norell anthra.nor...@bluewin.ch escribió: I understand that I can access password protected sites with urllib2. [...] a site I am dealing with, because the opening page does not require a password. It presents an id/password entry template and I

Re: C-API PyObject_Call

2010-03-17 Thread moerchendiser2k3
1) put the line number information into the message string when you raise the exception you mean the line and file information of the C code, right? -- http://mail.python.org/mailman/listinfo/python-list

Re: Swapping Content of Two Dictionaries.

2010-03-17 Thread Steven D'Aprano
On Wed, 17 Mar 2010 13:34:51 +0100, Peter Otten wrote: Hatem Oraby wrote: Hello, I want to swap the content of two dictionaries, the obvious way to do it is: a = {1:I'am A} b = {2:I'm B} temp = a a = b b = temp That can be simplified to a, b = b, a and is almost certainly the

Re: highlight words by regex in pdf files using python

2010-03-17 Thread David Boddie
On Wednesday 17 March 2010 00:47, Aahz wrote: In article af0830ae-1d24-4db9-b721-d6602fedd...@15g2000yqi.googlegroups.com, Peng Yu pengyu...@gmail.com wrote: I don't find a general pdf library in python that can do any operations on pdfs. I want to automatically highlight certain words

Re: os.walk restart

2010-03-17 Thread Steven D'Aprano
On Wed, 17 Mar 2010 15:04:14 -0700, Keir Vaughan-taylor wrote: I am traversing a large set of directories using for root, dirs, files in os.walk(basedir): run program Being a huge directory set the traversal is taking days to do a traversal. Sometimes it is the case there is a crash

url2lib (windows 7) does not notice when network reconnects (getaddrinfo problem)

2010-03-17 Thread News123
Hi, I'd like to write a function, that knows when the 'internet' is reachable. My setup is a windows7 host with a wireless USB modem. The modem might connect / disconnect any time. I thought I write a small function just checking whether I can fetch a url. # script starts import

Re: What Does sys.platform Return On 64 Bit Windows Systems?

2010-03-17 Thread Steven D'Aprano
On Wed, 17 Mar 2010 16:30:19 -0500, Tim Daneliuk wrote: On older 32 bit Windows systems, sys.platform returns: 'win32' What does it return on 64-bit Windows systems? I'd check myself, but I don't have access to 64-bit Windows. According to the docs, it returns win32:

Re: os.walk restart

2010-03-17 Thread Gabriel Genellina
En Wed, 17 Mar 2010 19:04:14 -0300, Keir Vaughan-taylor kei...@gmail.com escribió: I am traversing a large set of directories using for root, dirs, files in os.walk(basedir): run program Being a huge directory set the traversal is taking days to do a traversal. Sometimes it is the case

Re: to pass self or not to pass self

2010-03-17 Thread Patrick Maupin
On Mar 17, 5:34 pm, Joaquin Abian gatoyga...@gmail.com wrote: On Mar 17, 3:43 pm, Patrick Maupin pmau...@gmail.com wrote: On Mar 17, 4:12 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Patrick Maupin a écrit : On Mar 16, 1:59 pm, Jason Tackaberry

Re: What Does sys.platform Return On 64 Bit Windows Systems?

2010-03-17 Thread Christian Heimes
Tim Daneliuk schrieb: On older 32 bit Windows systems, sys.platform returns: 'win32' What does it return on 64-bit Windows systems? I'd check myself, but I don't have access to 64-bit Windows. Do you want to know if the current build of Python is a 32 or 64bit build? import struct

Re: class inheritance

2010-03-17 Thread Steven D'Aprano
On Mon, 15 Mar 2010 16:34:35 -0700, JLundell wrote: It's also unfortunate that Python doesn't have an approximately-equal operator; it'd come in handy for floating-point applications while preserving hash. If only there were a ~= or ≈ operator I could overload. And ~ is unary, so no joy. Not

Re: to pass self or not to pass self

2010-03-17 Thread Joaquin Abian
On Mar 18, 12:11 am, Patrick Maupin pmau...@gmail.com wrote: On Mar 17, 5:34 pm, Joaquin Abian gatoyga...@gmail.com wrote: On Mar 17, 3:43 pm, Patrick Maupin pmau...@gmail.com wrote: On Mar 17, 4:12 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote:

Possible to open a file for shared write mode under Windows?

2010-03-17 Thread python
Is there a way to open a file for shared write mode under Windows? I have 2 processes that will write to different regions of this shared file. Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk restart

2010-03-17 Thread alex23
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: # Untested last_visited = open(last_visited.txt, 'r').read() for root, dirs, files in os.walk(last_visited or basedir):      open(last_visited.txt, 'w').write(root)      run program Wouldn't this only walk the directory the

Re: os.walk restart

2010-03-17 Thread MRAB
Keir Vaughan-taylor wrote: I am traversing a large set of directories using for root, dirs, files in os.walk(basedir): run program Being a huge directory set the traversal is taking days to do a traversal. Sometimes it is the case there is a crash because of a programming error. As each

Re: os.walk restart

2010-03-17 Thread Steve Howell
On Mar 17, 3:04 pm, Keir Vaughan-taylor kei...@gmail.com wrote: I am traversing a large set of directories using for root, dirs, files in os.walk(basedir):     run program Being a huge directory set the traversal is taking days to do a traversal. Sometimes it is the case there is a crash

Re: os.walk restart

2010-03-17 Thread Steven D'Aprano
On Wed, 17 Mar 2010 20:08:48 -0700, alex23 wrote: Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: # Untested last_visited = open(last_visited.txt, 'r').read() for root, dirs, files in os.walk(last_visited or basedir):      open(last_visited.txt, 'w').write(root) run program

  1   2   >