Re: Multi thread reading a file

2009-07-01 Thread Stefan Behnel
Gabriel Genellina wrote: > En Tue, 30 Jun 2009 22:52:18 -0300, Mag Gam escribió: > >> I am very new to python and I am in the process of loading a very >> large compressed csv file into another format. I was wondering if I >> can do this in a multi thread approach. > > Does the format conversio

Re: invoking a method from two superclasses

2009-07-01 Thread Carl Banks
On Jun 30, 9:15 pm, "Gabriel Genellina" wrote: > En Tue, 30 Jun 2009 21:34:02 -0300, Mitchell L Model   > escribi : > > > Allow me to add to my previous question that certainly the superclass > > methods can be called explicitly without resorting to super(), e.g.: > > >     class C(A, B): > >    

Basic question from pure beginner

2009-07-01 Thread sato.ph...@gmail.com
I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exercises I have been able

Re: Making code run in both source tree and installation path

2009-07-01 Thread Carl Banks
On Jun 29, 9:20 am, Javier Collado wrote: > I've seen different approaches: > - distutils trick in setup.py to modify the installed script (i.e. > changing a global variable value) so that it has a reference to the > data files location. One of my biggest complaints about distutils is that it do

Re: Basic question from pure beginner

2009-07-01 Thread Peter Otten
sato.ph...@gmail.com wrote: > I have been going through some Python Programming exercises while > following the MIT OpenCourseWare Intro to CS syllabus and am having > some trouble with the first "If" exercise listed on this page: > > http://en.wikibooks.org/wiki/Python_Programming/Conditional_S

Re: Basic question from pure beginner

2009-07-01 Thread alex23
On Jul 1, 3:38 pm, "sato.ph...@gmail.com" wrote: > I have been able to make the module quit after entering a password > three times, but can't get it to quit right away after the correct one > is entered.   Not with the code you pasted, you haven't. There's a missing colon on line 7 & line 9 isn'

Re: Basic question from pure beginner

2009-07-01 Thread sato.ph...@gmail.com
Thank you for all of the help. With your assistance and help from the Python Tutor mailing list I was able to come up with the following code: password = "qwerty" correct_password_given = False guess = "0" count = 0 while count != 3 and not correct_password_given : guess = raw_input("Enter you

Re: Learning to use decorators with classes

2009-07-01 Thread Bruno Desthuilliers
sk8in_zo...@yahoo.com.au a écrit : --- On Tue, 30/6/09, Bruno Desthuilliers wrote: (snip) This can't work, and it's a FAQ FWIW - but since there's no official c.l.py FAQ, we won't hold it against you !-) Can you please point me to the FAQ related to this snippet. I would be grateful. W

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
sato.ph...@gmail.com a écrit : Thank you for all of the help. With your assistance and help from the Python Tutor mailing list I was able to come up with the following code: password = "qwerty" correct_password_given = False guess = "0" You could just use None here: guess=None count = 0

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread Lawrence D'Oliveiro
In message , ryles wrote: > On Jun 29, 5:43 pm, Scott David Daniels wrote: > >>and I personally wouldn't have it any other way. Simulating a shell >> with hooks on its I/O should be so complicated that a "script kiddie" >> has trouble writing a Trojan. > > +1 QOTW Trouble is, script kiddies, b

Re: No trees in the stdlib?

2009-07-01 Thread Lawrence D'Oliveiro
In message , João Valverde wrote: > Simple example usage case: Insert string into data structure in sorted > order if it doesn't exist, else retrieve it. the_set = set( ... ) if str in the_set : ... "retrieval" case ... else : the_set.add(str) #end if Want sorte

Re: No trees in the stdlib?

2009-07-01 Thread Lawrence D'Oliveiro
In message , Miles Kaufmann wrote: > On Jun 26, 2009, at 2:23 AM, Chris Rebert wrote: > >> That's pretty much the bisect module in a nutshell. It manipulates a >> sorted list using binary search. > > With O(n) insertions and removals, though. A decent self-balancing > binary tree will generall

Re: PEP 376

