Re: Tree structure

2011-07-26 Thread Marco Nawijn
On Jul 26, 6:53 am, Bevan Jenkins wrote: > Hello, > > I am trying to create a tree structure for use with a PyQt QTreeView. > But first I need to get my head around how to create the tree > structure.  I have a dictionary (for testing purposes) but I will > later use a table via sqlalchemy. > > Th

Re: reportlab import error after dundled using py2exe

2011-07-26 Thread SANKAR .
your suggestion worked.Thanks Robin. -Sankar On Mon, Jul 25, 2011 at 8:28 PM, Robin Becker wrote: > On 22/07/2011 03:55, SANKAR . wrote: > >> Hi all, >> >> > > >> C:\Python26\dist>DELchek.exe >> Traceback (most recent call last): >> File "DELchek.py", line 12, in >> File "reportlab\pdf

Selecting unique values

2011-07-26 Thread Kumar Mainali
Greetings I have a dataset with occurrence records of multiple species. I need to get rid of multiple listings of the same occurrence point for a species (as you see below in red and blue typeface). How do I create a dataset only with unique set of longitude and latitude for each species? Thanks i

Re: Selecting unique values

2011-07-26 Thread Chris Angelico
On Tue, Jul 26, 2011 at 8:03 AM, Kumar Mainali wrote: > Greetings > > I have a dataset with occurrence records of multiple species. I need to get > rid of multiple listings of the same occurrence point for a species (as you > see below in red and blue typeface). How do I create a dataset only with

Re: Tree structure

2011-07-26 Thread Peter Otten
Bevan Jenkins wrote: > Hello, > > I am trying to create a tree structure for use with a PyQt QTreeView. > But first I need to get my head around how to create the tree > structure. I have a dictionary (for testing purposes) but I will > later use a table via sqlalchemy. > > The use case is hydr

Re: Selecting unique values

2011-07-26 Thread sparky gmail
On 7/25/2011 3:03 PM, Kumar Mainali wrote: Greetings I have a dataset with occurrence records of multiple species. I need to get rid of multiple listings of the same occurrence point for a species (as you see below in red and blue typeface). How do I create a dataset only with unique set of l

Re: Selecting unique values

2011-07-26 Thread Peter Otten
Kumar Mainali wrote: > I have a dataset with occurrence records of multiple species. I need to > get rid of multiple listings of the same occurrence point for a species > (as you see below in red and blue typeface). How do I create a dataset > only with unique set of longitude and latitude for eac

Re: Trying to learn about metaclasses

