a re problem

2005-05-28 Thread cheng
hi,all, i try to replace every target word found in the text for target in splitText: if stopwords.find(target) >= 0 : text = re.sub(r'\b%s\b','',text) &target when i using the statment: text = re.sub(r'\b%s\b','',text) &target get error : unsupported operand type(s) for &

search/replace in Python

2005-05-28 Thread Vamsee Krishna Gomatam
Hello, I'm having some problems understanding Regexps in Python. I want to replace "PHRASE" with "http://www.google.com/search?q=PHRASE>PHRASE" in a block of text. How can I achieve this in Python? Sorry for the naive question but the documentation is really bad :-( Regards, GVK -- http

Re: write to the same file from multiple processes at the same time?

2005-05-28 Thread Do Re Mi chel La Si Do
Hi ! On windows, with PyWin32, to read this little sample-code : import time import win32file, win32con, pywintypes def flock(file): hfile = win32file._get_osfhandle(file.fileno()) win32file.LockFileEx(hfile, win32con.LOCKFILE_EXCLUSIVE_LOCK, 0, 0x, pywintypes.OVERLAPPED()) def f

Re: What are OOP's Jargons and Complexities?

2005-05-28 Thread Xah Lee
The Rise of “Constructors” and “Accessors” A instantiation, is when a variable is assigned a super-subroutine (class). A variable assigned such a super-subroutine is now called a instance of a class or a object. In OOP practice, certain inner-subroutines (methods) have developed into specialized

Re: lambda a plusieurs arguments

2005-05-28 Thread nico
Bonjour, > [EMAIL PROTECTED] seems to be a good place to post > questions related to Python if you intend to use > french. > > -> http://www.aful.org/wws/arc/python/ > > (( > des questions rédigées en français sont plus > à leur place sur des liste de diffusions > nationales ... > ))

Tkinter slowes down

2005-05-28 Thread pavel.kosina
It seems to me that in my "again and again repainting canvas" script the rendering is slowing down as the time goes. It is visible even after 10 seconds. Any idea why? -- geon The exception is rule. -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda a plusieurs arguments

2005-05-28 Thread nico
Jp Calderone wrote: > On Fri, 27 May 2005 19:38:33 +0200, nico <[EMAIL PROTECTED]> wrote: >>Bonjour, >> >>Comment faire une fonction lambda a plusieurs arguments ? >> > (lambda a:a+1)(2) >>3 > f=(lambda (a,b):a+b) > f(5,6) >>Traceback (most recent call last): >> File "", line 1, in ?

How to load plugins as objects?

2005-05-28 Thread censored
Hi. I'm hoping for a bit of programming guidance here I have an application I wrote (it's an irc bot fyi), with which I want to use plugins. Basically, I want there to be directory called plugins/ . In plugins, there should be a bunch of *.py files. Each file should contain a single class

Re: search/replace in Python

2005-05-28 Thread John Machin
Vamsee Krishna Gomatam wrote: > Hello, > I'm having some problems understanding Regexps in Python. I want > to replace "PHRASE" with > "http://www.google.com/search?q=PHRASE>PHRASE" in a block of > text. How can I achieve this in Python? Sorry for the naive question but > the documentation is

Re: Software licenses and releasing Python programs for review

2005-05-28 Thread Ivan Voras
poisondart wrote: > Ultimately I desire two things from the license (but not limited to): > - being able to distribute it freely, anybody can modify it > - nobody is allowed to make profit from my code (other than myself) GPL does something like this, except it doesn't forbid anyone to sell the

[ANN] pysqlite 2.0.3 released

2005-05-28 Thread Gerhard Haering
This is a minor bugfix release. Wiki, bugtracker, downloads at http://pysqlite.org/ Changes since 2.0.2 === The changes for prefetching in 2.0.2 were incomplete. A check that made sense before had to be removed, otherwise fetchone() / fetchmany() / fetchall() could raise Programm

