Re: Connecting/talking to OpenOffice Base files

2009-04-28 Thread norseman
deostroll wrote: Hi, I was wondering if the python interpretor can talk to files with extension *.odb (OpenOffice Base files). They are like flat database files, similar to Microsoft Access files. I want to store data into them as well as extract data out of them. --deostroll --

Re: Third Party Modules

2009-04-28 Thread John Nagle
Brock wrote: Hi Everyone, I know this is most likely a basic question and you will roll your eyes, but I am just starting out with Python (hobbyist) and I see many tutorials on the web referring to the use of external modules. However, when I locate them, they often come as a zipped folder

Re: Why bool( object )?

2009-04-28 Thread Scott David Daniels
Steven D'Aprano wrote: On Mon, 27 Apr 2009 23:11:11 -0700, Aaron Brady wrote: ... In a boolean (or truth) context, Something and Nothing behave like True and False in languages with real booleans: if obj: print I am Something else: print I am Nothing If you define the short-circuit

Re: stuck with PyOBEX

2009-04-28 Thread alejandro
Can you tell me what is it? Maybe I can search it and pass it in another way... if it is an address or protocol name AF_BLUETOOTH seems to be specific to *nix-systems. At least under debian and ubuntu, I've got it defined. So it seems it is not supported under windows - you should

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
data = file('source.bin').read() def get_bit(source, bit): idx, bit = divmod(bit, 8) byte = ord(source[len(source) - (1+idx)]) return (byte bit) 1 My understanding is: when doing this step, every bit in the byte will be shifted bit-long. If it is get_bit(data, 100), and the

Re: Web framework for embedded system

2009-04-28 Thread Scott David Daniels
Thomas Heller wrote: I'm looking for a lightweight web-framework for an embedded system. The system is running a realtime linux-variant on a 200 MHz ARM processor, Python reports a performance of around 500 pystones Does this sound sensible at all? Any suggestions? Look at this talk from

Re: stuck with PyOBEX

2009-04-28 Thread Diez B. Roggisch
alejandro wrote: Can you tell me what is it? Maybe I can search it and pass it in another way... if it is an address or protocol name I'm not entirely sure, but I guess no, you can't simply pass it in. Unix uses streams as abstraction for a lot of things - all kinds of devices for

bug with os.rename in 2.4.1?

2009-04-28 Thread t123
I was wondering if anyone has seen this problem before? I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It only happens occasionally. Most of the

Re: Light (general) Inter-Process Mutex/Wait/Notify Synchronization?

2009-04-28 Thread Gunter Henriksen
Linux doesn't do interprocess communication very well. The options are [...] and shared memory (unsafe). I think the bar has to be set pretty high to say shared memory is too unsafe an approach for active entities to communicate. If you're using CPython, don't worry about socket overhead.

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Denis L
Phil Thompson p...@riverbankcomputing.com wrote in message news:mailman.4699.1240932385.11746.python-l...@python.org... If there was a bug with lambda slots it's been fixed by now. I just tried it and I'm getting the same errors with regular functions. Could you try running the code bellow?

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Daniel Fetchinson
I was wondering if anyone has seen this problem before? I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It only happens occasionally. Most of

Re: PyGame font issues

2009-04-28 Thread Evan Kroske
Peter Chant wrote: Chaps, I have the following code: if pygame.font: font = pygame.font.Font(None, 36) #font = pygame.font.Font('liberationserif',36) text = font.render(Esc to quit., 1, (10, 10, 10)) textpos = text.get_rect() textpos.centerx = background.get_rect().centerx

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 14:15:54 -0300, Daniel Fetchinson fetchin...@googlemail.com escribió: I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It

Re: dict is really slow for big truck

2009-04-28 Thread Aahz
In article 7f01f7b7-a561-483a-8e6d-861a8c05f...@p6g2000pre.googlegroups.com, forrest yang gforrest.y...@gmail.com wrote: i try to load a big file into a dict, which is about 9,000,000 lines, something like 1 2 3 4 2 2 3 4 3 4 5 6 code for line in open(file) arr=line.strip().split('\t')

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Duncan Booth
t123 tom.lu...@gmail.com wrote: I was wondering if anyone has seen this problem before? I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It