2011-07-26 Thread Thomas Jollans
On 26/07/11 04:44, Victor Khangulov wrote: > Hi Steven, > > I too am just learning about metaclasses in Python and I found the > example you posted to be excellent. > > I played around with it and noticed that the issue seems to be the > double-underscore in front of the fields (cls.__fields = {}

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread John Roth
On Jul 25, 8:18 pm, Ned Deily wrote: > In article , Robert > wrote: > > > Is it possible to install the 2 and 3 series side by side? > > Probably.  On Mac OS X, t's certainly possible to install any python.org > versions side by side, even multiple versions of 2 and 3.  That's one of > the advant

Convolution of different sized arrays

2011-07-26 Thread Olenka Subota
Hello all, I need your help. I have to simulate a filter whose transfer function is a step fct, and I wrote it as a column-vector of Ns elements : >>> h=ones(3,dtype=float) >>> print h [ 1. 1. 1.] >>> h=reshape(h,(3,1)) >>> h array([[ 1.], [ 1.], [ 1.]]) In this case Ns=3 for simp

reading zipfile; problem using raw buffer

2011-07-26 Thread Sells, Fred
I'm tring to unzip a buffer that is uploaded to django/python. I can unzip the file in batch mode just fine, but when I get the buffer I get a "BadZipfile exception. I wrote this snippet to try to isolate the issue but I don't understand what's going on. I'm guessing that I'm losing some header/

Re: Convolution of different sized arrays

2011-07-26 Thread Billy Mays
On 07/26/2011 08:10 AM, Olenka Subota wrote: If anyone of you can help, please do it.. Thanks! You would probably get a better answer asking on one of the mailing lists here: http://new.scipy.org/mailing-lists.html -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-26 Thread AlienBaby
> (on limiting line lengths).. I didn't see this mentioned; I have a hard time keeping python code limited to 80 char line lengths _because_ indentation is significant, and can end up consuming quite a lot of linespace itself. Couple that with a liking for long_memorable_explanatory_names, and a

Re: reading zipfile; problem using raw buffer

2011-07-26 Thread Billy Mays
On 07/26/2011 08:42 AM, Sells, Fred wrote: I'm tring to unzip a buffer that is uploaded to django/python. I can unzip the file in batch mode just fine, but when I get the buffer I get a "BadZipfile exception. I wrote this snippet to try to isolate the issue but I don't understand what's going o

Re: reading zipfile; problem using raw buffer

2011-07-26 Thread Peter Otten
Sells, Fred wrote: > I'm tring to unzip a buffer that is uploaded to django/python. I can > unzip the file in batch mode just fine, but when I get the buffer I get > a "BadZipfile exception. I wrote this snippet to try to isolate the > issue but I don't understand what's going on. I'm guessing

Annoucing BRss Feed Reader

2011-07-26 Thread Bidossessi SODONON
Hi list. I've written an offline RSS client using python-gobject and python-dbus. https://sourceforge.net/projects/brss/ Please check it out, and give feedback on how to make it better (especially memory-wise). Any contribution would be greatly appreciated. If this is not the right place for

Is this overuse a context manager?

2011-07-26 Thread Neil Cerutti
I use them all the time now, even when the resource being managed is used for just one line, and never need be assigned an explicit name. Is it good style, or annoying? with open(in_fname, newline='') as in_file: folk = list(csv.DictReader(in_file)) The obvious alternative is: fo

Re: abort python script from trace function

2011-07-26 Thread Dave Stark
Update: I ended getting the desired result by registering a new trace function. In my existing trace function I check the status of the abort button. When it's been triggered I register a NEW trace function using PyEval_SetTrace. I also use PyEval_SetProfile and point them both at my new tra

Only Bytecode, No .py Files

2011-07-26 Thread Eldon Ziegler
Is there a way to have the Python processor look only for bytecode files, not .py files? We are seeing huge numbers of Linux audit messages on production system on which only bytecode files are stored. The audit subsystem is recording each open failure. Thanks, Eldon Ziegler -- http://mail.pyth

RE: reading zipfile; problem using raw buffer

2011-07-26 Thread Sells, Fred
Thanks all, adding the 'rb' and 'wb' solved that test case. The reason I read the file "the hard way" is that I'm testing why I cannot unzip a buffer passed in a file upload using django. While not actually using a file, pointing out the need for the binary option gave me the clue I needed to up

Re: Only Bytecode, No .py Files

2011-07-26 Thread Billy Mays
On 07/26/2011 11:19 AM, Eldon Ziegler wrote: Is there a way to have the Python processor look only for bytecode files, not .py files? We are seeing huge numbers of Linux audit messages on production system on which only bytecode files are stored. The audit subsystem is recording each open failure

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Melton Low
On Tue, Jul 26, 2011 at 9:53 AM, Web Dreamer wrote: > John Roth a écrit ce mardi 26 juillet 2011 14:00 dans <75342033- > abbb-4d59-9654-96d5031dc...@r28g2000prb.googlegroups.com> : > > > On Jul 25, 8:18 pm, Ned Deily wrote: > >> In article , Robert > >> wrote: > >> > >> > Is it possible to inst

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Chris Angelico
On Wed, Jul 27, 2011 at 2:33 AM, Melton Low wrote: > It's probably impractical.  You would need a pair for each version of Python > installed, ie. (PYTHON26PATH,PYTHON26HOME) for 2.6.x, > (PYTHON27PATH,PYTHON27HOME) for 2.7.x, for 3.1.x, for 3.2.x, etc). You could set up a script for each ve

Re: Only Bytecode, No .py Files

2011-07-26 Thread Miki Tebeka
*Maybe* you can cook something with import hooks (see PEP 302). However I think the easier option will be to distribute the .py files as well. -- http://mail.python.org/mailman/listinfo/python-list

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Jeremiah Yongue
It's definitely possible. I've done it myself. On Jul 25, 2011 8:21 PM, "Robert" wrote: > Is it possible to install the 2 and 3 series side by side? > > -- > Robert > > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

RE: Selecting unique values

2011-07-26 Thread Sells, Fred
The set module or function (depends on which python version) will do this if you make each record a tuple. -Original Message- From: python-list-bounces+frsells=adventistcare@python.org [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Peter Otten Sent: Tues

Re: Is this overuse a context manager?

2011-07-26 Thread Ethan Furman
Neil Cerutti wrote: I use them all the time now, even when the resource being managed is used for just one line, and never need be assigned an explicit name. Is it good style, or annoying? with open(in_fname, newline='') as in_file: folk = list(csv.DictReader(in_file)) The obvious a

Re: Is this overuse a context manager?

2011-07-26 Thread Terry Reedy
On 7/26/2011 9:24 AM, Neil Cerutti wrote: I use them all the time now, even when the resource being managed is used for just one line, and never need be assigned an explicit name. Is it good style, or annoying? Annoying to you? or an actual or imagined audience? with open(in_fname, newli

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Ned Deily
In article , Melton Low wrote: [...] > On Mac OS X, a link is automatically installed in /usr/local/bin for each > version of the Python executables, ie python2.7 for the 2.7.x and python3.2 > for 3.2.x. Just invoke your script with the appropriate Python version. > eg. python3.2 yourscript t

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Mark Curphey
Why not use Virtualenv ? http://pypi.python.org/pypi/virtualenv On Mon, Jul 25, 2011 at 5:18 PM, Robert wrote: > Is it possible to install the 2 and 3 series side by side? > > -- > Robert > > > -- > http://mail.python.org/**mailman/listinfo/python-list

Re: Only Bytecode, No .py Files

2011-07-26 Thread Dan Stromberg
Another possibility: You could probably create a bunch of zero-length .py's that are older than the corresponding .pyc's. On Tue, Jul 26, 2011 at 8:19 AM, Eldon Ziegler wrote: > Is there a way to have the Python processor look only for bytecode > files, not .py files? We are seeing huge numbers o

Re: Selecting unique values

2011-07-26 Thread Dan Stromberg
Some good stuff has already been suggested. Another possibility is using a treap (not a duptreap but a treap): http://stromberg.dnsalias.org/~dstromberg/treap/ If you just need things unique'd once, the set + yield is an excellent option. If you need to keep things in order, but also need to ma

Re: Only Bytecode, No .py Files

2011-07-26 Thread Eldon Ziegler
That seemed like a good idea but the .py file was complied even though it was dated 2001-01-01 00:00:00. Python must be checking something beside the date. On Tue, 2011-07-26 at 12:32 -0700, Dan Stromberg wrote: > > Another possibility: You could probably create a bunch of > zero-length .py's th

Re: Only Bytecode, No .py Files

2011-07-26 Thread Terry Reedy
On 7/26/2011 3:32 PM, Dan Stromberg wrote: Another possibility: You could probably create a bunch of zero-length .py's that are older than the corresponding .pyc's. On Tue, Jul 26, 2011 at 8:19 AM, Eldon Ziegler mailto:eld...@atlanticdb.com>> wrote: Is there a way to have the Python proces

Re: Only Bytecode, No .py Files

2011-07-26 Thread Christian Heimes
Am 26.07.2011 23:20, schrieb Eldon Ziegler: > That seemed like a good idea but the .py file was complied even though > it was dated 2001-01-01 00:00:00. Python must be checking something > beside the date. The first four bytes of a pyc file contain the magic header. It must match the magic of the

Re: XRC and AGW

2011-07-26 Thread Ian Kelly
On Tue, Jul 26, 2011 at 4:16 PM, azrael wrote: > Is there a support in the XRC for building advaced graphics widgets (AGW). Yes, create an "unknown" control in the XRC and then use the xrc.AttachUnknownControl method at runtime to swap in whatever widget you want. > also another thing. Is ther s

Re: Tree structure

2011-07-26 Thread Bevan Jenkins
On Jul 26, 8:46 pm, Peter Otten <__pete...@web.de> wrote: > Bevan Jenkins wrote: > > Hello, > > > I am trying to create a tree structure for use with a PyQt QTreeView. > > But first I need to get my head around how to create the tree > > structure.  I have a dictionary (for testing purposes) but I

problem in compiling C API in mingw

2011-07-26 Thread llwaeva
Hi all again, I wonder if so far only Python 2.5.x support c extension. I try the MSVC 2010 and 2008, also try mingw (gcc 4.x.x) and swig. But even I try the simplest example, it said example_wrap.o:example_wrap.c:(.text+0x10ac): undefined reference to `_imp__PyObject_Free' example_wrap.o:ex

@PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-26 Thread rantingrick
The "Fundamental Five" built-in functions There are quite a few helpful built in functions provided to the python programmer however in my mind five of them are the most impo

seeking an example on C extension works in python 3.1.x or above

2011-07-26 Thread llwaeva
Hello, I have been searching the example on C extension that works in python 3.1.x ror above for long time. I tried the simple example given in python document or enclosed in python's src (PC folder), doesn't work, undefined reference to `_imp___Py_NoneStruct' and undefined reference to `_imp

Re: problem in compiling C API in mingw

2011-07-26 Thread Thomas Jollans
On 27/07/11 01:53, llwa...@gmail.com wrote: > > $ python setup.py build --compiler=mingw32 > running build > running build_ext > building 'example' extension > D:\Programs\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files > (x8 > 6)\Python\include" "-Ic:\Program Files (x86)\Python\

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread rantingrick
On Jul 25, 3:00 am, Ulrich Eckhardt wrote: > Chris Angelico wrote: > > > [snip] > > You just gave the OP a fish, he provided a > valuable advise on fishing itself. I always believed the best way to teach someone is not to give them a direct answer. No. Instead i like to offer clues so that the pe

Re: @PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-26 Thread Thomas Jollans
Beyond! On 27/07/11 02:01, rantingrick wrote: > -- > 1. help() > -- > -- > 2. dir() > -- Pro tip: the "I

Re: PEP 8 and extraneous whitespace

2011-07-26 Thread Steven D'Aprano
AlienBaby wrote: >> (on limiting line lengths).. > > I didn't see this mentioned; > > I have a hard time keeping python code limited to 80 char line lengths > _because_ indentation is significant, Are you suggesting that if indentation was not significant, you wouldn't write such long lines? *

Re: seeking an example on C extension works in python 3.1.x or above

2011-07-26 Thread Dan Stromberg
You could try looking in the Python sources for examples. But using Cython is probably easier. On Tue, Jul 26, 2011 at 5:06 PM, wrote: > Hello, > I have been searching the example on C extension that works in python > 3.1.x ror above for long time. I tried the simple example given in > python

Re: How can I make a program automatically run once per day?

2011-07-26 Thread John Salerno
On Jul 9, 9:01 pm, John Salerno wrote: > Thanks everyone! I probably should have said something like "Python, > if possible and efficient, otherwise any other method" ! :) > > I'll look into the Task Scheduler. Thanks again! Hmm, okay I'm finally trying Task Scheduler, but how do I set it to run

Re: seeking an example on C extension works in python 3.1.x or above

2011-07-26 Thread Dan Stromberg
BTW, I believe you need to compile your extension module(s) with the same compiler that was used to build the Python interpreter - otherwise there could be calling convention issues. On Tue, Jul 26, 2011 at 5:58 PM, Dan Stromberg wrote: > > You could try looking in the Python sources for example

Re: Selecting unique values

2011-07-26 Thread Kumar Mainali
Thank you everybody. I can extract unique values now. - Kumar On Tue, Jul 26, 2011 at 2:38 PM, Dan Stromberg wrote: > > Some good stuff has already been suggested. Another possibility is using a > treap (not a duptreap but a treap): > > http://stromberg.dnsalias.org/~dstromberg/treap/ > > If y

Re: Only Bytecode, No .py Files

2011-07-26 Thread harrismh777
Christian Heimes wrote: The first four bytes of a pyc file contain the magic header. It must match the magic of the current Python version. The next four bytes contain the pyc_mtime. It must match the mtime of the corresponding .py files as returned by fstat().st_mtime. If the magic doesn't match

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread goldtech
Thank you. So what is happening? Is it that I'm in an environment that is not unicode and python is telling me the string (ie. n[0]) is unicode? (I'll do a hatchet-job on this subject if I ask anymore about unicode). Thanks to posters for their patience! -- http://mail.python.org/mailman/listinfo/

Re: How can I make a program automatically run once per day?

2011-07-26 Thread Ethan Furman
John Salerno wrote: On Jul 9, 9:01 pm, John Salerno wrote: Thanks everyone! I probably should have said something like "Python, if possible and efficient, otherwise any other method" ! :) I'll look into the Task Scheduler. Thanks again! Hmm, okay I'm finally trying Task Scheduler, but how do