Re: search/replace in Python

2005-05-28 Thread Leif K-Brooks
Oliver Andrich wrote: > re.sub(r"(.*)",r" href=http://www.google.com/search?q=\1>\1", text) For real-world use you'll want to URL encode and entityify the text: import cgi import urllib def google_link(text): text = text.group(1) return '%s' % (cgi.escape(urllib.quote(text)),

Re: search/replace in Python (solved)

2005-05-28 Thread Vamsee Krishna Gomatam
Leif K-Brooks wrote: > Oliver Andrich wrote: > > > For real-world use you'll want to URL encode and entityify the text: > > import cgi > import urllib > > def google_link(text): > text = text.group(1) > return '%s' % (cgi.escape(urllib.quote(text)), >

Re: search/replace in Python (solved)

2005-05-28 Thread Leif K-Brooks
Vamsee Krishna Gomatam wrote: > text = re.sub( "([^<]*)", r' href="http://www.google.com/search?q=\1";>\1', text ) But see what happens when text contains spaces, or quotes, or ampersands, or... -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions about wxPython...

2005-05-28 Thread Oliver Albrecht
Helmutt schrieb: > Whats the name of the event that occur when I press the > exit/cross-button on the frame? > How do I connect a function with that event? Hi, I try just to begin the same. I found this in the docu. wxApp::OnExit http://wxwidgets.org/manuals/2.5.3/wx_wxapp.html#wxapponexit wxWin

Re: How to load plugins as objects?

2005-05-28 Thread Fredrik Lundh
"censored" <[EMAIL PROTECTED]> wrote: > Hi. I'm hoping for a bit of programming guidance here > > I have an application I wrote (it's an irc bot fyi), with which I want to > use plugins. > > Basically, I want there to be directory called plugins/ . > > In plugins, there should be a bunch of *

smart logging and the "inspect" module ...

2005-05-28 Thread Darran Edmundson
I was playing around with the inspect module the other day trying to write a quick and dirty "smart" logger. By this I mean that writing a message to the global log would also yield some info about the calling scope. If you look at my function "test" below, I'd ideally like log messages: foo.py

Is there a better way of doing this?