Re: desperately looking for a howto on running my wxPython app on Vista

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 07:10:13 -0300, Paul Sijben paul.sij...@xs4all.nl escribió: python 2.6, py2exe and Vista do not make a happy set. Unfortunately I am in dire need to launch my app not only on WinXP but also on Vista. I need 2.6 because of a number of support packages I am using and some

Re: Lisp mentality vs. Python mentality

2009-04-28 Thread namekuseijin
Dan Sommers escreveu: Yes, I agree: Python and Lisp are extremely dynamic languages. I *can* redefine map, reduce, +, and other operators and functions, but I know better. When is the last time you examined someone else's code, and asked them what their map function did (in Lisp or in

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread t123
It's running on solaris 9. Here is some of the code. It's actually at the beginning of the job. The files are ftp'd over. The first thing that happens is that the files get renamed before any processing of the file. And when it fails, it always fails at the first file, comm.dat. What I can't

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread MRAB
t123 wrote: I was wondering if anyone has seen this problem before? I have a job that runs hourly. Part of the processing is to rename a file using os.rename. The file name is the same every hour. Sometimes the os.rename fails and the file does not get renamed. It only happens occasionally.

Re: dict is really slow for big truck

2009-04-28 Thread bearophileHUGS
On Apr 28, 2:54 pm, forrest yang gforrest.y...@gmail.com wrote: i try to load a big file into a dict, which is about 9,000,000 lines, something like 1 2 3 4 2 2 3 4 3 4 5 6 code for line in open(file)    arr=line.strip().split('\t')    dict[line.split(None, 1)[0]]=arr but, the dict is

Re: Memory leak on python 2.5 if using str(dict(a='a'))

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 05:09:25 -0300, Benjamin Liu liupingp...@gmail.com escribió: I use guppy-pe to identify this issue in my program. The resources links are all embedded in source code already. How do you know there is actually a memory leak here? Can you show the leak without resorting

Re: Unknown Visual C++ error

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 08:56:34 -0300, Stef Mientki stef.mien...@gmail.com escribió: Anyone knows what this error message means ? Python 2.5.2 Either Python itself or a third-party library called the abort() function, usually due to a critical error. Try looking into any log files, or the

Re: stuck with PyOBEX

2009-04-28 Thread David Robinow
On Tue, Apr 28, 2009 at 12:36 PM, alejandro aleksanda...@brisiovonet.hr wrote: Can you tell me what is it? Maybe I can search it and pass it in another way... if it is an address or protocol name AF_BLUETOOTH seems to be specific to *nix-systems. At least under debian and ubuntu, I've

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 14:43:01 -0300, t123 tom.lu...@gmail.com escribió: It's running on solaris 9. Here is some of the code. It's actually at the beginning of the job. The files are ftp'd over. The first thing that happens is that the files get renamed before any processing of the file. And

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
I want to concatenate two bits string together: say we have '1001' and '111' which are represented in integer. I want to concatenate them to '100' (also in integer form), my method is: ('1001' 3) | 111 which is very time consuming. You omit some key details -- namely how do you know that

Re: Third Party Modules

2009-04-28 Thread David Robinow
On Tue, Apr 28, 2009 at 1:15 PM, John Nagle na...@animats.com wrote: Brock wrote: Hi Everyone, I know this is most likely a basic question and you will roll your eyes, but I am just starting out with Python (hobbyist) and I see many tutorials on the web referring to the use of external

Re: python segfaulting, MemoryError (PyQt)

2009-04-28 Thread Phil Thompson
On Tue, 28 Apr 2009 19:07:30 +0200, Denis L n...@spam.com wrote: Phil Thompson p...@riverbankcomputing.com wrote in message news:mailman.4699.1240932385.11746.python-l...@python.org... If there was a bug with lambda slots it's been fixed by now. I just tried it and I'm getting the same

Re: What do you think of ShowMeDo