Re: How can I make a program automatically run once per day?

2011-07-26 Thread Andrew Berg
On 2011.07.26 08:05 PM, John Salerno wrote: > Hmm, okay I'm finally trying Task Scheduler, but how do I set it to > run a Python script? It seems to not work, I suppose because it's > running the script but doesn't know how to find Python to run it > properly. Tell it to run the Python interpreter

Re: @PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-26 Thread Steven D'Aprano
On Wed, 27 Jul 2011 10:01 am rantingrick wrote: > > The "Fundamental Five" built-in functions > > There are quite a few helpful built in functions provided to the > python pro

Re: @PyNoobs: The Fundamental Five Built-in Functions, and Beyond!

2011-07-26 Thread Terry Reedy
On 7/26/2011 8:01 PM, rantingrick wrote: The "Fundamental Five" built-in functions There are quite a few helpful built in functions provided to the python programmer howev

Re: seeking an example on C extension works in python 3.1.x or above

2011-07-26 Thread Terry Reedy
On 7/26/2011 8:06 PM, llwa...@gmail.com wrote: Hello, I have been searching the example on C extension that works in python 3.1.x All the stdlib modules written in C. These are extension modules that come with Python. There are perhaps a hundred more on PyPI. Can any one who ever succeed

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread Terry Reedy
On 7/26/2011 9:18 PM, goldtech wrote: Thank you. So what is happening? Is it that I'm in an environment that is not unicode and python is telling me the string (ie. n[0]) is unicode? Yes, n is a list and n[0] is a unicode string and you are using some 2.x, which is ascii/byte string based. Pyt

