assigning a sequence to an array

2006-11-07 Thread [EMAIL PROTECTED]
Hi, I am using "A[a,:]=row" in python, where A is a matrix and row is a sequence. But it gives following error: error-- A[a,:]=row ValueError: setting an array element with a sequence. Is there a way to change type of sequence to array so that this situation could be handled tha

Re: [DLC] ChiPy Monthly Meeting, Thursday 7:00 pm.

2006-11-07 Thread Steve Holden
Hendrik van Rooyen wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote: > > >>I don't suppose there's any chance that someone might be passing >>Schaumberg on their way to this meeting? I'm teaching there, and a ride >>would avoid me having to rent a car (and hence increase the probability >>I'd m

Re: unpickling Set as set

2006-11-07 Thread Nick Vatamaniuc
The two are not of the same type: - In : import sets In : s1=sets.Set([1,2,3]) In : s2=set([1,2,3]) In: type(s1) Out: In : type(s2) Out: In : s1==s2 Out: False # oops! In: s2==set(s1) Out: True # aha! -- You'll have to ju

Re: Awesome Python Information

2006-11-07 Thread Tim Roberts
"Dave Setchell" <[EMAIL PROTECTED]> wrote: > >So I'm using a new fangled newsreader...[pan] and thought i'd test it's >posting and headers on this silly thread...sorry if I wasted anyones time!. Well, it's not really correct to call pan a "new-fangled newsreader". I was evaluating it in 1999 as a

Re: [DLC] ChiPy Monthly Meeting, Thursday 7:00 pm.

2006-11-07 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote: > I don't suppose there's any chance that someone might be passing > Schaumberg on their way to this meeting? I'm teaching there, and a ride > would avoid me having to rent a car (and hence increase the probability > I'd make it). Where in the whole wid

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Nick Vatamaniuc
de Lenn, Sorry I assumed the nonzero would work for sparse matrices as well. BUT! -- If the sparse matrix used is the default scipy's sparse.lil_matrix, you just need to print out the representation because the lil_matrix is implemented as a _sequence of non-zero elements_ i.e. just what you n

unpickling Set as set

2006-11-07 Thread Amir Michail
Hi, Is there an easy way to unpickle the older Set as the newer set behind the scenes when using shelve? Amir -- http://mail.python.org/mailman/listinfo/python-list

Re: Python memory usage

2006-11-07 Thread placid
Klaas wrote: > placid wrote: > > Hi All, > > > > Just wondering when i run the following code; > > > > for i in range(100): > > print i > > > > the memory usage of Python spikes and when the range(..) block finishes > > execution the memory usage does not drop down. Is there a way of > >

Re: Python memory usage

2006-11-07 Thread Klaas
placid wrote: > Hi All, > > Just wondering when i run the following code; > > for i in range(100): > print i > > the memory usage of Python spikes and when the range(..) block finishes > execution the memory usage does not drop down. Is there a way of > freeing this memory that range(..) a

Re: Python memory usage

2006-11-07 Thread placid
William Heymann wrote: > On Tuesday 07 November 2006 22:42, placid wrote: > > Hi All, > > > > Just wondering when i run the following code; > > > > for i in range(100): > > print i > > > > the memory usage of Python spikes and when the range(..) block finishes > > execution the memory usa

Re: use of (a**b) (a*b)

2006-11-07 Thread Rares Vernica
Hi, Check out some examples: In [16]: 9./2 Out[16]: 4.5 In [17]: 9.//2 Out[17]: 4 In [18]: 2*3 Out[18]: 6 In [19]: 2**3 Out[19]: 8 Here is the documentation for these operations: http://docs.python.org/lib/typesnumeric.html Regards, Ray Santosh Chikkerur wrote: > Hi Friends, > Let me know th

Re: Python memory usage

2006-11-07 Thread William Heymann
On Tuesday 07 November 2006 22:42, placid wrote: > Hi All, > > Just wondering when i run the following code; > > for i in range(100): > print i > > the memory usage of Python spikes and when the range(..) block finishes > execution the memory usage does not drop down. Is there a way of > f