2009-04-28 Thread Mike Driscoll
On Apr 28, 10:43 am, tuxagb alessiogiovanni.bar...@gmail.com wrote: On 28 Apr, 17:09, Astley Le Jasper astley.lejas...@gmail.com wrote: Hi, I've just stumbled over this (http://showmedo.com/) and being the very visual person I am, it seems like it could be a good way to learn about

how to coerce to a string in Python?

2009-04-28 Thread Mark Tarver
How do you coerce an object to a string in Python? 123 -- 1 2 3 [1,2,3] - [1,2,3] etc Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Why bool( object )?

2009-04-28 Thread Aaron Brady
On Apr 28, 2:39 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 27 Apr 2009 23:11:11 -0700, Aaron Brady wrote: What is the rationale for considering all instances true of a user- defined type?  Is it strictly a practical stipulation, or is there something

Re: how to coerce to a string in Python?

2009-04-28 Thread Mark Tarver
On 28 Apr, 19:58, Mark Tarver dr.mtar...@ukonline.co.uk wrote: How do you coerce an object to a string in Python? 123 -- 1 2 3 [1,2,3] - [1,2,3] etc Mark Ah , 'str' a pure guess but it worked. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Third Party Modules

2009-04-28 Thread Mike Driscoll
On Apr 28, 12:15 pm, John Nagle na...@animats.com wrote: Brock wrote: Hi Everyone, I know this is most likely a basic question and you will roll your eyes, but I am just starting out with Python (hobbyist) and I see many tutorials on the web referring to the use of external modules.

Re: How to locate the bit in bits string?

2009-04-28 Thread David Smith
Li Wang wrote: 2009/4/29 Tim Chase python.l...@tim.thechases.com: Li Wang wrote: Hi: If I use an integer to represent bits: e.g. 99 represents '1100011' How can I locate, say the second bit of 99(i.e. '1')? Although bin(99)[4] could be used to locate it, this transform cost too much

Re: Unknown Visual C++ error

2009-04-28 Thread Stef Mientki
Gabriel Genellina wrote: En Tue, 28 Apr 2009 08:56:34 -0300, Stef Mientki stef.mien...@gmail.com escribió: Anyone knows what this error message means ? Python 2.5.2 Either Python itself or a third-party library called the abort() function, usually due to a critical error. Try looking into

Re: how to coerce to a string in Python?

2009-04-28 Thread Tim Chase
Mark Tarver wrote: On 28 Apr, 19:58, Mark Tarver dr.mtar...@ukonline.co.uk wrote: How do you coerce an object to a string in Python? 123 -- 1 2 3 [1,2,3] - [1,2,3] etc Ah , 'str' a pure guess but it worked. You may also be interested in the repr() function. I'm afraid neither will give

Re: stuck with PyOBEX

2009-04-28 Thread alejandro
The problem with Pybluez is that the module serves only to get the addresses, ports, protocols... that the device uses but can't send or recive files. So I am stuck again :-( Maybe I should use dll-s and again another thing to learn... :-) --

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Nick Craig-Wood
t123 tom.lu...@gmail.com wrote: It's running on solaris 9. Here is some of the code. It's actually at the beginning of the job. The files are ftp'd over. The first thing that happens is that the files get renamed before any processing of the file. And when it fails, it always fails at

Re: Best way to evaluate boolean expressions from strings?

2009-04-28 Thread Arnaud Delobelle
Gustavo Narea m...@gustavonarea.net writes: Hello, everybody. I need to evaluate boolean expressions like foo == 1 or foo ==1 and (bar 2 or bar == 0) which are defined as strings (in a database or a plain text file, for example). How would you achieve this? These expressions will contain

Tools for web applications

2009-04-28 Thread Mario
What easyToLearn tools you suggest for creating: 1. powerfull web applications 2. desktop applications -- http://mail.python.org/mailman/listinfo/python-list

Re: inside-out range function

2009-04-28 Thread William Clifford
On Apr 27, 10:50 pm, Paul Rubin http://phr...@nospam.invalid wrote: William Clifford mr.william.cliff...@gmail.com writes: def enrag(start, stop=None, step=1):     '''Yield a range of numbers from inside-out, evens on left.'''     list(enrag(10))     [8, 6, 4, 2, 0, 1, 3, 5, 7, 9]    