2009-07-01 Thread Paul Rubin
Joachim Strömbergson writes: > http://docs.python.org/library/hashlib.html > I would suggest to use the SHA-256 in the library. I agree with this. We should even move towards supporting x509 and/or gpg signatures in eggs, similar to signed .jar files. -- http://mail.python.org/mailman/listinfo/

Re: No trees in the stdlib?

2009-07-01 Thread Lawrence D'Oliveiro
In message , João Valverde wrote: > But a dict can't be used to implement a (sorted) table ADT. for key in sorted(the_dict.keys(), cmp = ... whatever ordering criteria you like ...) : ... do something with the_dict[key] ... #end for -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 376

2009-07-01 Thread Richard Brodie
"Joachim Strömbergson" wrote in message news:mailman.2422.1246418400.8015.python-l...@python.org... > Even so, choosing md5 in 2009 for something that (hopefully) will be > used in years is a bad design decision. It creates a dependency for to > an algorithm that all sensible recommendations po

Re: No trees in the stdlib?

2009-07-01 Thread Paul Rubin
Lawrence D'Oliveiro writes: > > With O(n) insertions and removals, though. A decent self-balancing > > binary tree will generally do those in O(log n). > > For values of n below, say, a million, would you even notice the difference > on modern hardware? Huh? Yes, of course you'd notice, unles

Re: PEP 376

2009-07-01 Thread Paul Rubin
"Richard Brodie" writes: > Why not write the field as algorithm:value? > e.g. sha1:8590b685654367e3eba70dc00df7e45e88c21da4 This is reasonable, though I would deprecate md5 and sha1 already, and start with sha256. -- http://mail.python.org/mailman/listinfo/python-list

Re: string character count

2009-07-01 Thread Iain King
On Jun 30, 6:27 pm, noydb wrote: > If I have a string for a file name such that I want to find the number > of characters to the left of the dot, how can that be done? > > I did it this way: > x = "text12345.txt" > dot = x.find('.') > print dot > > Was curious to see what method others would use -

A question about fill_free_list(void) function

2009-07-01 Thread Pedram
Hello community, I'm reading the CPython interpreter source code, first, if you have something that I should know for better reading this source code, I would much appreciate that :) second, in intobject.c file, I read the following code in fill_free_list function that I couldn't understand: while

Re: Problem with uuid package when embedding a python interpreter

2009-07-01 Thread Jérôme Fuselier
On Jun 30, 7:02 pm, "Gabriel Genellina" wrote: > En Tue, 30 Jun 2009 13:05:42 -0300, Jérôme Fuselier > escribió: > > > > >   I've tried to import a script in an embedded python intrepreter but > > this script fails when it imports the uuid module. I have a > > segmentation fault in Py_Finalize().

Re: Passing parameters for a C program in Linux.

2009-07-01 Thread bobicanprogram
On Jun 30, 6:46 am, "venutaurus...@gmail.com" wrote: > Hi all, >I have to write an automted script which will test my c > program. That program when run will ask for the commands. For example: > > local-host# ./cli > Enter 1 for add > Enter 2 for sub > Enter 3 for mul > 1--

Re: No trees in the stdlib?

2009-07-01 Thread Steven D'Aprano
On Wed, 01 Jul 2009 20:39:06 +1200, Lawrence D'Oliveiro wrote: > In message , João > Valverde wrote: > >> Simple example usage case: Insert string into data structure in sorted >> order if it doesn't exist, else retrieve it. > > the_set = set( ... ) > > if str in the_set : > ...

what will be best framework to select to develop Multi-Level Marketing (network marketing) application in python?

2009-07-01 Thread gganesh
hi group, I have to build a software for Multi-Level Marketing (network marketing),There are several Frameworks available in python ,i could like to know the best Framework suitable to develop an application on Multi-Level Marketing . Thanks -- http://mail.python.org/mailman/listinfo/python-list

infinite recursion in pickle.load()

2009-07-01 Thread Thomas
we regularly pickle and unpickle data from the same script (mostly dictionaries). sometimes, a file written this way cannot be unpickled with pickle.load(), due to an infinite recursion with __getattr__ in codecs.py. here is a python2.5 stack trace excerpt: /usr/local/lib/python2.5/pickle.py