Re: Python memory usage

2006-11-07 Thread Jorge Vargas
On 7 Nov 2006 21:42:31 -0800, placid <[EMAIL PROTECTED]> wrote: > Hi All, > > Just wondering when i run the following code; > > for i in range(100): > print i > the problem of that is that all the memory is used by the list returned by range which wont be freed until the for loop exits tr

Python memory usage

2006-11-07 Thread placid
Hi All, Just wondering when i run the following code; for i in range(100): print i the memory usage of Python spikes and when the range(..) block finishes execution the memory usage does not drop down. Is there a way of freeing this memory that range(..) allocated? I found this documen

use of (a**b) (a*b)

2006-11-07 Thread Santosh Chikkerur
Hi Friends,Let me know the use of ' ** ' operator and ' \\' use.f=(3*s**2) how is it different, if use only single '*' and also the divide operator.Thanks in advance,Santosh -- http://mail.python.org/mailman/listinfo/python-list

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > So give an example where reference counting is unsafe. Nobody claimed that, in that thread. Instead, the claim was "Atomic increment and decrement instructions are not by themselves sufficient to make reference counting safe." I did give an example, in <[EMAIL PROTECTED]>. E

Weekly Python Patch/Bug Summary

2006-11-07 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 430 open ( -4) / 3447 closed (+17) / 3877 total (+13) Bugs: 922 open ( -7) / 6316 closed (+31) / 7238 total (+24) RFE : 245 open ( +0) / 241 closed ( +1) / 486 total ( +1) New / Reopened Patches __ modulefin

Simple Python Based Genetic Algorithm Framework

2006-11-07 Thread Vishal Patil
Check out a new and simple Python base genetic algorithm framework at http://vishpat.googlepages.com/pgap -- Motivation will almost always beat mere talent. -- http://mail.python.org/mailman/listinfo/python-list

Re: no ptyhon curses module on solaris?

