Announcing www.python-excel.org

2009-06-19 Thread Chris Withers
Hi All, Google unfortunately has a knack of presenting prospective Python users who need to work with Excel files with information that is now really rather out of date. To try and help with this, I've setup a small website at: http://www.python-excel.org ...to try and list the latest

Tutorial on working with Excel files in Python (without COM and cross platform!) at EuroPython 2009

2009-06-19 Thread Chris Withers
Hi All, Too many people in the Python community *still* think the only way to work with Excel files in Python is using COM on Windows. To try and correct this, I'm giving a tutorial at this year's EuroPython conference in Birmingham, UK on Monday, 29th June that will cover working with

xlutils 1.3.2 released!

2009-06-19 Thread Chris Withers
Hi All, I'm pleased to announce a new release of xlutils. This is a small collection of utilities that make use of both xlrd and xlwt to process Microsoft Excel files. The list of utilities included in this release are: xlutils.copy Tools for copying xlrd.Book objects to xlwt.Workbook

TestFixtures 1.6.0 released!

2009-06-19 Thread Chris Withers
Hi All, I'm pleased to announce the first advertised release of TestFixtures. This is a collection of helpers and mock objects that are useful when writing unit tests or doc tests. The modules currently included are: *Comparison* This class lets you instantiate placeholders that can be

PSF Community Awards go to Stephan Deibel Sean Reifschneider