Re: Connecting/talking to OpenOffice Base files

2009-04-28 Thread Lawrence D'Oliveiro
In message mailman.4705.1240936701.11746.python-l...@python.org, norseman wrote: # I know this prints ugly on paper. Blame it on children liking long #words, presumably preferring increased typos too... Remember this was initially designed to be done with Java. Python was an

Python Noob - a couple questions involving a web app

2009-04-28 Thread Kyle T. Jones
Been programming for a long time, but just starting out with Python. Not a professional programmer, just that guy in one of those organizations that won't hire a pro, instead saying Hey, Kyle knows computer stuff - let's have him do this (and that, and the other, etc). So, the higher ups want

wxPython menu creation refactoring

2009-04-28 Thread alex
Hello everybody I am still trying to refactor a simple GUI basing on an example in wxPython In Action, Listing 5.5 A refactored example where the menue creation is automatized. I understand the problem (each second for loop in def createMenuData (self) creates a distinct menu) but I tried now for

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-28 Thread David Bolen
Vsevolod vselo...@gmail.com writes: On Apr 27, 11:31 pm, David Bolen db3l@gmail.com wrote: I'm curious - do you know what happens if threading is implemented as a native OS thread and it's stuck in an I/O operation that is blocked? How does the Lisp interpreter/runtime gain control again

fcntl and siginfo_t in python

2009-04-28 Thread ma
Developing on a machine with a 2.6.5 kernel, which unfortunately, is not blessed with inotify and we do not have FAM. I was wondering if there are pre-built extensions ( a few google searches turned up fruitless) that utilize fcntl properly and allow for siginfo_t struct support when attempting to

How to retry something with a timeout in Python?

2009-04-28 Thread tinnews
This feels like it should be simple but I can't see a clean way of doing it at the moment. I want to retry locking a file for a number of times and then give up, in pseudo-code it would be something like:- for N times try to lock file if successful break out of for loop

Re: Python Noob - a couple questions involving a web app

2009-04-28 Thread Arnaud Delobelle
Kyle T. Jones serious...@youvegottabekidding.net writes: Been programming for a long time, but just starting out with Python. Not a professional programmer, just that guy in one of those organizations that won't hire a pro, instead saying Hey, Kyle knows computer stuff - let's have him do

Re: How to retry something with a timeout in Python?

2009-04-28 Thread Scott David Daniels
tinn...@isbd.co.uk wrote: This feels like it should be simple but I can't see a clean way of doing it at the moment. I want to retry locking a file for a number of times and then give up, in pseudo-code it would be something like:- for N times try to lock file if

string Index for the last position

2009-04-28 Thread Clarendon
I am trying to get the index for the last occurrance of a sub string. S = 'dab dab dab' print S.find('ab') 1 This gives me the index for the first position of 'ab'. But I need to index the last position of 'ab' here. Is there a quick option for find that will do this, or do I have to write a

Re: Web based application development using python

2009-04-28 Thread Fred Pacquier
Rahul r.warhe...@gmail.com said : There are a number of frameworks out there each with there own set of strengths and weaknesses,  you shoul dbe looking at each ones vibrancy (community), suitablility for your application, etc... Thanks tim This information was really of help to me If

Re: string Index for the last position

2009-04-28 Thread Christian Heimes
Clarendon schrieb: I am trying to get the index for the last occurrance of a sub string. S = 'dab dab dab' print S.find('ab') 1 This gives me the index for the first position of 'ab'. But I need to index the last position of 'ab' here. Is there a quick option for find that will do this,

Re: What do you think of ShowMeDo

2009-04-28 Thread Terry Reedy
Astley Le Jasper wrote: I've just stumbled over this (http://showmedo.com/) and being the very visual person I am, it seems like it could be a good way to learn about python. However, before I smack down $60, I wondered if anyone had any opinions on it. My gut feel is that it could be pretty

Re: Python Noob - a couple questions involving a web app

