Find the closest relative

2007-05-24 Thread [EMAIL PROTECTED]
Hi I have three objects, all of them are instances of classes derived from a base class. Now, given one of the instance, I want to find the closest relative of the other two. How can I do this? This is how I implemented; I guess there must be elegant way to do this... def find_closest_relative(a,

Re: File monitoring for all drive

2007-05-24 Thread Tim Golden
rohit wrote: > hi > i want to detect all file change operations(rename,delete,create) > on ALL THE DRIVES of the hard disk > using the method ReadDirectoryChanges API , i.e program no. 3 in the > webpage > http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html > .

Re: sockets, gethostname() changing

2007-05-24 Thread Steve Holden
7stud wrote: > Hi, > > I'm experimenting with a basic socket program(from a book), and both > the client and server programs are on my computer. In both programs, > I call socket.gethostname(), but I discovered that when I am connected > to the internet, both the client and server hang and nothi

Re: Python and GUI

2007-05-24 Thread matt . newville
> Do others think like me here? Yes!! I agree completely: Wax is not only a fantastic idea, but a very good start at an implementation of that idea. --Matt Newville -- http://mail.python.org/mailman/listinfo/python-list

Re: sockets, gethostname() changing

2007-05-24 Thread 7stud
Thanks for the response. On May 24, 9:24 pm, [EMAIL PROTECTED] wrote: > I can't imagine why your hostname would be changing, unless you > installed some of their proprietary software thats messing around with > things. When I first started using Terminal, I noticed that the prompt in Terminal c

Re: sockets, gethostname() changing

2007-05-24 Thread half . italian
On May 24, 8:04 pm, 7stud <[EMAIL PROTECTED]> wrote: > Hi, > > I'm experimenting with a basic socket program(from a book), and both > the client and server programs are on my computer. In both programs, > I call socket.gethostname(), but I discovered that when I am connected > to the internet, bo

sockets, gethostname() changing

2007-05-24 Thread 7stud
Hi, I'm experimenting with a basic socket program(from a book), and both the client and server programs are on my computer. In both programs, I call socket.gethostname(), but I discovered that when I am connected to the internet, both the client and server hang and nothing happens. I discovered

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-24 Thread Victor Kryukov
Hello list, thanks a lot to everybody for their suggestions. We're yet to make our final decision, and the information you've provided is really helpful. Best, Victor. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter help, please...

2007-05-24 Thread Medi Ochre
John McMonagle wrote: > I've made a couple of minor changes to your code from the Cribbage class > down: > > class Cribbage: > def __init__(self, win): > ... > score = run.play() > if score >= best: best = score > time.sleep(1) <--- short sleep to see what's

Re: installing cx_Oracle.

2007-05-24 Thread Charles Sanders
Doug Phillips wrote: >> It also works the other way around, at least on the non-empty >> set of systems that contains my workstation. export simply >> marks the variable name for automatic export to the >> environment of subsequent commands. The value at that time >> doesn't matter. What matter

Re: Newsgroups and mailing lists (was Re: Slightly OT: Why all the spam?)

2007-05-24 Thread Terry Reedy
"Aahz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | First of all, if you're accessing python-list as comp.lang.python, you're | accessing a newsgroup, *not* a mailing list. Secondly, c.l.py is an | unmoderated group; there is no moderator and no control over who posts. | However

Re: 0 == False but [] != False?

2007-05-24 Thread Erik Max Francis
Steve Holden wrote: > Dan Bishop wrote: > >> I have a job as a C++ programmer, and they make us write it like that, >> apparently because the ! operator is hard to see. But "if (x == >> TRUE)" is discouraged. >> > Find a new employer. I'm not joking. Really. He's not. That's a perfect example

File monitoring for all drive

2007-05-24 Thread rohit
hi i want to detect all file change operations(rename,delete,create) on ALL THE DRIVES of the hard disk using the method ReadDirectoryChanges API , i.e program no. 3 in the webpage http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html . Please suggest some modific

Re: 0 == False but [] != False?

2007-05-24 Thread Steve Holden
Dan Bishop wrote: > On May 24, 1:59 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > ... >> False is just a constant. 0, (), '', [], and False are all constants that >> happen to evaluate to a false value in a Boolean context, but they are not >> all the same. >> >> As a general rule, I've found code

Re: 0 == False but [] != False?

2007-05-24 Thread Dan Bishop
On May 24, 1:59 am, Tim Roberts <[EMAIL PROTECTED]> wrote: ... > False is just a constant. 0, (), '', [], and False are all constants that > happen to evaluate to a false value in a Boolean context, but they are not > all the same. > > As a general rule, I've found code like "if x == False" to be

Re: need advice on building core code for python and PHP

2007-05-24 Thread Graham Dumpleton
On May 25, 5:24 am, aspineux <[EMAIL PROTECTED]> wrote: > On 24 mai, 19:33, Szabolcs Nagy <[EMAIL PROTECTED]> wrote: > > > > Is there a way I could code the base (core) code in Python and have > > > PHP call it? I've really liked using SQLAlchemy and there are other > > > * quick and dirty solutio

Re: Tkinter help, please...

2007-05-24 Thread John McMonagle
I've made a couple of minor changes to your code from the Cribbage class down: class Cribbage: def __init__(self, win): self.parent = win# < make the toplevel Tk window an # < attribute of the class #Draw the interface

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-05-24 Thread Markus E Leypold
> On 2007-05-23, Xah Lee <[EMAIL PROTECTED]> wrote: >> The Concepts and Confusions of Prefix, Infix, Postfix and Fully >> Functional Notations >> >> Xah Lee, 2006-03-15 > > Xah, why do you post year-old essays to newsgroups that couldn't care > less about them? And even more to the point -- why

Tkinter help, please...

2007-05-24 Thread Medi Ochre
I've been away from Python for some time, and I'm just starting to look at Tkinter. Just so you know, I'm coming from Visual Basic, where this would, I *think*, not have been a problem, so it must be a case of getting my head around the Tkinter way of doing things. In a nutshell, I've written a

Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-24 Thread Peter Otten
Stef Mientki wrote: > Peter Otten wrote: >> Stef Mientki wrote: >> >>> Maric Michaud wrote: >> >>def bit(index): def fset(self, value): >> value= ( value & 1L ) << index mask = ( 1L ) << index self._d = ( self._d & ~mask ) | value >>>

webbrowser module bug?

2007-05-24 Thread Ron Adam
Is anyone else having problems with the webbrowser module? Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open('http://www.python.o

Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-24 Thread Stef Mientki
Peter Otten wrote: > Stef Mientki wrote: > >> Maric Michaud wrote: > >def bit(index): >>> def fset(self, value): > >>> value= ( value & 1L ) << index >>> mask = ( 1L ) << index >>> self._d = ( self._d & ~mask ) | value >>> def fget(self): > >>>

Re: Changing Unicode object to Tuple Type

2007-05-24 Thread John Machin
On May 24, 11:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On May 24, 5:11 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> Can we have change a unicode string Type object to a Tuple type > >>> object.. If so h

Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-24 Thread Peter Otten
Stef Mientki wrote: > Maric Michaud wrote: def bit(index): >> def fset(self, value): >> value= ( value & 1L ) << index >> mask = ( 1L ) << index >> self._d = ( self._d & ~mask ) | value >> def fget(self): >> return ( self._d >> index ) & 1 >>

Re: What is an instance and what isn't?

2007-05-24 Thread Gabriel Genellina
En Thu, 24 May 2007 12:18:36 -0300, Gre7g Luterman <[EMAIL PROTECTED]> escribió: > I'm writing a C program which handles Python objects in different ways > based > on their type. I do a PyInstance_Check(PyObj) to determine if the PyObj > is > an instance, but it is returning 0 on a lot of st

Re: Python and GUI

2007-05-24 Thread Stef Mientki
> >> Sorry, maybe I'm not Pythonic enough, but talking about "GUI >> framework", the first thing I want to see are screenshots. > > 0) While wax is a GUI framework, it is not a GUI designer, so I >was wondering who you were quoting when you wrote "a GUI >designer [...]". > > 1) Wax doesn

Re: problems to write a wav file

2007-05-24 Thread Gabriel Genellina
En Thu, 24 May 2007 10:55:42 -0300, Gautier Krings <[EMAIL PROTECTED]> escribió: > I have a small problem for writing a .wav file. I can't find in which > format > I have to pass my data in the writeframes function of the wave module. > > here's my code, I am just trying to open a wav file, ex

Re: Python and GUI

2007-05-24 Thread Grant Edwards
On 2007-05-24, Stef Mientki <[EMAIL PROTECTED]> wrote: Finally, consider wax (http://zephyrfalcon.org/labs/wax.html). In my view, this is *exactly* what python needs, and its not being maintained anymore as far as I can tell. What I like about it is: 1) it is small...I

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Joshua J. Kugler
On Thursday 24 May 2007 08:32, Steve Holden wrote: > The directory containing the script you are executing is also added to > sys.path. Since you are executing a script called planet ... Ah! That's it. That had never occurred to me, as I was under the impression that your current *working* direct

Re: Accessing iTunes with Python via the Windows SDK

2007-05-24 Thread kyosohma
On May 24, 12:59 am, Denrael <[EMAIL PROTECTED]> wrote: > On May 24, 12:17 am, Tony Meyer <[EMAIL PROTECTED]> wrote: > > > On May 24, 4:23 pm, Denrael <[EMAIL PROTECTED]> wrote:> I've been playing > > with the iTunes sdk on windows, and have come across > > > a strange problem. With the following

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread Grant Edwards
On 2007-05-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> You should really use the struct module for that type of conversion, but >> you also need to know that indexing of lists and tuples starts at 0, not 1. > > indeed, i used to have temp = unpack('h', tBuf[1,3]) Which probably should have

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread Grant Edwards
On 2007-05-24, Steve Holden <[EMAIL PROTECTED]> wrote: >> i have two string bytes i need to push into a single (short) int, like >> so in c: >> >>temp = strBuf[2]; >> >>temp = (temp<<7)+(strBuf[1]); > You should really use the struct module for that type of conversion, The struct modul

Re: Newsgroups and mailing lists (was Re: Slightly OT: Why all the spam?)

2007-05-24 Thread Robert Kern
Aahz wrote: > These days, because of the cancelbot wars, ... Heh. Sounds like a particularly dire episode of Doctor Who. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an

email modul with writing to mboxes (and locking) for python 2.4.*?

2007-05-24 Thread Matej Cepl
Is there somewhere support for the extension of email module, which would support writing to (and creating new) mbox folders (with all bells and whistles, like locking)? It seems to me that current (Python 2.4.*, I even tried email package 4.0.2 from python.org email SIG) implementation is read

RE: Web Archtecture using tow layers in Phyton

2007-05-24 Thread Wagner Garcia Campagner
Thanks Amit, I'll search those python web framework and try to find what is the best for my needs. Thanks again for your help, Wagner. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Amit Khemka Sent: quinta-feira, 24 de maio de 2007 09:35 To: python-list@

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread [EMAIL PROTECTED]
> You should really use the struct module for that type of conversion, but > you also need to know that indexing of lists and tuples starts at 0, not 1. indeed, i used to have temp = unpack('h', tBuf[1,3]) but it was a hack (and as such a bit off ;) as i was having troubles casting not quite use

Re: Python and GUI

2007-05-24 Thread Stef Mientki
Grant Edwards wrote: > On 2007-05-24, Stef Mientki <[EMAIL PROTECTED]> wrote: > >>> Finally, consider wax (http://zephyrfalcon.org/labs/wax.html). In my >>> view, this is *exactly* what python needs, and its not being maintained >>> anymore as far as I can tell. What I like about it is: >>> >>

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 12:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > Actually, you can do this: > > > class Dog(object): > > def aFunction(self): > > result = 20 + 2 > > def run(self): > > #do stuff > >

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread [EMAIL PROTECTED]
> (ord(strBuf[2])<<7) + ord(strBuf[1]) wow, thank you - works perfectly ! and much more elegant than what i was up to. thanks again... -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hello all > > i am relatively new to python, catching on, but getting stuck on > simple thing: > > i have two string bytes i need to push into a single (short) int, like > so in c: > >temp = strBuf[2]; > >temp = (temp<<7)+(strBuf[1]); > > c code works, but ha

Re: trouble converting c++ bitshift to python equivalent

2007-05-24 Thread Grant Edwards
On 2007-05-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > hello all > > i am relatively new to python, catching on, but getting stuck on > simple thing: > > i have two string bytes i need to push into a single (short) int, like > so in c: > >temp = strBuf[2]; > >temp = (temp<<7)+(strBuf

Re: read file to a dictionary

2007-05-24 Thread Gabriel Genellina
En Thu, 24 May 2007 05:08:57 -0300, rohit <[EMAIL PROTECTED]> escribió: > ohh i think i forgot to include intricate details > in dictionary i use the following: > value: name of a file existing on disk > Key : a unique number assigned to each file ,with no. assigned in > increasing order to file

trouble converting c++ bitshift to python equivalent

2007-05-24 Thread [EMAIL PROTECTED]
hello all i am relatively new to python, catching on, but getting stuck on simple thing: i have two string bytes i need to push into a single (short) int, like so in c: temp = strBuf[2]; temp = (temp<<7)+(strBuf[1]); c code works, but having trouble getting python to perform same functio

Re: Python and GUI

2007-05-24 Thread Grant Edwards
On 2007-05-24, Stef Mientki <[EMAIL PROTECTED]> wrote: >> Finally, consider wax (http://zephyrfalcon.org/labs/wax.html). In my >> view, this is *exactly* what python needs, and its not being maintained >> anymore as far as I can tell. What I like about it is: >> >> 1) it is small...I can incl

Re: What is an instance and what isn't?

2007-05-24 Thread Lenard Lindstrom
Gre7g Luterman wrote: > I suppose I was lulled into complacency by how Python makes so many things > look like classes, but I'm starting to realize that they're not, are they? > > I'm writing a C program which handles Python objects in different ways based > on their type. I do a PyInstance_Chec

Newsgroups and mailing lists (was Re: Slightly OT: Why all the spam?)

2007-05-24 Thread Aahz
In article <[EMAIL PROTECTED]>, Michael L Torrie <[EMAIL PROTECTED]> wrote: > >It appears that people using nntp to read this list aren't seeing the >spam because the moderators expire the messages as they find them. Allow this creaky and cranky old-timer to correct what you're trying to write:

Re: Python and GUI

2007-05-24 Thread Stef Mientki
> > Finally, consider wax (http://zephyrfalcon.org/labs/wax.html). In my > view, this is *exactly* what python needs, and its not being maintained > anymore as far as I can tell. What I like about it is: > > 1) it is small...I can include the entire wax distribution in my app > with only a 7

Re: What is an instance and what isn't?

2007-05-24 Thread Terry Reedy
"Gre7g Luterman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I suppose I was lulled into complacency by how Python makes so many things | look like classes, but I'm starting to realize that they're not, are they? | | I'm writing a C program which handles Python objects in differ

Re: Python script not mapping our site correctly?

2007-05-24 Thread Paul McNett
[EMAIL PROTECTED] wrote: > We have been using the Google recommended python script for about a > year. Which script would that be? Googling for 'python script' yields approx. 27 million hits. > We recently realized that the script was not crawling our sites > url's, but just our folders which r

Re: 0 == False but [] != False?

2007-05-24 Thread Erik Max Francis
Donn Cave wrote: > Anyone who finds this surprising, might enjoy reading this > article from the time several years ago when the feature > was being considered. When you have some time - it's long, > but interesting. The present confusion is more directly > addressed towards the end. Yes, it's

Re: converting text and spans to an ElementTree

2007-05-24 Thread Neil Cerutti
On 2007-05-24, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-05-23, Steven Bethard <[EMAIL PROTECTED]> wrote: > You mean... I left out the hard part? Shucks. I had really > hoped it didn't matter. > >> * the recursive (or stack) part assigns children to parents >> * the non-recursive part assi

Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-24 Thread Stef Mientki
Maric Michaud wrote: > def bit(): > def fset(self, value): > index= 5 > value= ( value & 1L ) << index > mask = ( 1L ) << index > self._d = ( self._d & ~mask ) | value > def fget(self): > index= 5 > return ( self._d >> index

Re: of destructors, open files and garbage collection

2007-05-24 Thread Terry Reedy
"massimo s." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi, | | Python 2.4, Kubuntu 6.06. I'm no professional programmer (I am a ph.d. | student in biophysics) but I have a fair knowledge of Python. | | I have a for loop that looks like the following : | | for item in long_list

Re: Python and GUI

2007-05-24 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Just wondering on what peoples opinions are of the GUIs avaiable for > Python? > > All I am doing is prompting users for some data (listbox, radio > buttons, text box, ect...). Then I will have some text output, maybe > a scrolling text

Re: No file from stdin

2007-05-24 Thread Matimus
On May 24, 9:48 am, Tartifola <[EMAIL PROTECTED]> wrote: > Hi, > suppose a script of python is waiting for a file from the stdin and none > is given. How can I make the script to stop and, for example, print an > error message? > > Sorry for the n00b question and thanks I'm not exactly sure what y

Re: CP4E revival

2007-05-24 Thread I V
On Thu, 24 May 2007 20:03:29 +1000, Richard Jones wrote: > Hoop-jumping implemented to prevent just this kind of direct linking (and > thus not saving of the PDF to local disk to view, and thus increasing the > load on the server). I'm not sure I see the connection - if you're serving something as

Re: need advice on building core code for python and PHP

2007-05-24 Thread aspineux
On 24 mai, 19:33, Szabolcs Nagy <[EMAIL PROTECTED]> wrote: > > Is there a way I could code the base (core) code in Python and have > > PHP call it? I've really liked using SQLAlchemy and there are other > > * quick and dirty solution: > in a shell: > $ python yourscript.py pipe_out > in the php

Re: modifying values of List or Dictionary when iterating on them

2007-05-24 Thread aspineux
On 24 mai, 19:21, "Christopher Anderson" <[EMAIL PROTECTED]> wrote: > > d=dict(a=1, b=2, c=3) > > for k, v in d.iteritems(): > > d[k]=d[k]+1 > > You might as well do: d[k] = v + 1, like for the list. ops, yes it was a typo -- http://mail.python.org/mailman/listinfo/python-list

Re: need advice on building core code for python and PHP

2007-05-24 Thread digimotif
> > * simple and nice solution: > do not ever use php I'd like not to use it at all, but there's already been quite a bit of work done with it and I'm sure I won't be able to have it all removed at one time. I REALLY don't like debugging PHP especially after all the stuff I've done with Python

Re: ClientForm .click() oddity

2007-05-24 Thread John J. Lee
Gordon Airporte <[EMAIL PROTECTED]> writes: [...] > Simply .click()ing on the form does not properly fill in > submit_button=Forward&action=apply, however. The arguments are there > but with no values. > Is this because ClientForm doesn't run javascript, Yes. > or is there a way > to determine a

Re: Windows Debugging w/o MS

2007-05-24 Thread olsongt
On May 24, 5:54 pm, "Christopher Anderson" <[EMAIL PROTECTED]> wrote: > > Debug builds are incompatible with release builds. You'll need to > > build every binary extension in debug mode (assuming the original > > authors don't provide debug builds). > > Right, and this is what I would like to avo

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 12:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > Actually, you can do this: > > > class Dog(object): > > def aFunction(self): > > result = 20 + 2 > > def run(self): > > #do stuff > >

Python script not mapping our site correctly?

2007-05-24 Thread [EMAIL PROTECTED]
We have been using the Google recommended python script for about a year. We recently realized that the script was not crawling our sites url's, but just our folders which reside on the server. The python script seems to be designed for 'non database' sites, not a site which is using .asp, and has

Re: Different methods with same name but different signature?

2007-05-24 Thread 7stud
In python, every(?) variable name and its value is stored in a dict somewhere, and when you try to access the name, it is looked up in the dict. So if you write: def f(x): print x def f(x, y): print x,y when those lines are first parsed as your file loads, somewhere this happens: somedi

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread [EMAIL PROTECTED]
On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > Actually, you can do this: > > class Dog(object): > def aFunction(self): > result = 20 + 2 > def run(self): > #do stuff > aFunction() > #do other stuff > import timeit > > t = timeit.Timer("d.aFunction()

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread [EMAIL PROTECTED]
On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > Actually, you can do this: > > class Dog(object): > def aFunction(self): > result = 20 + 2 > def run(self): > #do stuff > aFunction() > #do other stuff > import timeit > > t = timeit.Timer("d.aFunction()

RE: installing cx_Oracle.

2007-05-24 Thread Doug Phillips
> It also works the other way around, at least on the non-empty > set of systems that contains my workstation. export simply > marks the variable name for automatic export to the > environment of subsequent commands. The value at that time > doesn't matter. What matters is the value that the na

Re: question about getch()

2007-05-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hey all, > > I'm having a problem with using msvcrt.getch() . What I want is some > functionality like this: > > print 'blah blah blah, good_input to do blah blah blah, exit_key to exit' > > while input != exit_key: > input = get_input_from_getch() > > i

Re: need advice on building core code for python and PHP

2007-05-24 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, digimotif <[EMAIL PROTECTED]> wrote: >All, >I'm currently working with a small development company on a PHP >application they already have. There are several processing tasks >that could be scripted in Python and run in the background to modify a >database, instead

question about getch()

2007-05-24 Thread gliquidsnake
Hey all, I'm having a problem with using msvcrt.getch() . What I want is some functionality like this: print 'blah blah blah, good_input to do blah blah blah, exit_key to exit' while input != exit_key: input = get_input_from_getch() if input == good_input: print input

Re: Windows Debugging w/o MS

2007-05-24 Thread Christopher Anderson
> Debug builds are incompatible with release builds. You'll need to > build every binary extension in debug mode (assuming the original > authors don't provide debug builds). Right, and this is what I would like to avoid having to do. Thanks, Chris PS. Sorry for the duplicate olsongt -- http:/

Re: pyodbc data corruption problem

2007-05-24 Thread Joe Salmeri
I have done some additiona investigate into this problem and found the following: As described below the problem does not begin to appear until the return value size is > 2048. Once the return value is greater than 2048 bytes the value returned by pyodbc is 2 times the actual size of the retur

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
Actually, you can do this: class Dog(object): def aFunction(self): result = 20 + 2 def run(self): #do stuff aFunction() #do other stuff import timeit t = timeit.Timer("d.aFunction()", "from __main__ import Dog; d = Dog()") print t.timeit() Since you only

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 11:30 am, 7stud <[EMAIL PROTECTED]> wrote: > On May 24, 9:36 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > Hi, > > > I am using timeit to time a global function like this > > > t = timeit.Timer("timeTest()","from __main__ import timeTest") > > result = t.timeit(); > > >

Re: installing cx_Oracle.

2007-05-24 Thread Carsten Haese
On Thu, 2007-05-24 at 16:15 +, Dennis Lee Bieber wrote: > On Thu, 24 May 2007 09:07:07 -0500, Carl K <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > Getting closer, thanks Bill and Diez. > > > > $ export ORACLE_HOME > > $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/prod

Re: need advice on building core code for python and PHP

2007-05-24 Thread Szabolcs Nagy
> Is there a way I could code the base (core) code in Python and have > PHP call it? I've really liked using SQLAlchemy and there are other * quick and dirty solution: in a shell: $ python yourscript.py pipe_out in the php script: fwrite(pipe_in, input_data); results = fread(pipe_out, size

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 9:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I am using timeit to time a global function like this > > t = timeit.Timer("timeTest()","from __main__ import timeTest") > result = t.timeit(); > > But how can i use timeit to time a function in a class? > class FetchUrlTh

Re: CP4E revival

2007-05-24 Thread Michael Tobis
On May 24, 5:03 am, Richard Jones <[EMAIL PROTECTED]> wrote: > Michael Tobis wrote: > >http://tinyurl.com/yr62r3 > > > seems to short-circuit some pointless hoop-jumping to get you to the > > article. > > Hoop-jumping implemented to prevent just this kind of direct linking (and > thus not saving of

Re: modifying values of List or Dictionary when iterating on them

2007-05-24 Thread Christopher Anderson
> d=dict(a=1, b=2, c=3) > for k, v in d.iteritems(): > d[k]=d[k]+1 You might as well do: d[k] = v + 1, like for the list. -- http://mail.python.org/mailman/listinfo/python-list

Re: 0 == False but [] != False?

2007-05-24 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Paul McGuire <[EMAIL PROTECTED]> wrote: > This has *got* to rank up there among the VFAQ's of them all, along > with the mysterious shared default empty list argument. I think this > particular question has been asked in one form or another at least > twice a week

Re: No file from stdin

2007-05-24 Thread aspineux
On 24 mai, 18:48, Tartifola <[EMAIL PROTECTED]> wrote: > Hi, > suppose a script of python is waiting for a file from the stdin and none > is given. How can I make the script to stop and, for example, print an > error message? > > Sorry for the n00b question and thanks import sys import os.path if

Re: Bootstrapping

2007-05-24 Thread Mauler
I've seen it, but its different, the idea behind pyinstaller is to bundle python for a specific application, my idea is to modularize and compact the core of python and reuse the egg concept for extensions. The thing is that refuses to load the site-packages when the core is compressed. thanks agai

modifying values of List or Dictionary when iterating on them

2007-05-24 Thread aspineux
Hello I just want to update the data inside List or Dictionary without adding or deleting object. is this correct ? l=[1, 2, 3] for i, v in enumerate(l): l[i]=v+1 d=dict(a=1, b=2, c=3) for k, v in d.iteritems(): d[k]=d[k]+1 Both works, but : are they correct ? are they optimum for big

Re: Different methods with same name but different signature?

2007-05-24 Thread Robert Kern
No. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: installing cx_Oracle.

2007-05-24 Thread Carl K
Dennis Lee Bieber wrote: > On Thu, 24 May 2007 09:07:07 -0500, Carl K <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Getting closer, thanks Bill and Diez. >> >> $ export ORACLE_HOME >> $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client > > Don't those

Re: of destructors, open files and garbage collection

2007-05-24 Thread massimo s.
> Relying on the `__del__()` method isn't a good idea because there are no > really hard guaranties by the language if and when it will be called. Ok, I read the __del__() docs and I understand using it is not a good idea. I can easily add a close_files() method that forces all dangling files to

Re: of destructors, open files and garbage collection

2007-05-24 Thread massimo s.
> It will delete the *name* `item`. It does nothing to the object that was > bound to that name. If the name was the only reference to that object, it > may be garbage collected sooner or later. Read the documentation for the > `__del__()` method for more details and why implementing such a meth

No file from stdin

2007-05-24 Thread Tartifola
Hi, suppose a script of python is waiting for a file from the stdin and none is given. How can I make the script to stop and, for example, print an error message? Sorry for the n00b question and thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading (and writing?) audio file tags

2007-05-24 Thread Paul Moore
On 24 May, 17:22, darren kirby <[EMAIL PROTECTED]> wrote: > quoth the Paul Moore: > > > I'd like to write some scripts to analyze and manipulate my music > > files. The files themselves are in MP3 and FLAC format (mostly MP3, > > but FLAC where I ripped original CDs and wanted a lossless format). >

need advice on building core code for python and PHP

2007-05-24 Thread digimotif
All, I'm currently working with a small development company on a PHP application they already have. There are several processing tasks that could be scripted in Python and run in the background to modify a database, instead of the way they have it now, which waits for a webpage to return from proc

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread vasudevram
On May 24, 8:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I am using timeit to time a global function like this > > t = timeit.Timer("timeTest()","from __main__ import timeTest") > result = t.timeit(); > > But how can i use timeit to time a function in a class? > class FetchUrlTh

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Steve Holden
Joshua J. Kugler wrote: > Yes, I've read this: > http://mail.python.org/pipermail/python-list/2006-August/395943.html > That's not my problem. > > I installed PlanetPlanet via the > package's "setup.py install" command (as root). planet.py will not run, > however, g

Re: installing cx_Oracle.

2007-05-24 Thread Steve Holden
Dennis Lee Bieber wrote: > On Thu, 24 May 2007 09:07:07 -0500, Carl K <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Getting closer, thanks Bill and Diez. >> >> $ export ORACLE_HOME >> $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client > > Don't those

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Paul Moore
On 23 May, 02:20, "Joshua J. Kugler" <[EMAIL PROTECTED]> wrote: > Yes, I've read > this:http://mail.python.org/pipermail/python-list/2006-August/395943.html > That's not my problem. > > I installed PlanetPlanet via the > package's "setup.py install" command (as root)

Re: of destructors, open files and garbage collection

2007-05-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, massimo s. wrote: > I have a for loop that looks like the following : > > for item in long_list: >foo(item) > > def foo(item): >item.create_blah() #<--this creates item.blah; by doing that it > opens a file and leaves it open until blah.__del__() is called

Re: Reading (and writing?) audio file tags

2007-05-24 Thread darren kirby
quoth the Paul Moore: > I'd like to write some scripts to analyze and manipulate my music > files. The files themselves are in MP3 and FLAC format (mostly MP3, > but FLAC where I ripped original CDs and wanted a lossless format). > I've no idea what form of tags are used in the files (ID3v1, ID3v2,

Module imports fine from interactive, not from script

2007-05-24 Thread Joshua J. Kugler
Yes, I've read this: http://mail.python.org/pipermail/python-list/2006-August/395943.html That's not my problem. I installed PlanetPlanet via the package's "setup.py install" command (as root). planet.py will not run, however, giving me this error: Traceback (most

Re: of destructors, open files and garbage collection

2007-05-24 Thread Paul Moore
On 24 May, 16:40, "massimo s." <[EMAIL PROTECTED]> wrote: > Now, what I thought is that if I call > > del(item) > > it will delete item and also all objects created inside item. Sort of, but it's a bit more subtle. You'll stop the name "item" from referring to your item - if nothing else refers to

Re: Shared Memory Space - Accross Apps & Network

2007-05-24 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Tim Golden <[EMAIL PROTECTED]> wrote: . . . >PyLinda - http://www-users.cs.york.ac.uk/~aw/pylinda/ > >This implements the tuplespace paradigm. It's great >fun to use, but as far as I know this i

Reading (and writing?) audio file tags

2007-05-24 Thread Paul Moore
I'd like to write some scripts to analyze and manipulate my music files. The files themselves are in MP3 and FLAC format (mostly MP3, but FLAC where I ripped original CDs and wanted a lossless format). I've no idea what form of tags are used in the files (ID3v1, ID3v2, OGG, APE, ...) I just used wh

  1   2   >