2009-06-19 Thread David Goodger
[Also posted to the PSF blog: http://pyfound.blogspot.com/2009/06/second-quarter-community-service-awards.html] The Foundation tries to recognize those whose assistance has been significant in its growth and development as well as its day-to-day operations. This quarter's Community Service Award

Python Essential Reference, 4th Edition

2009-06-19 Thread David Beazley
* * Python Essential Reference, 4th Edition * * by David Beazley I'm pleased to announce the release of the Python Essential Reference, 4th edition, soon to be appearing at a bookstore near you. More than a year in development, this edition covers Python

MailingLogger 3.3.0 Released!

2009-06-19 Thread Chris Withers
I'm pleased to announce a new release of Mailinglogger. Mailinglogger provides two handlers for the standard python logging framework that enable log entries to be emailed either as the entries are logged or as a summary at the end of the running process. The handlers have the following

ErrorHandler 1.0.0 Released!

2009-06-19 Thread Chris Withers
I'm pleased to finally get around to announcing the release of ErrorHandler. This is a handler for the python standard logging framework that can be used to tell whether messages have been logged at or above a certain level. This can be useful when wanting to ensure that no errors have been

Re: Is this pylint error message valid or silly?

2009-06-19 Thread Terry Reedy
Matthew Wilson wrote: Here's the code that I'm feeding to pylint: $ cat f.py from datetime import datetime def f(c=today): pylint infers that you intend users to pass a string. Human would guess the same at this point. if c == today: c =

Integer Division

2009-06-19 Thread Anjanesh Lekshminarayanan
a = 1 b = 25 a / b 0 float(a) / b 0.040001 from __future__ import division a = 1 b = 25 a / b 0.040001 In what simple way can I get just 0.04 ? -- Anjanesh Lekshmnarayanan -- http://mail.python.org/mailman/listinfo/python-list

Re: Integer Division

2009-06-19 Thread Chris Rebert
On Fri, Jun 19, 2009 at 12:22 AM, Anjanesh Lekshminarayananm...@anjanesh.net wrote: a = 1 b = 25 a / b 0 float(a) / b 0.040001 from __future__ import division a = 1 b = 25 a / b 0.040001 In what simple way can I get just 0.04 ? Note that what you are shown

Re: Newbie queue question

2009-06-19 Thread Jure Erznožnik
I've done some further testing on the subject: I also added some calculations in the main loop to see what effect they would have on speed. Of course, I also added the same calculations to the single threaded functions. They were simple summary functions, like average, sum, etc. Almost no

Re: walking a directory with very many files

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 17:53:40 +1200 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message 20090618081423.2e035...@coercion, Mike Kazantsev wrote: On Thu, 18 Jun 2009 10:33:49 +1200 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message

MailingLogger 3.3.0 Released!

2009-06-19 Thread Chris Withers
I'm pleased to announce a new release of Mailinglogger. Mailinglogger provides two handlers for the standard python logging framework that enable log entries to be emailed either as the entries are logged or as a summary at the end of the running process. The handlers have the following

Re: Integer Division

2009-06-19 Thread Mark Dickinson
On Jun 19, 8:22 am, Anjanesh Lekshminarayanan m...@anjanesh.net wrote: a = 1 b = 25 a / b 0 float(a) / b 0.040001 Python typically stores floats in binary, not decimal. The value 0.04 isn't exactly representable in binary, so the division float(1)/25 can't produce 0.04:

Slow wxPyhon on Vista?

2009-06-19 Thread Martin Schöön
Hello there, this might be my first post here and it is slightly off topic since it is not about something I am developing. At work use a nifty little program called Task Coach. It helps me keep track of what I spend time on. Here is my problem. When I use it on a Vista box its user interface

Re: Newbie queue question

2009-06-19 Thread Jure Erznožnik
Digging further, I found this: http://www.oreillynet.com/onlamp/blog/2005/10/does_python_have_a_concurrency.html Looking up on this info, I found this: http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock If this is correct, no amount of threading would ever help

Re: Newbie queue question

2009-06-19 Thread Tim Harig
On 2009-06-19, =?windows-1252?Q?Jure_Erzno=9Enik?= jure.erznoz...@gmail.com wrote: If this is correct, no amount of threading would ever help in Python since only one core / CPU could *by design* ever be utilized. Except for the code that accesses *no* functions / memory at all. Don't

Re: Help: Group based synchronize decorator

2009-06-19 Thread Piet van Oostrum
Vishal Shetye vishal_she...@persistent.co.in (VS) wrote: VS I want to synchronize calls using rw locks per 'group' and my implementation is similar to VS http://code.activestate.com/recipes/465057/ VS except that I have my own Lock implementation. VS All my synchronized functions take

Re: Once again, comparison wxpython with PyQt

2009-06-19 Thread Jeremy Sanders
Hans Müller wrote: Thanks for all your informative replies. If I understand you right, for a commercial, closed source program I only need a commercial PyQt license for ~ 500€ ? Why not ask the guys at riverbankcomputing? http://www.riverbankcomputing.co.uk/commercial/pyqt This page

Re: Tutorial on working with Excel files in Python (without COM and cross platform!) at EuroPython 2009

2009-06-19 Thread Piet van Oostrum
John Machin sjmac...@lexicon.net (JM) wrote: JM [1] No kidding: http://www.google.com/patents/about?id=QMwnEBAJ Apart from these patents probably being silly, why don't they just write the code in Python? :=) -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP

ErrorHandler 1.0.0 Released!

2009-06-19 Thread Chris Withers
I'm pleased to finally get around to announcing the release of ErrorHandler. This is a handler for the python standard logging framework that can be used to tell whether messages have been logged at or above a certain level. This can be useful when wanting to ensure that no errors have been

Excel Formulae in Python ;-)

2009-06-19 Thread Chris Withers
Piet van Oostrum wrote: John Machin sjmac...@lexicon.net (JM) wrote: JM [1] No kidding: http://www.google.com/patents/about?id=QMwnEBAJ Apart from these patents probably being silly, why don't they just write the code in Python? :=) Would be cool, but there are things like Resolver

Re: CAD file format specifications?

2009-06-19 Thread PoD
On Thu, 18 Jun 2009 13:39:28 +0200, Anthra Norell wrote: I had a look at Blender. It looks impressive too. It might be an alternative to Sketch Up. I'll worry about that later. My immediate need is a file conversion utility. A cursory inspection of Blender's menu tabs and the various

Re: A question on scope...