2009-04-28 Thread Emile van Sebille
Kyle T. Jones wrote: snip So, the higher ups want a web app that'll let them enter (from an intranet page) a rather simple, but quite lengthy, list - details to be stored in a MySQL database... just normal stuff here, entering, editing, and deleting entries, sorting, etc. The last couple

Re: string Index for the last position

2009-04-28 Thread Clarendon
Dear Christian Thank you so much! It works! -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing a file into another module's namespace

2009-04-28 Thread Gary Oberbrunner
- Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 27 Apr 2009 21:46:13 -0400, Gary Oberbrunner wrote: ...Now after importing foo.bar, I'd like to load another file of code (say xyz.py), but *into* foo.bar's namespace. ... import foo.bar import xyz for name

Re: stuck with PyOBEX

2009-04-28 Thread David Boddie
On Tuesday 28 April 2009 18:34, Diez B. Roggisch wrote: This module asks the socket module for AF_BLUETOOTH... in the socket module there is no such thing as AF_BLUETOOTH. Could it be that the person that made PyOBEX modified his socket module and forgot to give his socket module? Or am I

sorting items in a table problematic because of scientific notation

2009-04-28 Thread Davis, Amelie Y
Hi All, I have a dbf table outputted by another program that I cannot (I'm pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on a particular field but this field has scientific

Re: Web based application development using python

2009-04-28 Thread David Lyon
On Tue, 28 Apr 2009 04:50:13 -0700 (PDT), Rahul r.warhe...@gmail.com wrote: but i want to know which is the official standard recommended by python. but there isn't one... All of the frameworks are slightly different and solve different problems. It is for you to work out which one suites

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread skip
Amélie Hi All, Amélie I have a dbf table outputted by another program that I cannot Amélie (I'm pretty sure) change the format of. Amélie I use a dbf reader code found online Amélie (http://code.activestate.com/recipes/362715/ ) to read the table Amélie in and I need to

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread MRAB
Davis, Amelie Y wrote: Hi All, I have a dbf table outputted by another program that I cannot (I’m pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on a particular field but this

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread MRAB
s...@pobox.com wrote: Amélie Hi All, Amélie I have a dbf table outputted by another program that I cannot Amélie (I'm pretty sure) change the format of. Amélie I use a dbf reader code found online Amélie (http://code.activestate.com/recipes/362715/ ) to read the table

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread skip
MRAB FYI: float(s) 105646.365517 MRAB which saves a few keystrokes. :-) Thanks. Didn't used to be that way I don't think. -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ XML sucks, dictionaries rock - Dave Beazley --

Re: ANN: PyGUI 2.0.5

2009-04-28 Thread Suraj
On Apr 26, 10:33 pm, greg g...@cosc.canterbury.ac.nz wrote: I don't know what I need to do in order to get a Vista look... A closed issue in Python tracker http://bugs.python.org/issue5019 refers to similar problem reported by wxPython developers. AFAIK, the solution used by the wxPython

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread John Machin
Davis, Amelie Y aydavis at purdue.edu writes: Hi All, I have a dbf table outputted by another program that I cannot (I’m pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on

Re: Tools for web applications

2009-04-28 Thread Daniel Fetchinson
What easyToLearn tools you suggest for creating: 1. powerfull web applications Have a look at http://wiki.python.org/moin/WebFrameworks You will find that there are many options each with its own fan crowd emphasizing the advantages and downplaying the disadvantages of their favorite

Re: How to locate the bit in bits string?

2009-04-28 Thread Li Wang
2009/4/29 Tim Chase python.l...@tim.thechases.com: I want to concatenate two bits string together: say we have '1001' and '111' which are represented in integer. I want to concatenate them to '100' (also in integer form), my method is: ('1001' 3) | 111 which is very time consuming. You

Re: how to coerce to a string in Python?

2009-04-28 Thread Paul Rubin
Mark Tarver dr.mtar...@ukonline.co.uk writes: 123 -- 1 2 3 ' '.join(str(123)) [1,2,3] - [1,2,3] etc repr([1,2,3]) -- http://mail.python.org/mailman/listinfo/python-list

extracting duplicates from CSV file by specific fields

2009-04-28 Thread VP
Hi, I have a csv file: 'aaa.111', 'T100', 'pn123', 'sn111' 'aaa.111', 'T200', 'pn123', 'sn222' 'bbb.333', 'T300', 'pn123', 'sn333' 'ccc.444', 'T400', 'pn123', 'sn444' 'ddd', 'T500', 'pn123', 'sn555' 'eee.666', 'T600', 'pn123', 'sn444' 'fff.777', 'T700', 'pn123', 'sn777' How can I extract

Re: extracting duplicates from CSV file by specific fields

2009-04-28 Thread MRAB
VP wrote: Hi, I have a csv file: 'aaa.111', 'T100', 'pn123', 'sn111' 'aaa.111', 'T200', 'pn123', 'sn222' 'bbb.333', 'T300', 'pn123', 'sn333' 'ccc.444', 'T400', 'pn123', 'sn444' 'ddd', 'T500', 'pn123', 'sn555' 'eee.666', 'T600', 'pn123', 'sn444' 'fff.777', 'T700', 'pn123', 'sn777' How can I

Re: extracting duplicates from CSV file by specific fields

2009-04-28 Thread Rhodri James
On Wed, 29 Apr 2009 01:53:24 +0100, VP vadim.pestovni...@gmail.com wrote: Hi, I have a csv file: 'aaa.111', 'T100', 'pn123', 'sn111' 'aaa.111', 'T200', 'pn123', 'sn222' 'bbb.333', 'T300', 'pn123', 'sn333' 'ccc.444', 'T400', 'pn123', 'sn444' 'ddd', 'T500', 'pn123', 'sn555' 'eee.666', 'T600',

Re: Why bool( object )?

2009-04-28 Thread Rhodri James
On Tue, 28 Apr 2009 19:59:18 +0100, Aaron Brady castiro...@gmail.com wrote: The sound of that metaphor is rather pleasing ('sweet nothings'), but I'm not so sure that metaphors belong in computer science and programming. Nothing can't have many shapes. Having no onions is the same as having

Re: How to locate the bit in bits string?

2009-04-28 Thread Tim Chase
You omit some key details -- namely how do you know that 1001 is 4 bits and not 1001 (8-bits)? If it's a string (as your current code shows), you can determine the length. However, if they are actually ints, your code should work fine be O(1). Actually, what I have is a list of integer

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread John Machin
skip at pobox.com writes: MRAB FYI: float(s) 105646.365517 MRAB which saves a few keystrokes. Thanks. Didn't used to be that way I don't think. Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch

Geohashing

2009-04-28 Thread Raymond Hettinger
import hashlib def geohash(latitude, longitude, datedow): '''Compute geohash() in http://xkcd.com/426/ geohash(37.421542, -122.085589, b'2005-05-26-10458.68') 37.857713 -122.544543 ''' h = hashlib.md5(datedow).hexdigest() p, q = [('%f' % float.fromhex('0.' + x)) for x

Re: dict is really slow for big truck

2009-04-28 Thread Steven D'Aprano
On Tue, 28 Apr 2009 10:25:05 -0700, Aahz wrote: but, the dict is really slow as i load more data into the memory, by the way the mac i use have 16G memory. is this cased by the low performace for dict to extend memory or something other reason. Try gc.disable() before the loop and gc.enable()

Re: Geohashing

2009-04-28 Thread Paul Rubin
Raymond Hettinger pyt...@rcn.com writes: p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], ... Cool, I didn't know about 'fromhex'. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to retry something with a timeout in Python?

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 17:56:13 -0300, tinn...@isbd.co.uk escribió: I want to retry locking a file for a number of times and then give up, in pseudo-code it would be something like:- for N times try to lock file if successful break out of for loop if we don't have a

RE: sorting items in a table problematic because ofscientific notation

2009-04-28 Thread Davis, Amelie Y
Worked like a charm! Thanks to all 3 of you,   Amélie    Please consider the environment before printing this e-mail or any of its attachments (if applicable)   -Original Message- From: python-list-bounces+aydavis=purdue@python.org

Re: fcntl and siginfo_t in python

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 17:56:21 -0300, ma mabdelka...@gmail.com escribió: Developing on a machine with a 2.6.5 kernel, which unfortunately, is not blessed with inotify and we do not have FAM. I was wondering if there are pre-built extensions ( a few google searches turned up fruitless) that

Re: and [True,True] -- [True, True]?????

2009-04-28 Thread jazbees
On Apr 27, 1:10 pm, Terry Reedy tjre...@udel.edu wrote: The difference between hasvowels = lambda x:max([y in x for y in aeiou]) and def hasvowels(x): return max([y in x for y in aeiou]) is that the first is 4 chars shorter, but the result has a generic .__name__ attribute of 'lambda'

Re: Way to use proxies login to site?

2009-04-28 Thread inVINCable
On Apr 27, 7:40 pm, inVINCable invinceable...@gmail.com wrote: Hello, I have been using ClientForm to log in to sites ClientCookie so I can automatically log into my site to do some penetration testing, although, I cannot figure out a solution to use proxies with this logging in

Re: Why bool( object )?

2009-04-28 Thread Steven D'Aprano
On Tue, 28 Apr 2009 11:59:18 -0700, Aaron Brady wrote: To steal an idiom from Laura: Python has a float-shaped Nothing 0.0, a list-shaped Nothing [], a dict-shaped Nothing {}, an int-shaped Nothing 0, a singleton Nothing None, and so forth. The sound of that metaphor is rather pleasing

Re: Web framework for embedded system

2009-04-28 Thread alex23
On Apr 28, 5:43 pm, Thomas Heller thel...@python.net wrote: I'm looking for a lightweight web-framework for an embedded system. [...] Does this sound sensible at all? Any suggestions? I'd highly recommend taking a look at CherryPy: http://www.cherrypy.org/ The developers describe it as a HTTP

Re: bug with os.rename in 2.4.1?

2009-04-28 Thread Steven D'Aprano
On Tue, 28 Apr 2009 14:30:02 -0500, Nick Craig-Wood wrote: t123 tom.lu...@gmail.com wrote: It's running on solaris 9. Here is some of the code. It's actually at the beginning of the job. The files are ftp'd over. The first thing that happens is that the files get renamed before any

Re: Third Party Modules

2009-04-28 Thread Gabriel Genellina
En Tue, 28 Apr 2009 15:59:54 -0300, Mike Driscoll kyoso...@gmail.com escribió: On Apr 28, 12:15 pm, John Nagle na...@animats.com wrote: Brock wrote: I see many tutorials on the web referring to the use of external modules. However, when I locate them, they often come as a zipped folder

Re: How to locate the bit in bits string?

2009-04-28 Thread Li Wang
2009/4/29 Tim Chase python.l...@tim.thechases.com: You omit some key details -- namely how do you know that 1001 is 4 bits and not 1001 (8-bits)? If it's a string (as your current code shows), you can determine the length. However, if they are actually ints, your code should work fine

Re: suggestion on a complicated inter-process communication

2009-04-28 Thread Lawrence D'Oliveiro
In message 95ac6b26-46f2-4b28-b9a3-3aa02b754...@v1g2000prd.googlegroups.com, Way wrote: - denotes create MainProcess - Process1 - Process3 (from os.system) | - Process2 (from os.system) - Process4 (from os.system) -Process5 If MainProcess were to

Re: CSV performance

2009-04-28 Thread Lawrence D'Oliveiro
In message gt47lc$kar$0...@news.t-online.com, Peter Otten wrote: gc.disable() # create many small objects that you want to keep gc.enable() Every time I see something like this, I feel the urge to save the previous state and restore it afterwards: save_enabled = gc.isenabled()

complementary lists?

2009-04-28 Thread Ross
If I have a list x = [1,2,3,4,5,6,7,8,9] and another list that is a subset of x: y = [1,4,7] , is there a quick way that I could return the complementary subset to y z=[2,3,5,6,8,9] ? The reason I ask is because I have a generator function that generates a list of tuples and I would like to

Re: complementary lists?

2009-04-28 Thread Kay Schluehr
On 29 Apr., 05:41, Ross ross.j...@gmail.com wrote: If I have a list x = [1,2,3,4,5,6,7,8,9] and another list that is a subset of x: y = [1,4,7] , is there a quick way that I could return the complementary subset to y z=[2,3,5,6,8,9] ? The reason I ask is because I have a generator

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-28 Thread John Nagle
David Bolen wrote: Vsevolod vselo...@gmail.com writes: On Apr 27, 11:31 pm, David Bolen db3l@gmail.com wrote: I'm curious - do you know what happens if threading is implemented as a native OS thread and it's stuck in an I/O operation that is blocked? How does the Lisp interpreter/runtime

Re: How to locate the bit in bits string?

2009-04-28 Thread Steven D'Aprano
On Wed, 29 Apr 2009 00:36:56 +1000, Li Wang wrote: Although bin(99)[4] could be used to locate it, this transform cost too much memory (99 only needs 2Bytes, while string '1100011' needs 7Bytes). This is Python, not C. Your figures are completely wrong. sys.getsizeof(99) 12

Re: Importing a file into another module's namespace

2009-04-28 Thread Steven D'Aprano
On Tue, 28 Apr 2009 17:26:22 -0500, Gary Oberbrunner wrote: Hi Steven (and MRAB), thanks for this idea. This looks pretty straightforward and useful. I also heard of another way via googling around; see what you think of this. For example's sake this code just adds stuff to the os.path

Re: complementary lists?

2009-04-28 Thread Mensanator
On Apr 28, 10:41�pm, Ross ross.j...@gmail.com wrote: If I have a list x = [1,2,3,4,5,6,7,8,9] and another list that is a subset of x: �y = [1,4,7] , is there a quick way that I could return the complementary subset to y z=[2,3,5,6,8,9] ? The reason I ask is because I have a generator

Re: What do you think of ShowMeDo

2009-04-28 Thread kyran
On 29 Apr, 00:07, Ben Finney ben+pyt...@benfinney.id.au wrote: Astley Le Jasper astley.lejas...@gmail.com writes: I've just stumbled over this (http://showmedo.com/) and being the very visual person I am, it seems like it could be a good way to learn about python. However, before I smack

Re: complementary lists?

2009-04-28 Thread Paul Rubin
Ross ross.j...@gmail.com writes: If I have a list x = [1,2,3,4,5,6,7,8,9] and another list that is a subset of x: y = [1,4,7] , is there a quick way that I could return the complementary subset to y z=[2,3,5,6,8,9] ? x = [1,2,3,4,5,6,7,8,9] y = [1,4,7] print

Re: What do you think of ShowMeDo

2009-04-28 Thread Ben Finney
Thanks for responding. ky...@showmedo.com writes: 99% of the videos on showmedo are available free-and-gratis. They're made by members of the open-source community who receive nothing more than a bit of kudos and an all too rare thank-you. We pay for the hosting and provide the set-up. I

Re: What do you think of ShowMeDo

2009-04-28 Thread Banibrata Dutta
Personally, I faced some despair with a large number of the free ShowMeDo tutorials, example the one on WxPython, where for the first 4 free tutorials, the tutor hardly progresses to any bit of programming, and what is demonstrated was too basic, too slow - to hold my attention. As a concept, I

Re: stuck with PyOBEX

2009-04-28 Thread alejandro
So I should connect trough pybluez and send with obex?? David Boddie da...@boddie.org.uk wrote in message news:gt80qd$mb...@get-news01.get.basefarm.net... On Tuesday 28 April 2009 18:34, Diez B. Roggisch wrote: This module asks the socket module for AF_BLUETOOTH... in the socket module there

Re: extracting duplicates from CSV file by specific fields

2009-04-28 Thread VP
Thanks guys! Tested, seems working. CSV file: - a.a,sn-01 b.b,sn-02 c.c,sn-03 d.d,sn-04 e.e,sn-05 f.f,sn-06 g.g,sn-07 h.h,sn-08 i.i,sn-09 a.a,sn-10 k.k,sn-02 i.i,sn-09 Source: - #!/usr/bin/env python import csv unqs = [] dups = [] seen_in_field0 = set() seen_in_field1 = set()

<    1   2   3   >