2005-05-28 Thread Michael
Hi, I'm fairly new at Python, and have the following code that works but isn't very concise, is there a better way of writing it?? It seems much more lengthy than python code i have read. :-) (takes a C++ block and extracts the namespaces from it) def ExtractNamespaces(data): print("Extract

Re: Tkinter slowes down

2005-05-28 Thread Fredrik Lundh
"pavel.kosina" <[EMAIL PROTECTED]> wrote: > It seems to me that in my "again and again repainting canvas" script the > rendering is slowing down as the time goes. when you add an item to the canvas, it's part of the canvas until you remove it. if performance drops, it's usually because you keep

Threading questions

2005-05-28 Thread Antal Rutz
Hi, All! I'm new to threading. I have some design questions: Task: I collect data and store them in an RDBMS (mysql or pgsql) The question is how to do that with threading? The data-collecting piece of the code runs in a thread. 1. Open the db, and each thread writes the result immediately. (

CVS interface module

2005-05-28 Thread Jim
Hello, Inside of a Python script I need to work a CVS archive. Nothing fancy, but I need to update the local tree, change or add some files from time to time, and commit. Naturally I looked for a module that would allow me to easily see if there were conflicts, the server is down, etc. I've loo

Re: CVS interface module

2005-05-28 Thread Fredrik Lundh
"Jim" wrote: > Inside of a Python script I need to work a CVS archive. Nothing fancy, > but I need to update the local tree, change or add some files from time > to time, and commit. Naturally I looked for a module that would allow > me to easily see if there were conflicts, the server is down,

Re: unbuffering std streams in code

2005-05-28 Thread Fredrik Lundh
John Reese wrote: > You know how you can specify that stderr, stdin, stdout should be > unbuffered by running python with the -u switch? Is there any way I > can have the same affect in code by doing something to the sys.std* > variables? try this: >>> import os, sys >>> sys.stdout = os.fdopen(

__call__

2005-05-28 Thread TK
Hi, how can handle __call__? Can you give a sample? Thanks o-o Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: CVS interface module

2005-05-28 Thread Jim
Thank you; in fact I did see that. Forgive me, but it is often difficult to tell what on sf is helpful. I noted the version number 0.1, the file date of 2003, that there are essentially no hits (that is, that people seem not to be downloading), and that there is almost no traffic in the forums.

Is there already a Python module to access the USPTO web site?

2005-05-28 Thread Terry Carroll
I have the need to run periodic searches on the US Patent and Trademark Office website, . I need a Python module to do this. Before I reinvent the wheel, I thought I'd check to see if anyone knew of such a beast. For instance, I'd like to be able to pass an argument like o

Re: Software licenses and releasing Python programs for review

2005-05-28 Thread Robert Kern
poisondart wrote: > Hi, > > I'm not sure if this is the right group to post this. If not, then I > would appreciate if somebody could point me to the correct group. > > This is my first time releasing software to the public and I'm wanting > to release a Python program I wrote for review (and cri

Re: __call__

2005-05-28 Thread Simon Percivall
Look at http://docs.python.org/ref/callable-types.html >>> class Test(object): ... def __call__(self): ... print "the instance was called" ... >>> t = Test() >>> t() the instance was called Is this what you wanted? -- http://mail.python.org/mailman/listinfo/python-list

Re: smart logging and the "inspect" module ...

2005-05-28 Thread George Sakkis
"Darran Edmundson" wrote: > I was playing around with the inspect module the other day > trying to write a quick and dirty "smart" logger. By this I mean > that writing a message to the global log would also yield some > info about the calling scope. If you look at my function "test" > below, I'd

Re: Threading questions

2005-05-28 Thread F. GEIGER
Just an idea: You could have n data collector threads, that all put their results into a queue connected to 1 db thread, that stores the results into the db. Cheers Franz GEIGER "Antal Rutz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hi, All! > > I'm new to threading. I

Re: Tkinter slowes down

2005-05-28 Thread pavel.kosina
Fredrik Lundh napsal(a): > when you add an item to the canvas, it's part of the canvas > until you remove it. if performance drops, it's usually because > you keep adding new items without removing the old ones. > > try adding a w.delete(ALL) call before you "repaint". > In the meantime I found

Help with choice of suitable Architecture

2005-05-28 Thread Rob Cowie
Hi, This is my first post so go easy! I have been asked (as part of an MSc project) to create a server based planner for a research group at my uni. It will have a web interface to interact with data stored in an XML document. Basic functionality is required such as viewing, searching, editing, c

Re: Determine if windows drive letter is hard drive or optical from python?

2005-05-28 Thread Wolfgang Strobl
"mh" <[EMAIL PROTECTED]>: >2. More importantly for those drives that exist, how do I determine if >it is actually a harddrive? C:\>python Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> impor

a dict problem

2005-05-28 Thread cheng
hi all..it a problem about dict: print target, dict[target] get output: keyword {page3.html, page2.html, page1.html} is it some ways to change it to: keyword {page1.html, page2.html, page3.html} -- http://mail.python.org/mailman/listinfo/python-list

Re: __call__

2005-05-28 Thread TK
class Test(object): > > ... def __call__(self): > ... print "the instance was called" > ... > t = Test() t() > > the instance was called > > Is this what you wanted? Yeah! Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: first release of PyPy

2005-05-28 Thread Kay Schluehr
Anton Vredegoor wrote: > I'm not involved in PyPy myself but this would seem a logical > possibility. To go a step further, if the compiler somehow would know > about the shortest machine code sequence which would produce the > desired effect then there would be no reason to limit onself to only >

Re: a dict problem

2005-05-28 Thread Benji York
cheng wrote: > hi all..it a problem about dict: > > print target, dict[target] > > get output: > > keyword > {page3.html, page2.html, page1.html} > > is it some ways to change it to: > > keyword > {page1.html, page2.html, page3.html} First, I would recommend you always post actual cod

Re: a dict problem

2005-05-28 Thread Steven Bethard
Benji York wrote: > I'll extrapolate from your message that you want to get the values of > the dict in sorted order. If so, here's how: > > >>> d = {'a': 1, 'b': 2, 'c':3} > >>> d > {'a': 1, 'c': 3, 'b': 2} > >>> v = d.values() > >>> v > [1, 3, 2] > >>> v.sort() > >>> v > [1, 2, 3] Or in

Re: a re problem

2005-05-28 Thread James Stroud
py> import re py> target = 'blah' py> text = 'yaddah blah yaddah yaddah' py> ext = re.sub(r'\b%s\b' % target,'',text) py> ext 'yaddah yaddah yaddah' On Friday 27 May 2005 10:56 pm, cheng wrote: > hi,all, i try to replace every target word found in the text > > for target in splitText: >

Re: Help with choice of suitable Architecture

2005-05-28 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 28 May 2005, Rob Cowie wrote: [...] > I'm totally new to web programming. I have been looking into the best > way to proceed. CGI is of course an option but it seems slow, clunky > and outdated. Twisted provides a rich architecture but might be > o

Re: Case Sensitive, Multiline Comments

2005-05-28 Thread Mike Meyer
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > On 26 May 2005 17:33:33 -0700, "Elliot Temple" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Thanks for the link on case sensitivity. I'm curious about the person >> who found case sensitivity useful though: what is it usef

Trying to understand pickle.loads withou class declaration

2005-05-28 Thread Philippe C. Martin
Hi, Shuffling files around in my project, I notice I broke everything when I stopped declaring classes in a program that "pickled.loaded" existing pickled object of type "classes". The error message being that the class(es) was unknown. However, I _think_, I did manage to do the following in the

Re: Is there already a Python module to access the USPTO web site?

2005-05-28 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sat, 28 May 2005, Terry Carroll wrote: > I have the need to run periodic searches on the US Patent and > Trademark Office website, . I need a Python > module to do this. Before I reinvent the wheel, I thought I'd check > to

Re: Threading questions

2005-05-28 Thread [EMAIL PROTECTED]
For threading I use usually this recipe as a base: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65448, I think you can use it for your purpose as well. -- http://mail.python.org/mailman/listinfo/python-list

Re: write to the same file from multiple processes at the same time?

2005-05-28 Thread Mike Meyer
Paul Rubin writes: > Really, I think the Python library is somewhat lacking in not > providing a simple, unified interface for doing stuff like this. It's got one. Well, three, actually. The syslog module solves the problem quite nicely, but only works on Unix. If the O

Re: Trying to understand pickle.loads withou class declaration

2005-05-28 Thread Philippe C. Martin
I confirm that all I have to do in order to successfully load a pickled object of class A is to declare class A: def __init__(self): pass Although the object has tons of fields Quid ? Regards, Philippe Philippe C. Martin wrote: > Hi, > > Shuffling files around in my project,

Re: Help with choice of suitable Architecture

2005-05-28 Thread Paul Rubin
"Rob Cowie" <[EMAIL PROTECTED]> writes: > I have been asked (as part of an MSc project) to create a server based > planner for a research group at my uni. It will have a web interface to > interact with data stored in an XML document. Why not just a regular database? > Basic functionality is req

Re: pygame 1.6 for windows (python2.4)

2005-05-28 Thread burlo . stumproot
Will McGugan <[EMAIL PROTECTED]> writes: > bc wrote: > > Thanks for the reply, Will... I have been to the site, but I get a "URL > > not found error" when I try the pygame 1.6 for python24 link; I guess > > I will just keep trying until the HTML is fixed. > > > > Does seem to be broken at the m

Re: Parsing a Python dictionary inside a Python extension

2005-05-28 Thread tiissa
[EMAIL PROTECTED] wrote: > I tried something like this and it has not worked. Oh! What did you ask of it, what did you expect and what did you get? > if ( (item = PyDict_GetItemString( vdict , "atab1")) != NULL ) > PyArg_ParseTuple( item , "i" , &atab1 ); This code expects a dictionary

Re: __call__

2005-05-28 Thread TK
Simon Percivall wrote: > Look at http://docs.python.org/ref/callable-types.html > > class Test(object): > > ... def __call__(self): > ... print "the instance was called" > ... > t = Test() t() > > the instance was called > > Is this what you wanted? Sorry but it does

Getting value of radiobutton trouble

2005-05-28 Thread VK
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from Tkinter import * class GetVariant: def __init__(self): self.root = Tk() self.mainfra

Re: __call__

2005-05-28 Thread Mike Meyer
TK <[EMAIL PROTECTED]> writes: > Simon Percivall wrote: >> Look at http://docs.python.org/ref/callable-types.html >> >class Test(object): >> ... def __call__(self): >> ... print "the instance was called" >> ... >> >t = Test() >t() >> the instance was called >> Is this what y

Re: Help with choice of suitable Architecture

2005-05-28 Thread Rob Cowie
I agree with the sentiments that a single XML file is not the way to go for storing data that may be accessed concurrently. However, my hands are tied. It seems that CGI is likely to be the most straightforward option. Is the learning curve likely to be steeper for pure CGI or a web application ar

Re: __call__

2005-05-28 Thread tiissa
TK wrote: > Sorry but it does not work. It _does_ work. It just don't do what you expect. That's different till you know how to do it. Let's see: > >>> class Test(object): > ... def __call__(self): > ... print 'Hi' > ... You first define a class whose members can be called.

UTF16 codec doesn't round-trip?

2005-05-28 Thread John Perks and Sarah Mount
(My Python uses UTF16 natively; can someone with UTF32 Python let me know if that behaves differently?) >>> import codecs >>> u'\ud800' # part of surrogate pair u'\ud800' codecs.utf_16_be_encode(_)[0] '\xd8\x00' codecs.utf_16_be_decode(_)[0] Traceback (most recent call last): File "", line 1, in

Re: Help with choice of suitable Architecture

2005-05-28 Thread Mike Meyer
"Rob Cowie" <[EMAIL PROTECTED]> writes: > Paul. I agree that client-side scripting increases the level of > compexity, but did it really go out of fashion with pop-ups? It seems > to be just getting started. Google use it to great effect maps, > suggest etc. I wasn't thinking of using it t

Re: Help with choice of suitable Architecture

2005-05-28 Thread Paul Rubin
"Rob Cowie" <[EMAIL PROTECTED]> writes: > Paul. I agree that client-side scripting increases the level of > compexity, but did it really go out of fashion with pop-ups? It seems > to be just getting started. Pop-ups and scripting-related security holes are why the cool kids all surf with Javas

Re: __call__

2005-05-28 Thread TK
tiissa wrote: > TK wrote: > >> Sorry but it does not work. > > > It _does_ work. It just don't do what you expect. Seems so;-). Thanks a lot for help!!! o-o Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing 2 similar strings?

2005-05-28 Thread Rob W. W. Hooft
After reading this thread, I have wrapped up a different approach, probably not what you were looking for, but it is very good for what I wanted: comparing a command string typed by a user with all possible commands a program can accept, to be able to do typo-correction. The method will return

scipy for python 2.4

2005-05-28 Thread querypk
Did anyone try to install Scipy package on python2.4 linux version. I see only python2.3 version of scipy released. When I try to install I get an dependency warning saying scipy cannot find python2.3. Can someone point me to python2.4 version of scipy and help me install. -- http://mail.python.

Re: Getting value of radiobutton trouble

2005-05-28 Thread Philippe C. Martin
Hi, I think your second call to Tk() does it: this works although the look is different: from Tkinter import * class GetVariant: def __init__(self): self.root = Tk() self.mainframe = Frame(self.root,bg="yellow") self.mainframe.pack(fill=BOTH,expand=1) s

Re: Getting value of radiobutton trouble

2005-05-28 Thread Philippe C. Martin
Sorry, I still had your code in my clipboard :-) here goes: from Tkinter import * class GetVariant(Frame): def __init__(self,p): self.root = p self.mainframe = Frame(self.root,bg="yellow") self.mainframe.pack(fill=BOTH,expand=1) self.firstframe = Frame(

Re: Help with choice of suitable Architecture

2005-05-28 Thread Kent Johnson
Rob Cowie wrote: > I agree with the sentiments that a single XML file is not the way to go > for storing data that may be accessed concurrently. However, my hands > are tied. You might like to see the thread "write to the same file from multiple processes at the same time?" for a preview of the

Re: Getting value of radiobutton trouble

2005-05-28 Thread VK
Philippe C. Martin wrote: > Hi, > > I think your second call to Tk() does it: this works although the look is > different: > > > from Tkinter import * > class GetVariant: > def __init__(self): > self.root = Tk() > self.mainframe = Frame(self.root,bg="yellow") > s

Re: Getting value of radiobutton trouble

2005-05-28 Thread Philippe C. Martin
PS: Since your starting with TKinter, and although I do not know what your goal is, I suggest you take a look at wxPython: it is _wonderfull_ ! (no offence to TCL/TK) Regards, Philippe VK wrote: > Philippe C. Martin wrote: >> Hi, >> >> I think your second call to Tk() does it: this works

Re: scipy for python 2.4

2005-05-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Did anyone try to install Scipy package on python2.4 linux version. I > see only python2.3 version of scipy released. When I try to install I > get an dependency warning saying scipy cannot find python2.3. > > Can someone point me to python2.4 version of scipy and help m

Re: scipy for python 2.4

2005-05-28 Thread Philippe C. Martin
In order to help, I just tried to compile it, and it seems to have a bunch of dependencies to worry about: [EMAIL PROTECTED] SciPy_complete-0.3.2]# python setup.py install fftw_info: NOT AVAILABLE dfftw_info: NOT AVAILABLE FFTW (http://www.fftw.org/) libraries not found. Directori

String manipulations

2005-05-28 Thread Lorn
I'm trying to work on a dataset that has it's primary numbers saved as floats in string format. I'd like to work with them as integers with an implied decimal to the hundredth. The problem is that the current precision is variable. For instance, some numbers have 4 decimal places while others have

Re: Getting value of radiobutton trouble

2005-05-28 Thread VK
Philippe C. Martin wrote: > Sorry, > > I still had your code in my clipboard :-) here goes: So, your code works, but I need, that first window calls another separate window. In your programm they stick together. Reg, VK > > > > from Tkinter import * > class GetVariant(Frame): > def __in

Re: String manipulations

2005-05-28 Thread Philippe C. Martin
Multiply them by 1 ? Lorn wrote: > I'm trying to work on a dataset that has it's primary numbers saved as > floats in string format. I'd like to work with them as integers with an > implied decimal to the hundredth. The problem is that the current > precision is variable. For instance, some n

Re: Comparing 2 similar strings?

2005-05-28 Thread Irmen de Jong
Rob W. W. Hooft wrote: > After reading this thread, I have wrapped up a different approach, > probably not what you were looking for, but it is very good for what I > wanted: comparing a command string typed by a user with all possible > commands a program can accept, to be able to do typo-corre

Re: String manipulations

2005-05-28 Thread Lorn
Yes, that would get rid of the decimals... but it wouldn't get rid of the extraneous precision. Unfortunately, the precision out to the ten thousandth is noise... I don't need to round it either as the numbers are artifacts of an integer to float conversion. Basically, I need to know how many decim

Re: scipy for python 2.4

2005-05-28 Thread querypk
I tried to compile it from source. But it dint work.It was looking for python2.3 .But I want to install it on pyrthon 2.4 PLatform you mean I am using RedHat 9.0. is that what you were referring? can you point me to the source you are referring. I used the sourse from this link... http://www.scipy

Re: String manipulations

2005-05-28 Thread John Roth
"Lorn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to work on a dataset that has its primary numbers saved as > floats in string format. I'd like to work with them as integers with an > implied decimal to the hundredth. The problem is that the current > precision is va

Re: String manipulations

2005-05-28 Thread Elliot Temple
On May 28, 2005, at 2:52 PM, Lorn wrote: > Yes, that would get rid of the decimals... but it wouldn't get rid of > the extraneous precision. Unfortunately, the precision out to the ten > thousandth is noise... I don't need to round it either as the numbers > are artifacts of an integer to float c

Re: Getting value of radiobutton trouble

2005-05-28 Thread Philippe C. Martin
Then I guess you need a TopLevel widget instead: (I still suggest you look at wxPython) from Tkinter import * class GetVariant: def __init__(self,p): self.root = p self.firstframe = Frame(self.root,bg="red") self.firstframe.pack(side=BOTTOM,expand=1)

Re: UTF16 codec doesn't round-trip?

2005-05-28 Thread "Martin v. Löwis"
John Perks and Sarah Mount wrote: > If the ascii can't be recognized as UTF16, then surely the codec > shouldn't have allowed it to be encoded in the first place? I could > understand if it was trying to decode ascii into (native) UTF32. Please don't call the thing you are trying to decode "ascii"

Re: Copy paste in entry widget

2005-05-28 Thread Skip Montanaro
Michael> is copy, paste, cut of selection possible in entry widget? Docs Michael> say selection must be copied by default, in my programm it Michael> doesn't work. What platform? What GUI toolkit? -- Skip Montanaro [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/pytho

Re: Copy paste in entry widget

2005-05-28 Thread VK
Skip Montanaro wrote: > Michael> is copy, paste, cut of selection possible in entry widget? Docs > Michael> say selection must be copied by default, in my programm it > Michael> doesn't work. > > What platform? What GUI toolkit? > Linux, Windows. TkInter, Pmw. I've already implement

Re: Getting value of radiobutton trouble

2005-05-28 Thread VK
Philippe C. Martin wrote: > Then I guess you need a TopLevel widget instead: > > > (I still suggest you look at wxPython) > > > from Tkinter import * > class GetVariant: > def __init__(self,p): > self.root = p > > self.firstframe = Frame(self.root,bg="red") > se

Re: scipy for python 2.4

2005-05-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > I tried to compile it from source. But it dint work.It was looking for > python2.3 .But I want to install it on pyrthon 2.4 > PLatform you mean I am using RedHat 9.0. is that what you were > referring? > can you point me to the source you are referring. I used the sourse

Re: scipy for python 2.4

2005-05-28 Thread Robert Kern
Philippe C. Martin wrote: > In order to help, I just tried to compile it, and it seems to have a bunch > of dependencies to worry about: Yes, that's true. Only some kind of LAPACK/BLAS (with ATLAS for preference) is actually necessary. Coincidentally, there are binaries provided if you can't fi

Re: String manipulations

2005-05-28 Thread Lorn
Thank you Elliot, this solution is the one I was trying to come up with. Thank you for your help and thank you to everyone for their suggestions. Best regards, Lorn -- http://mail.python.org/mailman/listinfo/python-list

Re: Software licenses and releasing Python programs for review

2005-05-28 Thread poisondart
Thanks for the replies. They have been very helpful. I'll have to read through the licenses you've listed in more detail, but the creative commons license of which James William Pye mentions seems to be what I'll be using. The reason why I need people to review my code and also the ideas behind th

Re: Is there already a Python module to access the USPTO web site?

2005-05-28 Thread Terry Carroll
On Sat, 28 May 2005 20:37:40 +0200 (CEST), Tomasz Rola <[EMAIL PROTECTED]> wrote: >I don't know but if you are determined to have it in Python, perhaps ypu >should check MozPython. Thanks. That seems a little more than I need, but it looks intriguing. -- http://mail.python.org/mailman/listinfo/

Re: Strings for a newbie

2005-05-28 Thread James Hofmann
Malcolm Wooden dtptypes.com> writes: > > I'm trying to get my head around Python but seem to be failing miserably. I > use RealBasic on a Mac and find it an absolute dream! But PythonUGH! > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In RB it

Re: Strings for a newbie

2005-05-28 Thread Warren Block
James Hofmann <[EMAIL PROTECTED]> wrote: > Malcolm Wooden dtptypes.com> writes: >> >> I'm trying to get my head around Python but seem to be failing miserably. I >> use RealBasic on a Mac and find it an absolute dream! But PythonUGH! >> >> I want to put a sentence of words into an array, eg

Re: Intellisense and the psychology of typing

2005-05-28 Thread Lurker
"James D Carroll" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if I have to type 'boolean' instead of 'boo' I get real cranky real fast. Why? Is your programming speed really limited by the difference between typing "lean" and hitting ? If typing speed is the limitation - go get

Re: Comparing 2 similar strings?

2005-05-28 Thread Rob W. W. Hooft
Irmen de Jong wrote: > Wouldn't it be easier if it is normalized to a float between 0.0 and 1.0? Maybe. You could do that by ignoring "negative" values, and by dividing by min(len(s1),len(s2))+1. For my application this is irrelevant, I only need a scale to compare a single word to many differen

How do i read just the last line of a text file?

2005-05-28 Thread nephish
Hey there. i want to set a variable to represent the last line of a text file how do i do that? or even better, how do i create a list of the lines of a text file? -- http://mail.python.org/mailman/listinfo/python-list

Re: How do i read just the last line of a text file?

2005-05-28 Thread John Machin
nephish wrote: > Hey there. > i want to set a variable to represent the last line of a text file > how do i do that? > or even better, how do i create a list of the lines of a text file? > Hey there to you too. According to the manual http://www.python.org/doc/2.4.1/lib/bltin-file-objects.html

Re: write to the same file from multiple processes at the same time?

2005-05-28 Thread [EMAIL PROTECTED]
Well I just tried it on Linux anyway. I opened the file in two python processes using append mode. I then wrote simple function to write then flush what it is passed: def write(msg): foo.write("%s\n" % msg) foo.flush() I then opened another terminal and did 'tail -f myfile.txt'. It worke

Re: How do i read just the last line of a text file?

2005-05-28 Thread Chris F.A. Johnson
On Sun, 29 May 2005 at 04:42 GMT, nephish wrote: > Hey there. > i want to set a variable to represent the last line of a text file > how do i do that? > or even better, how do i create a list of the lines of a text file? from sys import argv ## Import argv from sys module file = open(arg

Re: How do i read just the last line of a text file?

2005-05-28 Thread John Machin
Chris F.A. Johnson wrote: > > file = open(argv[1]) ## Open the file given on the command line > all_lines = file.readlines() ## Read all the lines I see your shadowing and raise you one obfuscation: open = file(argv[1]) ## File the open given on the command line all_lines = o

SWIG std::string& passing

2005-05-28 Thread Leonard J. Reder
Hello, I have been trying to get this simple call to work with a SWIG interface. The problem is I do not know how to pass a const char * or a std::string & in python to SWIG wrapped code. I tried several of the *.i libraries at http://www.swig.org/Doc1.3/Library.html. Most notably the "std_