2009-06-19 Thread Bruno Desthuilliers
MRAB a écrit : Wells Oliver wrote: NB : answering the OP (original post didn't show up on c.l.py ???) In writing out python classes, it seems the 'self' is optional, You mean, inside a method ? meaning that inside a class method, warning topic=semantic issue In Python, a class method

Status of Python threading support (GIL removal)?

2009-06-19 Thread Jure Erznožnik
See here for introduction: http://groups.google.si/group/comp.lang.python/browse_thread/thread/370f8a1747f0fb91 Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place. Effectively, this causes the

Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

2009-06-19 Thread Gerhard Häring
Gabriel Rossetti wrote: Hello everyone, I get an OperationalError with sqlite3 if I put the wrong column name, but shouldn't that be a ProgrammingError instead? I read PEP 249 and it says : OperationalError Exception raised for errors that are related to the

Re: preferring [] or () in list of error codes?

2009-06-19 Thread Albert van der Horst
In article pan.2009.06.09.03.18...@remove.this.cybersource.com.au, But practicality beats purity -- there are many scenarios where we make compromises in our meaning in order to get correct, efficient code. E.g. we use floats, despite them being a poor substitute for the abstract Real numbers we

Re: Allocating memory to pass back via ctypes callback function

2009-06-19 Thread Scott
I think I found the answer to my own question. Can anyone spot any issues with the following solution? The application I'm writing will be hitting these callbacks pretty heavily so I'm nervous about mucking up the memory management and creating one of those bugs that passes undetected through

Re: Integer Division

2009-06-19 Thread Piet van Oostrum
Anjanesh Lekshminarayanan m...@anjanesh.net (AL) escribió: a = 1 b = 25 a / b AL 0 float(a) / b AL 0.040001 from __future__ import division a = 1 b = 25 a / b AL 0.040001 AL In what simple way can I get just 0.04 ? In addition to the answers others have

Re: Excel Formulae in Python ;-)

2009-06-19 Thread Piet van Oostrum
Chris Withers ch...@simplistix.co.uk (CW) wrote: CW Piet van Oostrum wrote: John Machin sjmac...@lexicon.net (JM) wrote: JM [1] No kidding: http://www.google.com/patents/about?id=QMwnEBAJ Apart from these patents probably being silly, why don't they just write the code in Python? :=)

Re: Newbie queue question

2009-06-19 Thread Piet van Oostrum
Jure Erznožnik jure.erznoz...@gmail.com (JE) wrote: JE Digging further, I found this: JE http://www.oreillynet.com/onlamp/blog/2005/10/does_python_have_a_concurrency.html JE Looking up on this info, I found this: JE

Re: Integer Division

2009-06-19 Thread Dave Angel
Anjanesh Lekshminarayanan wrote: a = 1 b = 25 a / b 0 float(a) / b 0.040001 from __future__ import division a = 1 b = 25 a / b 0.040001 In what simple way can I get just 0.04 ? Your subject line says Integer Division but

Re: preferring [] or () in list of error codes?

2009-06-19 Thread Ben Finney
Albert van der Horst alb...@spenarnc.xs4all.nl writes: But I greatly prefer a set for i in {point1,point2,point3}: statements Agreed, for the reasons you cite. I think this idiom can be expected to become more common and hopefully displace using a tuple literal or

Re: generator expression works in shell, NameError in script

2009-06-19 Thread Bruno Desthuilliers
Emile van Sebille a écrit : On 6/17/2009 3:54 PM ssc said... Wow! Didn't expect that kind of instant support. Thank you very much, I'll give both zip and enumerate a try. The code I've shown is actually copied pretty straight from a Django form class, but I didn't want to mention that as not

Decorator question (how to test if decorated function is in a class)