2006-11-07 Thread Shea Martin
Shea Martin wrote: > I just installed active python, and I get this error: > > % python > ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on > Python 2.4.3 (#1, Apr 3 2006, 18:34:02) [C] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. > >>> import

struggling with memory release using ctypes wrapper

2006-11-07 Thread geskerrett
I was wondering if a ctypes expert could point me in the right direction. I am using the wrapper for the "freeimage" library to create multipage TIFF files from a group of png images. The images load and save fine, the problem seems to be that the memory used during the bitmap creation isn't bein

Re: __init__ function problem

2006-11-07 Thread Colin J. Williams
Carl Banks wrote: > kelin,[EMAIL PROTECTED] wrote: >> It says the __init__ is called immediately after an instance of the >> class is created. What dose "immediately" mean? >> And what is difference between the init method and the constructor in >> Java? > > For all intents and purposes, __init__

Re: object data member dumper?

2006-11-07 Thread George Sakkis
tom arnall wrote: > Bruno Desthuilliers wrote: > > > tom arnall a écrit : > >> does anyone know of a utility to do a recursive dump of object data > >> members? > >> > > > > What are "object data members" ? (hint: in Python, everything is an > > object - even functions and methods). > > > > What i

Re: object data member dumper?

2006-11-07 Thread Steve Holden
tom arnall wrote: > Steve Holden wrote: > > >>Bruno Desthuilliers wrote: >> >>>tom arnall a écrit : >>> >>> does anyone know of a utility to do a recursive dump of object data members? >>> >>> >>>What are "object data members" ? (hint: in Python, everything is an >>>object - even fun

no ptyhon curses module on solaris?

2006-11-07 Thread Shea Martin
I just installed active python, and I get this error: % python ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on Python 2.4.3 (#1, Apr 3 2006, 18:34:02) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import curses Traceback (most recent ca

Re: More elegant way to obtain ACLs / permissions for windows directories than using "cacls" dos command?

2006-11-07 Thread Roger Upole
[EMAIL PROTECTED] wrote: > Is there a standard library module in Python 2.4 (Win32) that will > return directory permissions / ACLs (e.g. users, groups, and what > rights they have)? > > Otherwise, I'm faced with sending "cacls dirName" commands via os.popen > as below, and then parsing and compar

Re: __init__ function problem

2006-11-07 Thread kelin,[EMAIL PROTECTED]
Hi, I've read all of this. And I am clear about it. Thanks all. Best Regards! Gabriel Genellina wrote: > At Tuesday 7/11/2006 21:47, Jia Lu wrote: > > > > In Python, the real constructor is called __new__, > > > > Carl Banks > > > >But the code below won't invoke __new__: > > Is this a question, o

Re: __init__ function problem

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 21:47, Jia Lu wrote: > In Python, the real constructor is called __new__, > > Carl Banks But the code below won't invoke __new__: Is this a question, or just for making things more and more confusing to beginners? class Test: def __new__(self, value): prin

Re: Simple Tkinter problem

2006-11-07 Thread jim-on-linux
On Tuesday 07 November 2006 10:38, jim-on-linux wrote: Greg, Run the following code to see how pack_forget() or grid_forget() works, it makes previous widgets disappear but not go away. If you call grid() or pack() again after using grid_forget() the widget returns. root = Tk() class K

Re: psycopg2 faster way to retrieve last x records

2006-11-07 Thread Stuart Bishop
Luis P. Mendes wrote: > Hi, > > I would like to know if there is a better way to do what I'm already doing > as stated in the following example, when using psycopg2 with PostgresQL. > ... > nr_bars_before = 200 > tabela = 'seconds' > sqlString = "SELECT * FROM " + tabela + " OR

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Sandra-24
On Nov 2, 1:32 pm, robert <[EMAIL PROTECTED]> wrote: > I'd like to use multiple CPU cores for selected time consuming Python > computations (incl. numpy/scipy) in a frictionless manner. > > Interprocess communication is tedious and out of question, so I thought about > simply using a more Python

Re: __init__ function problem

2006-11-07 Thread Jia Lu
> In Python, the real constructor is called __new__, > > Carl Banks But the code below won't invoke __new__: [CODE] class Test: def __new__(self, value): print "__new__",value def __init__(self,value): print "__init__",value x = Test("testing") [/CODE] -- http://mail.p

Re: Unicode/ascii encoding nightmare

2006-11-07 Thread Cliff Wells
On Mon, 2006-11-06 at 15:47 -0800, John Machin wrote: > Gabriel Genellina wrote: > > At Monday 6/11/2006 20:34, Robert Kern wrote: > > > > >John Machin wrote: > > > > Indeed yourself. Have you ever considered reading posts in > > > > chronological order, or reading all posts in a thread? > > > > >

psycopg2 faster way to retrieve last x records

2006-11-07 Thread Luis P. Mendes
Hi, I would like to know if there is a better way to do what I'm already doing as stated in the following example, when using psycopg2 with PostgresQL. ... nr_bars_before = 200 tabela = 'seconds' sqlString = "SELECT * FROM " + tabela + " ORDER BY tempounix;" curs = self.conn.cu

Re: simple way to un-nest (flatten?) list

2006-11-07 Thread djc
[EMAIL PROTECTED] wrote: > It is simple, but I suggest you to take a look at the speed of that > part of your code into your program. With this you can see the > difference: > > from time import clock > d = dict((i,range(300)) for i in xrange(300)) > > t = clock() > r1 = sum(d.values(), []) > pri

[ANN] Movable Python 2.0.0 Beta 2

2006-11-07 Thread Fuzzyman
I'm pleased to announce the release of `Movable Python 2.0.0 Beta 2 `_. There are now updated versions for Python 2.2 - 2.5, the Mega-Pack [#]_, and the free trial version. The most important changes in this release are : * Fixes for Pythonwin. The 'run

Re: ctypes, python 2.5, WinFunctionType and _as_parameter_

2006-11-07 Thread gerard5609
Thomas Heller a écrit : > cast(function, c_void_p).value Yes, it works. Many thanks ! Gerard -- http://mail.python.org/mailman/listinfo/python-list

Vector Space Membership

2006-11-07 Thread Jackson
Is there a package which provides a VectorSpace object defined over the Reals, Rationals, Complex, etc? It'd be nice to test membership. -- http://mail.python.org/mailman/listinfo/python-list

Re: object data member dumper?

2006-11-07 Thread tom arnall
Steve Holden wrote: > Bruno Desthuilliers wrote: >> tom arnall a écrit : >> >>>does anyone know of a utility to do a recursive dump of object data >>>members? >>> >> >> >> What are "object data members" ? (hint: in Python, everything is an >> object - even functions and methods). >> >> What is

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Robert Kern
deLenn wrote: > Hi, > > Does scipy have an equivalent to Matlab's 'find' function, to list the > indices of all nonzero elements in a sparse matrix? You will want to ask scipy questions on the scipy list. http://www.scipy.org/Mailing_Lists There is no explicit interface on sparse matrix objec

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread grahamd
Shane Hathaway wrote: > robert wrote: > > I'd like to use multiple CPU cores for selected time consuming Python > > computations (incl. numpy/scipy) in a frictionless manner. > > > > Interprocess communication is tedious and out of question, so I > > thought about simply using a more Python interp

Urgent Requirement for a short-term project for SQL Server Developer with Good experience in Python - Stamford, CT - Duration - 2 to 3 weeks

2006-11-07 Thread IT Recruiter
Hi All, Our Client is looking for a SQL Server Developer with hands-on experience in Python at Stamford, CT. It's a very short term project for 2-3 weeks. Please let me know if you are interested or you know of someone suitable. The Client would prefer to have an in-person meeting too. So, ideally

Re: Pyro stability

2006-11-07 Thread Carl J. Van Arsdall
Steve Holden wrote: > Carl J. Van Arsdall wrote: > >> Paul Boddie wrote: >> >> >>> Beliavsky wrote: >>> >>> >>> Carl J. Van Arsdall wrote: >>> [Enthusiasm for Pyro, not for those with sensitivity to rude words] >>> >>> >>> >>> You should wa

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread deLenn
Thanks for the reply. 'nonzero' deos not seem to work with sparse matrices. here is an example: from scipy import * A = sparse.lil_matrix((3,3)) A[1,2] = 10 A[2,0] = -10 nonzero(A) >>> () (I tried it with an ordinary matrix, and it works fine) Cheers. Nick Vatamaniuc wrote:

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Ross Ridge
Martin v. Löwis wrote: > How would you propose to fix file_repr to prevent such > a race condition? Ross Ridge schrieb: > The race condition you describe is different from the one Joe Seigh > described. It's caused because without GIL access to the file object > is no longer thread safe, not beca

Re: assigning values in __init__

2006-11-07 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > But I do like Steve's suggestion that it's better to be explicit > about each attribute, instead of just accepting a list of numbers > (but I can't help but feel that for some reason this is better, > because it's more general). If you pass a *mapping* o

Re: Pyro stability

2006-11-07 Thread John Henry
Being a non-professional programmer, I've managed to use Pyro to do what I need to do with very minimal fuss. In fact, I don't even understand a lot of what's under the cover. All I did was to mimic what one of the sample program is doing and adapted it to my need. So far I am very happy with Py

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Nick Vatamaniuc
The function you might want is nonzero() or flatnonzero() >>> from numpy import * >>> a=array([ [1,2],[0,4] ]) >>> a array([[1, 2], [0, 4]]) >>> flatnonzero(a) array([0, 1, 3]) nonzero() will return the a sequence of index arrays of non zero elements flatnonzero() returns the non-z

Re: object data member dumper?

2006-11-07 Thread tom arnall
Bruno Desthuilliers wrote: > tom arnall a écrit : >> does anyone know of a utility to do a recursive dump of object data >> members? >> > > What are "object data members" ? (hint: in Python, everything is an > object - even functions and methods). > > What is your real use case ? something lik

Re: object data member dumper?

2006-11-07 Thread Steve Holden
Bruno Desthuilliers wrote: > tom arnall a écrit : > >>does anyone know of a utility to do a recursive dump of object data members? >> > > > What are "object data members" ? (hint: in Python, everything is an > object - even functions and methods). > > What is your real use case ? Basically i

Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread deLenn
Hi, Does scipy have an equivalent to Matlab's 'find' function, to list the indices of all nonzero elements in a sparse matrix? Cheers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode/ascii encoding nightmare

2006-11-07 Thread Cliff Wells
On Tue, 2006-11-07 at 08:10 +0200, Hendrik van Rooyen wrote: > "John Machin" <[EMAIL PROTECTED]> wrote: > > 8<--- > > > I strongly suggest that you read the docs *FIRST*, and don't "tinker" > > at all. > > > This is *good* advice - its unlikely to be followed

Re: Pyro stability

2006-11-07 Thread Steve Holden
Carl J. Van Arsdall wrote: > Paul Boddie wrote: > >>Beliavsky wrote: >> >> >>>Carl J. Van Arsdall wrote: >>> >> >>[Enthusiasm for Pyro, not for those with sensitivity to rude words] >> >> >> >>>You should watch your language in a forum with thousands of readers. >>> > > I think you sh

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 17:43, Sheldon wrote: > And what are those non-static functions used for? The *only* purpose > of your module should be to provide the Python bindings... I wrote the C module to do some number crunching. Now I just need to "connect" it to my python program. Should the initm

Re: Tired of spam, unrelated email?

2006-11-07 Thread BartlebyScrivener
Steven D'Aprano wrote: > Due to the vagaries of Usenet, > I never received the original piece of spam > at all Same here. I do all of my persuing via Google Groups, and sometimes the same thing happens in a legitimate thread. I see somebody responding as the fist message in the thread, but I neve

Compiling python 2.5 on OS X 10.4.8 with bsddb support

2006-11-07 Thread Yi Qiang
Hi guys, I am trying to compile python 2.5 on my OSX machine so it includes the bsddb module. Currently, when I type 'import bsddb' I get the following traceback: /Users/yi/Software/sage-1.4.1.2/local/lib/python2.5/bsddb/__init__.py in () 49 from bsddb3.dbutils import DeadlockWrap as

Re: Tired of spam, unrelated email?

2006-11-07 Thread Steven D'Aprano
On Tue, 07 Nov 2006 14:28:00 -0600, skip wrote: > Tired of spam, unrelated email? > > You mean, like your message? You know what is really funny? Due to the vagaries of Usenet, I never received the original piece of spam at all, so if you hadn't replied to it, I never would have been bother

Re: sqlite query not working

2006-11-07 Thread BartlebyScrivener
John Salerno wrote: >> Ah well, I'm sure there was *something* different Are you sure that it's not you were doing SELECT before, as opposed to INSERT? rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Shane Hathaway
robert wrote: > I'd like to use multiple CPU cores for selected time consuming Python > computations (incl. numpy/scipy) in a frictionless manner. > > Interprocess communication is tedious and out of question, so I > thought about simply using a more Python interpreter instances > (Py_NewInterpret

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Nov 7)

2006-11-07 Thread Chris Lambacher
On Tue, Nov 07, 2006 at 04:15:39PM -0500, John Salerno wrote: > Cameron Laird wrote: > > > Fredrik Lundh collects pyidioms: > > http://effbot.org/zone/python-lists.htm > > Not working? perhaps http://effbot.org/zone/python-list.htm ? -- http://mail.python.org/mailman/listinfo/python-lis

Re: Pyro stability

2006-11-07 Thread Carl J. Van Arsdall
Paul Boddie wrote: > Beliavsky wrote: > >> Carl J. Van Arsdall wrote: >> > > [Enthusiasm for Pyro, not for those with sensitivity to rude words] > > >> You should watch your language in a forum with thousands of readers. >> I think you should find better things to complain about and

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Nov 7)

2006-11-07 Thread Leonhard Vogt
John Salerno schrieb: > Cameron Laird wrote: > >> Fredrik Lundh collects pyidioms: >> http://effbot.org/zone/python-lists.htm > > Not working? Try http://effbot.org/zone/python-list.htm Leonhard -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite query not working

2006-11-07 Thread John Salerno
Tim Chase wrote: > I tinkered with the mx.ODBC drivers a bit and had a similar > difficulty until I realized that it was configured to *not* > autocommit. At least in the mx.ODBC drivers, you can pass a > param ("clear_auto_commit=1") to the Connect() call to restore > "normal" autocommiting beha

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Chaz Ginger
Joe Seigh wrote: > Martin v. Löwis wrote: >> You still didn't say what you would suggest to make it thread-safe >> again; most likely, you proposal would be to add locking. If I >> understand Joe's approach correctly, he has a solution that does >> not involve locking (although I don't understand h

Re: sqlite query not working

2006-11-07 Thread Tim Chase
>> Have you tried adding a self.connection.commit() to the >> code? I don't know whether sqlite is transactional, but if >> it is then the changes will disappear without a commit. > > Wow, that worked! Now, I know I've done some DB work before > (very similar to this) and never used commit(), so I

Re: sound processing modules in python - anyone?

2006-11-07 Thread Christian Aastorp
On Mon, 6 Nov 2006 23:06:18 +0100 (CET), [EMAIL PROTECTED] wrote: >Hi everyone, >I'm looking for a module for sound processing (manipulating sound objets, >filters, ffts etc.). >I tried Snack, but when i downloaded the package that was supposed to be >for python, there was only the Tk/Tcl stuff (w

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Nov 7)

2006-11-07 Thread John Salerno
Cameron Laird wrote: > Fredrik Lundh collects pyidioms: > http://effbot.org/zone/python-lists.htm Not working? -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite query not working

2006-11-07 Thread John Salerno
Steve Holden wrote: > Have you tried adding a self.connection.commit() to the code? I don't > know whether sqlite is transactional, but if it is then the changes will > disappear without a commit. Wow, that worked! Now, I know I've done some DB work before (very similar to this) and never used

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Joe Seigh
Martin v. Löwis wrote: > You still didn't say what you would suggest to make it thread-safe > again; most likely, you proposal would be to add locking. If I > understand Joe's approach correctly, he has a solution that does > not involve locking (although I don't understand how it works). > Sun ha

Re: sqlite query not working

2006-11-07 Thread Steve Holden
John Salerno wrote: > Hopefully this is enough code to reveal the problem. When I run the > program, there are no error messages produced, it's just that the values > I enter don't seem to get put into the database, even though the query > seems to be ok. > > > def OnSaveRecord(self, even

Dr. Dobb's Python-URL! - weekly Python news and links (Nov 7)

2006-11-07 Thread Cameron Laird
QOTW: "If you want to become a good Python programmer, you really need to get over that 'I need a oneliner' idea." - Fredrik Lundh http://groups.google.com/group/comp.lang.python/msg/9e10957173a20e73 "It is the shortsightedness of the Python core developers that keeps the palindrome related f

Re: object data member dumper?

2006-11-07 Thread Bruno Desthuilliers
tom arnall a écrit : > does anyone know of a utility to do a recursive dump of object data members? > What are "object data members" ? (hint: in Python, everything is an object - even functions and methods). What is your real use case ? -- http://mail.python.org/mailman/listinfo/python-list

More elegant way to obtain ACLs / permissions for windows directories than using "cacls" dos command?

2006-11-07 Thread dananrg
Is there a standard library module in Python 2.4 (Win32) that will return directory permissions / ACLs (e.g. users, groups, and what rights they have)? Otherwise, I'm faced with sending "cacls dirName" commands via os.popen as below, and then parsing and comparing the text output. Basically, I'd

sqlite query not working

2006-11-07 Thread John Salerno
Hopefully this is enough code to reveal the problem. When I run the program, there are no error messages produced, it's just that the values I enter don't seem to get put into the database, even though the query seems to be ok. def OnSaveRecord(self, event): textfield_values = []

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > Martin v. Löwis wrote: >> How would you propose to fix file_repr to prevent such >> a race condition? > > The race condition you describe is different from the one Joe Seigh > described. It's caused because without GIL access to the file object > is no longer thread safe, no

Re: C wrapper

2006-11-07 Thread Sheldon
Gabriel Genellina skrev: > At Tuesday 7/11/2006 17:27, Sheldon wrote: > > >Here is the file/module name: _msgpps_functions.c > >Here is the initfunction: > > > >PyMODINIT_FUNC init_msgpps_functions(void) { > > PyObject* m; > > m=Py_InitModule("_msgpps_functions",_msgpps_functionsMethods); > >

Re: C wrapper

2006-11-07 Thread Sheldon
Hi, > For a module called foo.c the initialization function must be called > initfoo (*not* init_foo) Ok, I fixed this part. Thanks > And what are those non-static functions used for? The *only* purpose > of your module should be to provide the Python bindings... I wrote the C module to do so

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 17:27, Sheldon wrote: Here is the file/module name: _msgpps_functions.c Here is the initfunction: PyMODINIT_FUNC init_msgpps_functions(void) { PyObject* m; m=Py_InitModule("_msgpps_functions",_msgpps_functionsMethods); ErrorObject = PyString_FromString("_msgpps_functi

Re: ctypes, python 2.5, WinFunctionType and _as_parameter_

2006-11-07 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hello, > > how to get at the function address of a WinFunctionType ctypes object ? > With ctypes 1.0, I used just myfunc._as_parameter_ and all was well. > With ctypes 1.0.1, that ships with python 2.5, WinFunctionType has no > longer an _as_parameter_ attribute I thi

Re: C wrapper

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 17:10, Sheldon wrote: > Take a look at the documentation for creating extension modules, > especially the following page: > > http://docs.python.org/ext/methodTable.html > > "The initialization function must be named initname(), where name is the > name of the module, and sh

Re: C wrapper

2006-11-07 Thread Sheldon
Robert Kern skrev: > Sheldon wrote: > > > This function is there and is called init_mymodule() but I have other > > functions that are not static. > > Is the module's name "_mymodule"? Or is it "mymodule"? > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harml

Re: Tired of spam, unrelated email?

2006-11-07 Thread skip
Tired of spam, unrelated email? You mean, like your message? Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Character encoding

2006-11-07 Thread Gabriel Genellina
At Tuesday 7/11/2006 17:10, mp wrote: I'd prefer a more generalized solution which takes care of all possible ampersand characters. I assume that there is code already written which does this. Try the htmlentitydefs module -- Gabriel Genellina Softlab SRL _

Re: C wrapper

2006-11-07 Thread Robert Kern
Sheldon wrote: > This function is there and is called init_mymodule() but I have other > functions that are not static. Is the module's name "_mymodule"? Or is it "mymodule"? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by o

Re: C wrapper

2006-11-07 Thread Sheldon
Farshid Lashkari skrev: > Sheldon wrote: > > Can anyone give me some idea as to what this error means? > > > > "ImportError: dynamic module does not define init function " > > > > I am new at this and there is still a lot to learn. > > > > Any help is appreciated, > > Take a look at the documenta

Re: Character encoding

2006-11-07 Thread mp
I'd prefer a more generalized solution which takes care of all possible ampersand characters. I assume that there is code already written which does this. Thanks i80and wrote: > I would suggest using string.replace. Simply replace ' ' with ' ' > for each time it occurs. It doesn't take too much

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Ross Ridge
Martin v. Löwis wrote: > How would you propose to fix file_repr to prevent such > a race condition? The race condition you describe is different from the one Joe Seigh described. It's caused because without GIL access to the file object is no longer thread safe, not because reference counting is

Tired of spam, unrelated email?

2006-11-07 Thread JFletcher
Post you questions on the python forum at http://www.thescripts.com -- http://mail.python.org/mailman/listinfo/python-list

Re: C wrapper

2006-11-07 Thread Farshid Lashkari
Sheldon wrote: > Can anyone give me some idea as to what this error means? > > "ImportError: dynamic module does not define init function " > > I am new at this and there is still a lot to learn. > > Any help is appreciated, Take a look at the documentation for creating extension modules, espe

Re: __init__ function problem

2006-11-07 Thread Carl Banks
kelin,[EMAIL PROTECTED] wrote: > It says the __init__ is called immediately after an instance of the > class is created. What dose "immediately" mean? > And what is difference between the init method and the constructor in > Java? For all intents and purposes, __init__ is a constructor. It isn't

changing sequence to array

2006-11-07 Thread [EMAIL PROTECTED]
Hi, I am using the code given below where A is a matrix and row is a sequence. But it gives following error: error-- A[a,:]=row ValueError: setting an array element with a sequence. --code #!/usr/bin/python import numpy file1 = open('matrix.txt', 'r')

Re: Character encoding

2006-11-07 Thread i80and
I would suggest using string.replace. Simply replace ' ' with ' ' for each time it occurs. It doesn't take too much code. On Nov 7, 1:34 pm, "mp" <[EMAIL PROTECTED]> wrote: > I have html document titles with characters like >,  , and > ‡. How do I decode a string with these values in Python? >

C wrapper

2006-11-07 Thread Sheldon
Hi, Can anyone give me some idea as to what this error means? "ImportError: dynamic module does not define init function " I am new at this and there is still a lot to learn. Any help is appreciated, /Sheldon -- http://mail.python.org/mailman/listinfo/python-list

Character encoding

2006-11-07 Thread mp
I have html document titles with characters like >,  , and ‡. How do I decode a string with these values in Python? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.exists and unicode filenames

2006-11-07 Thread Martin v. Löwis
Peter Bienstman schrieb: > UnicodeEncodeError: 'ascii' codec can't encode characters in position 24-29: > ordinal not in range(128) > > I could try encoding the string in utg-8, but then it wouldn't work under > Windows. > > Is there an elegant cross-platform solution for this? I assume you ar

object data member dumper?

2006-11-07 Thread tom arnall
does anyone know of a utility to do a recursive dump of object data members? -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning values in __init__

2006-11-07 Thread John Salerno
John Salerno wrote: > Is this a good way to assign the values to the different attributes? > Should 'stats' be a list/tuple (like this), or should I do *stats instead? Thanks guys! The main suggestion seems to be to use setattr(), so I might give that a try. But I do like Steve's suggestion tha

os.path.exists and unicode filenames

2006-11-07 Thread Peter Bienstman
Hi, I'm trying to add support for unicode file names to my application. I'm running into problems with e.g. the os.path.exists routine, which complains if it gets passed a unicode string: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mnemosyne/pyqt_ui/main_dlg.py",

But it was yesterday here!

2006-11-07 Thread Sorin Schwimmer
> I bet you have an email.py somewhere in your sources... You won the bet. I owe you one :-)Thanks,Sorin-- http://mail.python.org/mailman/listinfo/python-list

Re: [DLC] ChiPy Monthly Meeting, Thursday 7:00 pm.

2006-11-07 Thread Steve Holden
I don't suppose there's any chance that someone might be passing Schaumberg on their way to this meeting? I'm teaching there, and a ride would avoid me having to rent a car (and hence increase the probability I'd make it). regards Steve [EMAIL PROTECTED] wrote: > Thursday November 9 2006. 7:

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-07 Thread Martin v. Löwis
Ross Ridge schrieb: > The thread that shares it increments the reference count before passing > its address to directly another thread or indirectly through a shared > container. To make a specific example, consider this fragment from Objects/fileobject.c: static PyObject * file_repr(PyFileObject

  1   2   >