Re: Timeout when connecting to sybase DBS

2009-07-01 Thread eranlevi
On Jun 30, 7:48 pm, s...@pobox.com wrote: >     Gil> I have looked for a timeout parameter to limit the 4 minutes to >     Gil> something more reasonable but couldn't find one.  Can anyone please >     Gil> help? > >     Gil> BTW, I'm using Sybase.connect(, , , >     Gil> datetime='auto') > > We us

Re: Timeout when connecting to sybase DBS

2009-07-01 Thread eranlevi
On Jul 1, 3:56 pm, eranlevi wrote: > On Jun 30, 7:48 pm, s...@pobox.com wrote: > > > > >     Gil> I have looked for a timeout parameter to limit the 4 minutes to > >     Gil> something more reasonable but couldn't find one.  Can anyone please > >     Gil> help? > > >     Gil> BTW, I'm using Sybase

Re: A question about fill_free_list(void) function

2009-07-01 Thread Pedram
Oh... I got it! :) I found this line in ctypes.h: #define Py_TYPE(q) = ((PyObject *)(q))->ob_next; So those lines are trying to set the blocks type from rear to front. But I still don't know why after the while (when q is equal to p), the Py_TYPE(q) set to NULL! -- http://mail.python.org/mailman/

deleting certain entries in numpy array

2009-07-01 Thread Sebastian Schabe
Hello everybody, I'm new to python and numpy and have a little/special problem: I have an numpy array which is in fact a gray scale image mask, e.g.: mask = array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0,

Re: invoking a method from two superclasses

2009-07-01 Thread Scott David Daniels
> Mitchell L Model wrote: Sorry, after looking over some other responses, I went back and re-read your reply. I'm just making sure here, but: > Scott David Daniels wrote: Below compressed for readability in comparison: class A: def __init__(self): super().__init__(); print('A') cl

Re: Multi thread reading a file

2009-07-01 Thread Scott David Daniels
Gabriel Genellina wrote: ... def convert(in_queue, out_queue): while True: row = in_queue.get() if row is None: break # ... convert row out_queue.put(converted_line) These loops work well with the two-argument version of iter, which is easy to forget, but quite useful to have

Re: It's ...

2009-07-01 Thread J. Cliff Dyer
On Tue, 2009-06-30 at 13:24 -0700, Beni Cherniavsky wrote: > On Jun 24, 11:40 pm, "J. Cliff Dyer" wrote: > > Also note that you can iterate over a file several times: > > > > f = open('foo.txt') > > for line in f: > > print line[0] # prints the first character of every line > > for line in f:

a little wsgi framework

2009-07-01 Thread timmyt
i'm interested in getting opinions on a small wsgi framework i assembled from webob, sqlalchemy, genshi, and various code fragments i found on the inter-tubes here is the interesting glue - any comments / suggestions would be much appreciated -- the wsgi app -- def

Re: Getting input the scanf way

2009-07-01 Thread Bruno Desthuilliers
Mr.SpOOn a écrit : Hi, I need to do some kind of interactive command line program. I mean: I run the program, it asks me for input, I type something and then I get the output or other questions. I'm not sure what is the right way to achieve this. Simplest : use raw_input() Friendlier (at least

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
Charles Yeomans a écrit : Please don't top-post (not corrected) Let me offer a bit of editing. First, using the condition count != 3 is perhaps risky. A mistake or a change in logic in the loop body might result in an infinite loop. So instead I suggest while count < 3... Second, I'd su

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
Scott David Daniels a écrit : (snip) And even simpler: PASSWORD = "qwerty" MAXRETRY = 3 for attempt in range(MAXRETRY): if raw_input('Enter your password: ') == PASSWORD: print 'Password confirmed' break # this exits the for loop print 'Access

Re: Why re.match()?

2009-07-01 Thread Duncan Booth
kj wrote: > > > For a recovering Perl-head like me it is difficult to understand > why Python's re module offers both match and search. Why not just > use search with a beginning-of-string anchor? I find it particularly > puzzling because I have this (possibly mistaken) idea that the > Python

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread spillz
On Jun 29, 3:15 pm, Pascal Chambon wrote: > Hello everyone > > I've had real issues with subprocesses recently : from a python script, > on windows, I wanted to "give control" to a command line utility, i.e > forward user in put to it and display its output on console. It seems > simple, but I ran