2009-06-19 Thread Martin P. Hellwig
Hi all, I have been trying out to wrap my mind around the advantages of decorators and thought I found a use in one of my experiments. (see code after my sig). Although it works, I think it should be able to do it better. My particular problem is that I want to remove an argument (say always

Re: generator expression works in shell, NameError in script

2009-06-19 Thread Mark Dickinson
On Jun 19, 1:45 pm, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: [...] but it indeed looks like using bar.index *in a generator expression* fails (at least in 2.5.2) :   class Foo(object): ...     bar = ['a', 'b', 'c'] ...     baaz = list((bar.index(b), b) for b

Re: persistent composites

2009-06-19 Thread Aaron Brady
On Jun 17, 3:53 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 17 Jun 2009 16:06:22 +0100, Aaron Brady castiro...@gmail.com   wrote: On Jun 16, 10:09 am, Mike Kazantsev mk.frag...@gmail.com wrote: On Tue, 16 Jun 2009 06:57:13 -0700 (PDT) Aaron Brady castiro...@gmail.com

Re: Is this pylint error message valid or silly?

2009-06-19 Thread Matthew Wilson
On Fri 19 Jun 2009 02:55:52 AM EDT, Terry Reedy wrote: if c == today: c = datetime.today() Now I guess that you actually intend c to be passed as a datetime object. You only used the string as a type annotation, not as a real default value. Something like

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Tyler Laing
This is a very long-running issue, that has been discussed many times. Here are the two sides to keeping the gil or removing it: Remove the GIL: - True multi-threaded programming - Scalable performance across a multi-core machine - Unfortunately, this causes a slow-down in single

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Ben Charrow
Jure Erznožnik wrote: See here for introduction: http://groups.google.si/group/comp.lang.python/browse_thread/thread/370f8a1747f0fb91 Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place.

Re: Is this pylint error message valid or silly?

2009-06-19 Thread Rhodri James
On Fri, 19 Jun 2009 14:36:01 +0100, Matthew Wilson m...@tplus1.com wrote: On Fri 19 Jun 2009 02:55:52 AM EDT, Terry Reedy wrote: if c == today: c = datetime.today() Now I guess that you actually intend c to be passed as a datetime object. You only used the string

Re: persistent composites

2009-06-19 Thread Rhodri James
On Fri, 19 Jun 2009 14:24:34 +0100, Aaron Brady castiro...@gmail.com wrote: You are not being any help, Rhodri, in your question. To you, perhaps not. To me, it has at least had the effect of making what you're trying to do (write a pythonic object database) clearer. -- Rhodri James *-*

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Martin von Loewis
Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place. It's the opposite: Python is exactly thread safe precisely because it has the GIL in place. Is there any other way to work around the issue

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Martin von Loewis
Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place. It's the opposite: Python is exactly thread safe precisely because it has the GIL in place. Is there any other way to work around the issue

Re: Is this pylint error message valid or silly?

2009-06-19 Thread mblume
Am Fri, 19 Jun 2009 00:56:18 + schrieb Matthew Wilson: Here's the code that I'm feeding to pylint: $ cat f.py from datetime import datetime def f(c=today): if c == today: c = datetime.today() return c.date() And here's what

multiprocessing and process run time

2009-06-19 Thread Thomas Robitaille
Hi, I'm making use of the multiprocessing module, and I was wondering if there is an easy way to find out how long a given process has been running for. For example, if I do import multiprocessing as mp import time def time_waster(): time.sleep(1000) p = mp.Process(target=time_waster)

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 11:52, Jure Erznožnik jure.erznoz...@gmail.com wrote: See here for introduction:http://groups.google.si/group/comp.lang.python/browse_thread/thread/3... Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global

Re: Integer Division

2009-06-19 Thread Grant Edwards
On 2009-06-19, Anjanesh Lekshminarayanan m...@anjanesh.net wrote: a = 1 b = 25 a / b 0 float(a) / b 0.040001 from __future__ import division a = 1 b = 25 a / b 0.040001 In what simple way can I get just 0.04 ? You can't. There _is_no_ 0.04 when using

Retrieving column values by column name with MySQLdb

2009-06-19 Thread jorma kala
Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query=select * from employees db=MySQLdb.connect(host=host,user=user,passwd=passwd,db=database) cursor = db.cursor ()

Re: persistent composites

2009-06-19 Thread Aahz
In article be292347-1011-4bb6-b8e9-a5d738827...@u10g2000vbd.googlegroups.com, Aaron Brady castiro...@gmail.com wrote: You are not being any help, Rhodri, in your question. Maybe not, but honestly, you're getting pretty close to going back in my killfile. Although you're no longer trolling

Re: Calling subprocess with arguments

2009-06-19 Thread Tyler Laing
So no one has an answer for why passing flags and the values the flags need through subprocess does not work? I would like an answer. I've examined all the examples I could find online, which were all toy examples, and not helpful to my problem. On Thu, Jun 18, 2009 at 7:40 PM, Tyler Laing

Re: multiprocessing and process run time

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 07:40:11 -0700 (PDT) Thomas Robitaille thomas.robitai...@gmail.com wrote: I'm making use of the multiprocessing module, and I was wondering if there is an easy way to find out how long a given process has been running for. For example, if I do import multiprocessing as

Re: Calling subprocess with arguments

2009-06-19 Thread Javier Collado
Hello, The problem might be that, aside from creating the Popen object, to get the command run you need to call 'communicate' (other options, not used with the Popen object directly, are 'call' or 'waitpid' as explained in the documentation). Did you do that? Best regards, Javier 2009/6/19

Re: GUI(eclipse+pydev/SPE) freeze when doing python auto-completion under Linux

2009-06-19 Thread Fabio Zadrozny
On Fri, Jun 19, 2009 at 12:22 AM, Wei, Xiaohaiwist...@gmail.com wrote: Thanks for your reply. where is the error log? I can not find it at /var/log Take a look at http://pydev.sourceforge.net/faq.html#how_do_i_report_a_bug (it gives the details on how to find the needed info). I have a

Re: Calling subprocess with arguments

2009-06-19 Thread Tyler Laing
I can't use communicate, as it waits for the child process to terminate. Basically it blocks. I'm trying to have dynamic communication between the python program, and vlc. On Fri, Jun 19, 2009 at 8:05 AM, Charles Yeomans char...@declaresub.comwrote: On Jun 19, 2009, at 10:55 AM, Tyler Laing

Re: Calling subprocess with arguments

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 07:55:19 -0700 Tyler Laing trinio...@gmail.com wrote: I want to execute this command string: vlc -I rc This allows vlc to be controlled via a remote interface instead of the normal gui interface. Now, say, I try this from subprocess: p=subprocess.Popen('vlc -I rc

Re: Calling subprocess with arguments

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 08:07:29 -0700 Tyler Laing trinio...@gmail.com wrote: I can't use communicate, as it waits for the child process to terminate. Basically it blocks. I'm trying to have dynamic communication between the python program, and vlc. Unfortunately, subprocess module doesn't allow

Re: multiprocessing and process run time

2009-06-19 Thread OdarR
On 19 juin, 16:40, Thomas Robitaille thomas.robitai...@gmail.com wrote: Hi, I'm making use of the multiprocessing module, and I was wondering if there is an easy way to find out how long a given process has been running for. For example, if I do import multiprocessing as mp import time

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Kushal Kumaran
On Fri, Jun 19, 2009 at 8:16 PM, jorma kalajjk...@gmail.com wrote: Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query=select * from employees

Re: fastest native python database?

2009-06-19 Thread Ethan Furman
Ethan Furman wrote: This body part will be downloaded on demand. Not sure what happened there... here's the text... Howdy, Pierre! I have also written a pure Python implementation of a database, one that uses dBase III or VFP 6 .dbf files. Any chance you could throw it into the mix to

Re: Calling subprocess with arguments

2009-06-19 Thread Tyler Laing
Thanks mike, the idea that maybe some of the info isn't being passed is certainly interesting. Here's the output of os.environ and sys.argv: ty...@surak:~$ cat environ {'XAUTHORITY': '/home/tyler/.Xauthority', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'ORBIT_SOCKETDIR':

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Tim Chase
jorma kala wrote: Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query=select * from employees db=MySQLdb.connect(host=host,user=user,passwd=passwd,db=database) cursor = db.cursor

Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

2009-06-19 Thread John Machin
On Jun 19, 8:20 pm, Gerhard Häring g...@ghaering.de wrote: Gabriel Rossetti wrote: Hello everyone, I get an OperationalError with sqlite3 if I put the wrong column name, but shouldn't that be a ProgrammingError instead? I read PEP 249 and it says :        OperationalError          

Re: Decorator question (how to test if decorated function is in a class)

2009-06-19 Thread Bruno Desthuilliers
Martin P. Hellwig a écrit : Hi all, I have been trying out to wrap my mind around the advantages of decorators and thought I found a use in one of my experiments. (see code after my sig). Although it works, I think it should be able to do it better. My particular problem is that I want to

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 15:46:46 +0100 jorma kala jjk...@gmail.com wrote: Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Try this: db = MySQLdb.Connection(host=host,user=user,passwd=passwd,db=database)

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 10:32:32 -0500 Tim Chase python.l...@tim.thechases.com wrote: Mike gave you a good answer, though I think it's MySQL specific. I don't have to deal with MySQL frequently but I've remembered that I used got the fields out somehow, and now, looking at the code, I wonder

Re: Is this pylint error message valid or silly?

2009-06-19 Thread Terry Reedy
Matthew Wilson wrote: Thanks for the feedback. I think I should have used a more obvious string in my original example and a more descriptive parameter name. So, pretend that instead of c=today I wrote record_date=defaults to today's date. I know my way is unorthodox,

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Stefan Behnel
Jure Erznožnik wrote: See here for introduction: http://groups.google.si/group/comp.lang.python/browse_thread/thread/370f8a1747f0fb91 Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place.

Re: Calling subprocess with arguments

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 08:28:17 -0700 Tyler Laing trinio...@gmail.com wrote: Thanks mike, the idea that maybe some of the info isn't being passed is certainly interesting. Here's the output of os.environ and sys.argv: ... I'm afraid these doesn't make much sense without the output from the

Re: Integer Division

2009-06-19 Thread Terry Reedy
Anjanesh Lekshminarayanan wrote: a = 1 b = 25 a / b 0 float(a) / b 0.040001 from __future__ import division a = 1 b = 25 a / b 0.040001 In what simple way can I get just 0.04 ? Short answer: use 3.1: 1//25 0 1/25 0.04 ;-) But you should really try to

Re: Calling subprocess with arguments

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 22:00:28 +0600 Mike Kazantsev mk.frag...@gmail.com wrote: On Fri, 19 Jun 2009 08:28:17 -0700 Tyler Laing trinio...@gmail.com wrote: Thanks mike, the idea that maybe some of the info isn't being passed is certainly interesting. Here's the output of os.environ and

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Terry Reedy
Jure Erznožnik wrote: See here for introduction: http://groups.google.si/group/comp.lang.python/browse_thread/thread/370f8a1747f0fb91 Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's this Global Interpreter Lock (GIL) in place.

n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Wells Oliver
Writing a class which essentially spiders a site and saves the files locally. On a URLError exception, it sleeps for a second and tries again (on 404 it just moves on). The relevant bit of code, including the offending method: class Handler(threading.Thread): def __init__(self, url):

Re: Calling subprocess with arguments

2009-06-19 Thread Tyler Laing
Sorry, XD. I'll ask the VLC people if they happen to know why VLC won't open up the remote interface. -Tyler On Fri, Jun 19, 2009 at 9:09 AM, Mike Kazantsev mk.frag...@gmail.comwrote: On Fri, 19 Jun 2009 22:00:28 +0600 Mike Kazantsev mk.frag...@gmail.com wrote: On Fri, 19 Jun 2009 08:28:17

Re: n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 11:16:38 -0500 Wells Oliver we...@submute.net wrote: def save(self, uri, location): try: handler = urllib2.urlopen(uri) except urllib2.HTTPError, e: if e.code == 404:

Re: n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Falcolas
On Jun 19, 10:16 am, Wells Oliver we...@submute.net wrote: Writing a class which essentially spiders a site and saves the files locally. On a URLError exception, it sleeps for a second and tries again (on 404 it just moves on). The relevant bit of code, including the offending method: [snip]

Re: n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Diez B. Roggisch
Wells Oliver schrieb: Writing a class which essentially spiders a site and saves the files locally. On a URLError exception, it sleeps for a second and tries again (on 404 it just moves on). The relevant bit of code, including the offending method: class Handler(threading.Thread):

Re: Calling subprocess with arguments

2009-06-19 Thread Tyler Laing
It appears to be an issue specifically with VLC, not subprocess. Thank you guys. The remote interface works through sockets, which is perfectly fine... if I create a local socket, I can have it connect to the socket with command line arguments. On Fri, Jun 19, 2009 at 9:30 AM, Tyler Laing

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 16:16, Martin von Loewis martin.vonloe...@hpi.uni-: If you know that your (C) code is thread safe on its own, you can release the GIL around long-running algorithms, thus using as many CPUs as you have available, in a single process. what do you mean ? Cpython can't benefit from

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Tyler Laing
CPython itself can't... but the c extension can. Mine did. On Fri, Jun 19, 2009 at 9:50 AM, OdarR olivier.da...@gmail.com wrote: On 19 juin, 16:16, Martin von Loewis martin.vonloe...@hpi.uni-: If you know that your (C) code is thread safe on its own, you can release the GIL around

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread skip
If you know that your (C) code is thread safe on its own, you can release the GIL around long-running algorithms, thus using as many CPUs as you have available, in a single process. Olivier what do you mean ? Olivier Cpython can't benefit from multi-core without multiple

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 19:13, s...@pobox.com wrote:     Olivier what do you mean ?     Olivier Cpython can't benefit from multi-core without multiple     Olivier processes. It can, precisely as Martin indicated.  Only one thread at a time can hold the GIL.  That doesn't mean that multiple threads

Convert hash to struct

2009-06-19 Thread Amita Ekbote
Hello, I am retrieving values from a database in the form of a dictionary so I can access the values as d['column'] and I was wondering if there is a way to convert the hash to a struct like format so i can just say d.column. Makes it easier to read and understand. Thanks Amita -- Amita

Re: Measuring Fractal Dimension ?

2009-06-19 Thread David C . Ullrich
Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... On Thu, 18 Jun 2009 17:01:12 -0700 (PDT), Mark Dickinson dicki...@gmail.com wrote: On Jun 18, 7:26 pm, David C. Ullrich ullr...@math.okstate.edu wrote: On Wed, 17

Re: Convert hash to struct

2009-06-19 Thread D'Arcy J.M. Cain
On Fri, 19 Jun 2009 13:17:24 -0500 Amita Ekbote amita.ekb...@gmail.com wrote: I am retrieving values from a database in the form of a dictionary so I can access the values as d['column'] and I was wondering if there is a way to convert the hash to a struct like format so i can just say

Re: walking a directory with very many files

2009-06-19 Thread Lie Ryan
Lawrence D'Oliveiro wrote: In message %zv_l.19493$y61.5...@news-server.bigpond.net.au, Lie Ryan wrote: Yeah, it might be possible to just mv the file from outside, but not being able to enter a directory just because you've got too many files in it is kind of silly. Sounds like a

Re: Convert hash to struct

2009-06-19 Thread Lie Ryan
Amita Ekbote wrote: Hello, I am retrieving values from a database in the form of a dictionary so I can access the values as d['column'] and I was wondering if there is a way to convert the hash to a struct like format so i can just say d.column. Makes it easier to read and understand.

Rich comparison methods don't work in sets?

2009-06-19 Thread Gustavo Narea
Hello, everyone. I've noticed that if I have a class with so-called rich comparison methods (__eq__, __ne__, etc.), when its instances are included in a set, set.__contains__/__eq__ won't call the .__eq__ method of the elements and thus the code below: obj1 = RichComparisonClass() obj2 =

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Christian Heimes
OdarR wrote: I don't see such improvement in the Python library, or maybe you can indicate us some meaningfull example...? I currently only use CPython, with PIL, Reportlab...etc. I don't see improvement on a Core2duo CPU and Python. How to proceed (following what you wrote) ? I've seen a

Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread Carl Banks
On Jun 19, 6:53 am, Ben Charrow bchar...@csail.mit.edu wrote: Jure Erznožnik wrote: See here for introduction: http://groups.google.si/group/comp.lang.python/browse_thread/thread/3... Digging through my problem, I discovered Python isn't exactly thread safe and to solve the issue, there's

Re: Measuring Fractal Dimension ?

2009-06-19 Thread Charles Yeomans
On Jun 19, 2009, at 2:43 PM, David C. Ullrich wrote: Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... On Thu, 18 Jun 2009 17:01:12 -0700 (PDT), Mark Dickinson dicki...@gmail.com wrote: On Jun 18, 7:26 pm, David

timeit and __future__

2009-06-19 Thread Karl Chen
I wanted to time something that uses with_statement, in python2.5. Importing __future__ in the statement or the setup doesn't work since it's not the beginning of the code being compiled. Other than using a separate module, I could only come up with this: timeit.template = 'from __future__

dynamically associate radio buttons with droplists

2009-06-19 Thread Leo Brugud
Hi Folks, Not being very familiar with python, nor with cgi/http, I intend to have 3 of buttons in a webpage, each of them is associate with a file (so I have 3 files, too) What I would like to have is, when users choose a button, the droplist update automatically to load the contents of the

Re: Rich comparison methods don't work in sets?

2009-06-19 Thread Matthew Wilson
On Fri 19 Jun 2009 03:02:44 PM EDT, Gustavo Narea wrote: Hello, everyone. I've noticed that if I have a class with so-called rich comparison methods (__eq__, __ne__, etc.), when its instances are included in a set, set.__contains__/__eq__ won't call the .__eq__ method of the elements and

Re: n00b confusion re: local variable referenced before assignment error

2009-06-19 Thread Dave Angel
Wells Oliver wrote: Writing a class which essentially spiders a site and saves the files locally. On a URLError exception, it sleeps for a second and tries again (on 404 it just moves on). The relevant bit of code, including the offending method: class Handler(threading.Thread): def

Re: Is this pylint error message valid or silly?

2009-06-19 Thread nn
On Jun 18, 8:56 pm, Matthew Wilson m...@tplus1.com wrote: Here's the code that I'm feeding to pylint:     $ cat f.py     from datetime import datetime     def f(c=today):         if c == today:                     c = datetime.today()         return c.date() And here's what pylint

Re: Rich comparison methods don't work in sets?

2009-06-19 Thread Peter Otten
Gustavo Narea wrote: I've noticed that if I have a class with so-called rich comparison methods (__eq__, __ne__, etc.), when its instances are included in a set, set.__contains__/__eq__ won't call the .__eq__ method of the elements and thus the code below: obj1 = RichComparisonClass()

Re: Measuring Fractal Dimension ?

2009-06-19 Thread Mark Dickinson
On Jun 19, 7:43 pm, David C. Ullrich ullr...@math.okstate.edu wrote: Evidently my posts are appearing, since I see replies. I guess the question of why I don't see the posts themselves \is ot here... Judging by this thread, I'm not sure that much is off-topic here. :-) Perhaps not. I'm very

Re: Is this pylint error message valid or silly?

2009-06-19 Thread nn
On Jun 18, 8:56 pm, Matthew Wilson m...@tplus1.com wrote: Here's the code that I'm feeding to pylint:     $ cat f.py     from datetime import datetime     def f(c=today):         if c == today:                     c = datetime.today()         return c.date() And here's what pylint

  1   2   3   >