Re: How can I make a program automatically run once per day?

2011-07-26 Thread John Salerno
On Jul 26, 9:22 pm, Andrew Berg wrote: > On 2011.07.26 08:05 PM,JohnSalernowrote:> Hmm, okay I'm finally trying Task > Scheduler, but how do I set it to > > run a Python script? It seems to not work, I suppose because it's > > running the script but doesn't know how to find Python to run it > > p

Re: Strings show as brackets with a 'u'.

2011-07-26 Thread Steven D'Aprano
On Wed, 27 Jul 2011 11:18 am goldtech wrote: > Thank you. So what is happening? Is it that I'm in an environment that > is not unicode and python is telling me the string (ie. n[0]) is > unicode? (I'll do a hatchet-job on this subject if I ask anymore about > unicode). Thanks to posters for their

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread Sridhar Ratnakumar
On Mon, Jul 25, 2011 at 5:18 PM, Robert wrote: > Is it possible to install the 2 and 3 series side by side? > Yup. Moreover, ActivePython includes a tool called `pythonselect` that can be used to set the "current" version of Python, https://github.com/ActiveState/pythonselect#readme For OSX, th

Re: How can I make a program automatically run once per day?

2011-07-26 Thread Chris Angelico
On Wed, Jul 27, 2011 at 2:09 PM, John Salerno wrote: > Thank you. I changed it as suggested so that now it runs C: > \Python32\python.exe extract_songs.py but it still isn't working. Have you confirmed that the job's working directory is set correctly? Naming the script without a path depends on