Re: deleting certain entries in numpy array

2009-07-01 Thread Ben Finney
Sebastian Schabe writes: > I want to avoid a for loop (if possible!!!) cause I think (but don't > know) numpy array are handled in another way. Yes, Numpy arrays can be indexed logically by a boolean array. > I think numpy.delete is the right function for discarding the values, > but I don't kn

problems displaying results in ibm_db

2009-07-01 Thread digz
This simple db connectivity and select test program works in the interactive mode >>> import ibm_db >>> conn = ibm_db.connect( 'DATABASE', 'user', 'passwd') >>> result = ibm_db.exec_immediate( conn, 'SELECT * FROM TEST FETCH FIRST 1 >>> ROWS ONLY') >>> row = ibm_db.fetch_tuple( result ) >>> for r

problem installing python 2.6.2 from tarball

2009-07-01 Thread Paul Simon
I have just finished going through the usual ./configure, make, etc. and now have a load of stuff in my home directory that I think doesn't belong there. Apparently I did the installation from my home directory (linux) and have a directory in my home directory "Python2.6.2" with subdirectories

Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Mario Garcia
Im trying to use sets for doing statistics from a data set. I want to select, 70% random records from a List. I thougth set where a good idea so I tested this way: c = set(range(1000)) for d in range(1000): print c.pop() I was hoping to see a print out of random selected numbers from 1 to 10

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 2:34 pm, Mario Garcia wrote: > Im trying to use sets for doing statistics from a data set. > I want to select, 70% random records from a List. I thougth set where > a good idea so I > tested this way: > > c = set(range(1000)) > for d in range(1000): >      print c.pop() > > I was hoping

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Mensanator
On Jul 1, 4:34 pm, Mario Garcia wrote: > Im trying to use sets for doing statistics from a data set. > I want to select, 70% random records from a List. I thougth set where > a good idea so I > tested this way: > > c = set(range(1000)) > for d in range(1000): >      print c.pop() > > I was hoping

Re: Why re.match()?

2009-07-01 Thread Carl Banks
On Jul 1, 10:56 am, kj wrote: > For a recovering Perl-head like me it is difficult to understand > why Python's re module offers both match and search.  Why not just > use search with a beginning-of-string anchor?  I find it particularly > puzzling because I have this (possibly mistaken) idea that

Re: Problem with uuid package when embedding a python interpreter

2009-07-01 Thread Aahz
In article <7d5cfbf0-38d5-4505-a93a-f321d0da7...@c36g2000yqn.googlegroups.com>, =?ISO-8859-1?Q?J=E9r=F4me_Fuselier?= wrote: > >I've tried to import a script in an embedded python intrepreter but >this script fails when it imports the uuid module. I have a >segmentation fault in Py_Finalize(). Yo

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Mensanator
On Jul 1, 5:29 pm, Mensanator wrote: > On Jul 1, 4:34 pm, Mario Garcia wrote: > > > > > > > Im trying to use sets for doing statistics from a data set. > > I want to select, 70% random records from a List. I thougth set where > > a good idea so I > > tested this way: > > > c = set(range(1000)) >

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-01 Thread ryles
On Jun 29, 5:43 pm, Scott David Daniels wrote: > and I personally wouldn't have it any other way. Simulating a shell > with hooks on its I/O should be so complicated that a "script kiddie" > has trouble writing a Trojan. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi thread reading a file

2009-07-01 Thread Lawrence D'Oliveiro
In message , Mag Gam wrote: > I am very new to python and I am in the process of loading a very > large compressed csv file into another format. I was wondering if I > can do this in a multi thread approach. Why bother? -- http://mail.python.org/mailman/listinfo/python-list

Re: Idioms and Anti-Idioms Question

2009-07-01 Thread Lawrence D'Oliveiro
In message , J. Cliff Dyer wrote: > If the lines got separated, a leading + could disappear into its line > without any errors showing up. A trailing + would raise a syntax error. Unless, of course, it was moved onto the previous line as part of whatever caused the separation of the lines. How

getting rid of —

2009-07-01 Thread someone
Hello, how can I replace '—' sign from string? Or do split at that character? Getting unicode error if I try to do it: UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 1: ordinal not in range(128) Thanks, Pet script is # -*- coding: UTF-8 -*- -- http://mail.python.org/mail

Re: invoking a method from two superclasses

2009-07-01 Thread Michele Simionato
On Jul 1, 2:34 am, Mitchell L Model wrote: > I suspect we should have a Multiple Inheritance HOWTO, though details and > recommendations would be controversial. I've accumulated lots of abstract > examples along the lines of my question, using multiple inheritance both to > create combination clas

Re: Making code run in both source tree and installation path

2009-07-01 Thread Robert Kern
On 2009-07-01 01:04, Carl Banks wrote: On Jun 29, 9:20 am, Javier Collado wrote: I've seen different approaches: - distutils trick in setup.py to modify the installed script (i.e. changing a global variable value) so that it has a reference to the data files location. One of my biggest compl

logging module and binary strings

2009-07-01 Thread Frank Aune
Hello, snip >>> import logging >>> logging.basicConfig(level=logging.DEBUG) >>> x='\xfe\x9f\xce\xc3\xa1\x00\xff\x01' >>> x '\xfe\x9f\xce\xc3\xa1\x00\xff\x01' >>> print x ���á� >>> logging.info(x) Traceback (most recent call last): File "/usr/lib/python2.6/logging/__init__.py", line 773

Re: Basic question from pure beginner

2009-07-01 Thread MRAB
sato.ph...@gmail.com wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#

Re: No trees in the stdlib?

2009-07-01 Thread Tim Golden
Lawrence D'Oliveiro wrote: Want sorted order? sorted(tuple(the_set)) Not sure why you want the tuple () there, but you probably knew that... TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: No trees in the stdlib?

2009-07-01 Thread MRAB
Lawrence D'Oliveiro wrote: In message , João Valverde wrote: Simple example usage case: Insert string into data structure in sorted order if it doesn't exist, else retrieve it. the_set = set( ... ) if str in the_set : ... "retrieval" case ... else : the_set.add(s

Re: Multi thread reading a file

2009-07-01 Thread Mag Gam
Thanks for the response Gabriel. On Wed, Jul 1, 2009 at 12:54 AM, Gabriel Genellina wrote: > En Tue, 30 Jun 2009 22:52:18 -0300, Mag Gam escribió: > >> I am very new to python and I am in the process of loading a very >> large compressed csv file into another format.  I was wondering if I >> ca

Re: Basic question from pure beginner

2009-07-01 Thread Charles Yeomans
Let me offer a bit of editing. First, using the condition count != 3 is perhaps risky. A mistake or a change in logic in the loop body might result in an infinite loop. So instead I suggest while count < 3... Second, I'd suggest storing the value 3 in a variable with a name that descri

Re: string character count

2009-07-01 Thread Jean-Michel Pichavant
MRAB wrote: noydb wrote: If I have a string for a file name such that I want to find the number of characters to the left of the dot, how can that be done? I did it this way: x = "text12345.txt" dot = x.find('.') print dot Was curious to see what method others would use - helps me learn. I gu

What are the limitations of cStringIO.StringIO() ?

2009-07-01 Thread Barak, Ron
Hi, I think I'm up against a limitation in cStringIO.StringIO(), but could not find any clues on the web, especially not in http://docs.python.org/library/stringio.html. What I have is the following function: def concatenate_files(self,filename_array): import types f = cSt

Bytes, Strings, Encoding

2009-07-01 Thread Eric Pruitt
Hello, I am working on the subprocess.Popen module for Python 2.7 and am now moving my changes over to Python 3.1 however I am having trouble with the whole byte situation and I can't quite seem to understand how to go back and forth between bytes and strings. I am also looking for the Python 3k e

Getting input the scanf way

2009-07-01 Thread Mr.SpOOn
Hi, I need to do some kind of interactive command line program. I mean: I run the program, it asks me for input, I type something and then I get the output or other questions. I'm not sure what is the right way to achieve this. Thanks, Carlo -- http://mail.python.org/mailman/listinfo/python-list

Re: Ubigraph vs Matplotlib (dynamic plotting, event handling)

2009-07-01 Thread Che M
On Jun 30, 6:20 pm, Ala wrote: > Hello everyone, > > I intend to use python for some network graph plotting, with event > handling (clicking on network nodes, zooming in/out etc..) and so far I > have come across two good candidates which are Matplotlib and Ubigraph. > > Did anyone have any experi

Re: Basic question from pure beginner

2009-07-01 Thread Scott David Daniels
Charles Yeomans wrote: Let me offer a bit of editing Finally, I'd remove correct_password_given from the loop test, and replace it with a break statement when the correct password is entered. password = "qwerty" correct_password_given = False attemptcount = 0 MaxAttempts = 3 while attemptc

Re: logging module and binary strings

2009-07-01 Thread Peter Otten
Frank Aune wrote: import logging logging.basicConfig(level=logging.DEBUG) x='\xfe\x9f\xce\xc3\xa1\x00\xff\x01' x > '\xfe\x9f\xce\xc3\xa1\x00\xff\x01' logging.info(x) > Traceback (most recent call last): > File "/usr/lib/python2.6/logging/__init__.py", line 773, in emit

Why re.match()?

2009-07-01 Thread kj
For a recovering Perl-head like me it is difficult to understand why Python's re module offers both match and search. Why not just use search with a beginning-of-string anchor? I find it particularly puzzling because I have this (possibly mistaken) idea that the Python design philosophy tends t

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Ben Finney
Mario Garcia writes: > Im trying to use sets for doing statistics from a data set. > I want to select, 70% random records from a List. I thougth set where > a good idea so I > tested this way: > > c = set(range(1000)) > for d in range(1000): > print c.pop() > > I was hoping to see a print

Re: A question about fill_free_list(void) function

2009-07-01 Thread Christian Heimes
Pedram schrieb: > Hello community, > I'm reading the CPython interpreter source code, > first, if you have something that I should know for better reading > this source code, I would much appreciate that :) > second, in intobject.c file, I read the following code in > fill_free_list function that I

Re: Python/Pygame question

2009-07-01 Thread Rhodri James
On Tue, 30 Jun 2009 19:15:24 +0100, Crip wrote: I have been experimenting with pygame. I would like to know how to go about placing an image of my creation as the background of the generated window. To where should I save the image, and what should it be saved as? Wherever will be most useful

Open Source RSS Reader in Python?

2009-07-01 Thread Alex
I am looking for an open source RSS reader (desktop, not online) written in Python but in vain. I am not looking for a package but a fully functional software. Google: python "open source" (rss OR feeds) reader Any clue ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob

2009-07-01 Thread Chris Rebert
On Tue, Jun 30, 2009 at 11:02 AM, kaffeen wrote: > Hello all, just joined this list and am just beginning to learn Python. > Thanks to everyone for making this a great place to learn and their > contributions. > > As mentioned, I'm new to Python (but have experience with other programming > languag

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2009-07-01 Thread Melissa Powers
Hi, This may be a stretch but I came across this blog while searching for a SW Packaging Engineer. Do you know anyone in the Boston, MA area who may be interested in this position? The company is a start up with a lot of funding and this is an opportunity to define the environment and grow wi

Re: No trees in the stdlib?

2009-07-01 Thread João Valverde
Lawrence D'Oliveiro wrote: In message , João Valverde wrote: Simple example usage case: Insert string into data structure in sorted order if it doesn't exist, else retrieve it. the_set = set( ... ) if str in the_set : ... "retrieval" case ... else : the_s

Re: problems displaying results in ibm_db

2009-07-01 Thread ptn
On Jul 1, 3:20 pm, digz wrote: > result = ibm_db.exec_immediate( conn, 'SELECT * FROM TEST FETCH FIRST > 1 ROWS ONLY') You have the same string split into two lines, which means that what you actually have is this: result = ibm_db.exec_immediate( conn, 'SELECT * FROM TEST FETCH FIRST 1 ROWS ONLY

Re: problem installing python 2.6.2 from tarball

2009-07-01 Thread ptn
Sounds like you untarred directly into your home dir. You're OK if you delete those, they are the sources, although you should do so only after uninstalling, just in case. To unistall, follow this thread from the list from a while ago: http://mail.python.org/pipermail/python-list/2004-December/29

Re: Open Source RSS Reader in Python?

2009-07-01 Thread Simon Forman
On Jul 1, 7:18 pm, Alex wrote: > I am looking for an open source RSS reader (desktop, not online) > written in Python but in vain. I am not looking for a package but a > fully functional software. > > Google: python "open source" (rss OR feeds) reader > > Any clue ? There's Canto: http://codezen.

Suppressing Implicit Chained Exceptions (Python 3.0)

2009-07-01 Thread andrew cooke
I have some (library) code where an exception is caught and, since the underlying cause is rather obscure, a different exception is raised that more clearly explains the issue to the caller. However, when printed via format_exc(), this new exception still has the old exception attached via the me

Re: Why re.match()?

2009-07-01 Thread MRAB
Carl Banks wrote: On Jul 1, 10:56 am, kj wrote: For a recovering Perl-head like me it is difficult to understand why Python's re module offers both match and search. Why not just use search with a beginning-of-string anchor? I find it particularly puzzling because I have this (possibly mistak

Re: logging module and binary strings

2009-07-01 Thread Robert Kern
On 2009-07-01 10:02, Frank Aune wrote: Hello, snip import logging logging.basicConfig(level=logging.DEBUG) x='\xfe\x9f\xce\xc3\xa1\x00\xff\x01' x '\xfe\x9f\xce\xc3\xa1\x00\xff\x01' print x ���á� logging.info(x) Traceback (most recent call last): File "/usr/lib/python2.6/loggin

Re: Timeout when connecting to sybase DBS

2009-07-01 Thread skip
Gil> There's no such group as python-sybase :-( http://sourceforge.net/mailarchive/forum.php?forum_name=python-sybase-misc S -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of —

2009-07-01 Thread Benjamin Peterson
someone googlemail.com> writes: > > Hello, > > how can I replace '—' sign from string? Or do split at that character? > Getting unicode error if I try to do it: > > UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position > 1: ordinal not in range(128) Please paste your code. I s

Re: Timeout when connecting to sybase DBS

2009-07-01 Thread skip
Gil> Are you saying, that when you trying to connect to a sybase DBS Gil> server and the DBS or the server is down, you get an error after a Gil> few seconds and not after a few minutes? Yes, though thankfully our server tends to almost always be up. Gil> Which python version are

Re: deleting certain entries in numpy array

2009-07-01 Thread Robert Kern
On 2009-07-01 09:51, Sebastian Schabe wrote: Hello everybody, I'm new to python and numpy and have a little/special problem: You will want to ask numpy questions on the numpy mailing list. http://www.scipy.org/Mailing_Lists I have an numpy array which is in fact a gray scale image mask, e

Re: getting rid of —

2009-07-01 Thread MRAB
someone wrote: Hello, how can I replace '—' sign from string? Or do split at that character? Getting unicode error if I try to do it: UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 1: ordinal not in range(128) Thanks, Pet script is # -*- coding: UTF-8 -*- It sounds li

Adding an object to the global namespace through " f_globals" is that allowed ?

2009-07-01 Thread Stef Mientki
hello, I need to add an object's name to the global namespace. The reason for this is to create an environment, where you can add some kind of math environment, where no need for Python knowledge is needed. The next statement works, but I'm not sure if it will have any dramatical side effects, o

Re: problem installing python 2.6.2 from tarball

2009-07-01 Thread Pablo Torres N.
On Wed, Jul 1, 2009 at 16:16, Paul Simon wrote: > I have just finished going through the usual ./configure, make, etc. and now > have a load of stuff in my home directory that I think doesn't belong there. > Apparently I did the installation from my home directory (linux) and have a > directory  in

Re: Getting input the scanf way

2009-07-01 Thread MRAB
Mr.SpOOn wrote: Hi, I need to do some kind of interactive command line program. I mean: I run the program, it asks me for input, I type something and then I get the output or other questions. I'm not sure what is the right way to achieve this. Use raw_input() and print. -- http://mail.python.o

Re: What are the limitations of cStringIO.StringIO() ?

2009-07-01 Thread Benjamin Kaplan
On Wed, Jul 1, 2009 at 7:48 AM, Barak, Ron wrote: > Hi, > > I think I'm up against a limitation in cStringIO.StringIO(), but could not > find any clues on the web, especially not in > http://docs.python.org/library/stringio.html. > > What I have is the following function: > >     def concatenate_fi

Using Python to set desktop background image under Windows XP

2009-07-01 Thread ELLINGHAUS, LANCE
Does anyone have any code that would allow setting the desktop background image under Windows XP? Thank you, lance Lance Ellinghaus mailto:lance.ellingh...@hp.com -- http://mail.python.org/mailman/listinfo/python-list

[ANNC] acromania-0.4

2009-07-01 Thread Lee Harr
Acromania is a word game of acronyms. This program is a computer moderator for networked games of acromania. It can connect to a channel on IRC, or start a standalone server which can be accessed much like a MUD. http://acromania.googlecode.com/ Acromania uses Twisted and SQLite. Optionally, i

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Paul Rubin
Mario Garcia writes: > Im trying to use sets for doing statistics from a data set. > I want to select, 70% random records from a List. I thougth set where > a good idea so I No that's not a good idea. When the set/dict documentation says you get the keys in an undetermined order, it doesn't mean

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Paul Rubin
Carl Banks writes: > Instead, call random.shuffle() on the list, and iterate through that > to get the elements in random order. It's better to use random.sample() than random.shuffle(). -- http://mail.python.org/mailman/listinfo/python-list

Re: Why re.match()?

2009-07-01 Thread John Machin
On Jul 2, 9:50 am, MRAB wrote: > Carl Banks wrote: > > On Jul 1, 10:56 am, kj wrote: > >> For a recovering Perl-head like me it is difficult to understand > >> why Python's re module offers both match and search.  Why not just > >> use search with a beginning-of-string anchor?  I find it particul

Re: Multi thread reading a file

2009-07-01 Thread Mag Gam
LOL! :-) Why not. I think I will take just do it single thread for now and if performance is really that bad I can re investigate. Either way, thanks everyone for your feedback! I think I like python a lot because of the great user community and wiliness to help! On Wed, Jul 1, 2009 at 1:07 AM

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Steven D'Aprano
On Wed, 01 Jul 2009 17:49:21 -0700, Paul Rubin wrote: > Carl Banks writes: >> Instead, call random.shuffle() on the list, and iterate through that to >> get the elements in random order. > > It's better to use random.sample() than random.shuffle(). Why? -- Steven -- http://mail.python.org/m

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 5:49 pm, Paul Rubin wrote: > Carl Banks writes: > > Instead, call random.shuffle() on the list, and iterate through that > > to get the elements in random order. > > It's better to use random.sample() than random.shuffle(). If you're iterating through the

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Paul Rubin
Carl Banks writes: > If you're iterating through the whole list and don't need to preserve > the original order (as was the case here) random.shuffle() is better. 1. Random.sample avoids iterating through the whole list when it can. 2. Say you want to choose 10 random numbers between 1 and 1

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Paul Rubin
Carl Banks writes: > random.shuffle() is still better when you're iterating through the > whole list as the OP was doing. The OP wrote: I want to select, 70% random records from a List. I thougth set where a good idea so I tested this way: ... That sounds like 70% of the list, not the w

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 6:37 pm, Paul Rubin wrote: > Carl Banks writes: > > If you're iterating through the whole list and don't need to preserve > > the original order (as was the case here) random.shuffle() is better. > > 1. Random.sample avoids iterating through the whole list

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 7:02 pm, Paul Rubin wrote: > Carl Banks writes: > > random.shuffle() is still better when you're iterating through the > > whole list as the OP was doing. > The OP wrote: > >     I want to select, 70% random records from a List. I thougth set >     where a

  1   2   >