Re: a little about regex

2006-10-18 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Wednesday 18 October 2006 16:43, Rob Wolfe wrote: > |def filter(adr):    # note that "filter" is a builtin function also > |    import re I didn't know it, but my function _is_ starting by underscor

Re: [OT] a little about regex

2006-10-18 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Wednesday 18 October 2006 15:32, Ron Adam wrote: > |Instead of using two separate if's, Use an if - elif and be sure to test Thank you, Ron, for the input :) I'll examine also in this mode. Meanwhile

Re: Getting method name from within the class method

2006-10-18 Thread Fredrik Lundh
> on that on what -- http://mail.python.org/mailman/listinfo/python-list

Re: passing values to a program

2006-10-18 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > I almost have this thing running like I want it to run but I want > the values to come from the program that calls this one. There are two > things I want to pass File_Name and CutString. They both need to go to > loadFile routine of Class WordGrid to replace constants

Re: Cannot import a module from a variable

2006-10-18 Thread Fredrik Lundh
Cameron Walsh wrote: > Woah, that actually works? Having the "finally" after the "return"? > That could make some things easier, and some things harder... The whole point of having a clean-up handler is to make sure it runs no matter what: When a return, break or continue statement is exec

Re: Getting method name from within the class method

2006-10-18 Thread Fredrik Lundh
Gabriel Genellina wrote: > I could see some merit on getting that info in an automatic way. > The only reason I can see for knowing the name of a function is for > debugging purposes - maybe some kind of logging utility. If you are in > "debug mode", resources are not too important, but correct

Re: Getting method name from within the class method

2006-10-18 Thread Fredrik Lundh
Mitko Haralanov wrote: > class test(object): >> ... def a_method(self,this,that): >> ... print self.a_method.__name__ > > Doing the above will obviously work! so will print "a_method" of course. no need to be silly when you don't have to. > However, I don't want to have to use

Re: Getting method name from within the class method

2006-10-18 Thread Fredrik Lundh
Mitko Haralanov wrote: > I need to be able to get the name of the currently executed method > within that method. I know that the method object does have the > __name__ attribute but I know know how to access it from withing the > method. > > Something like this: > > class A: > > def a_

Re: passing values to a program

2006-10-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I almost have this thing running like I want it to run but I want > the values to come from the program that calls this one. There are two > things I want to pass File_Name and CutString. They both need to go to > loadFile routine of Class WordGrid to replace cons

Compile python on Solaris

2006-10-18 Thread Martijn de Munnik
Hi, I want to compile python on my solaris 10 system (amd 64 bit). I did the following: ./configure --prefix=/opt/64/python make which resulted in this error: "Include/pyport.h", line 730: #error: "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." so I edited the file

passing values to a program

2006-10-18 Thread [EMAIL PROTECTED]
I almost have this thing running like I want it to run but I want the values to come from the program that calls this one. There are two things I want to pass File_Name and CutString. They both need to go to loadFile routine of Class WordGrid to replace constants. Thank you for putting up w

Re: Plotting histograms

2006-10-18 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Thanks for the replies ... its perfect now ... but just one more thing > ... how can I plot another function(a semi circle) in the same > histogram? Just call the appropriate plotting function after you plot the histogram. By default, the second plot will go into the s

Re: Plotting histograms

2006-10-18 Thread [EMAIL PROTECTED]
Thanks for the replies ... its perfect now ... but just one more thing ... how can I plot another function(a semi circle) in the same histogram? thanks amit Robert Kern wrote: > [EMAIL PROTECTED] wrote: > > Thanks Robert, > > > > My previous problem is solved(I was using 'from matplotlib.pylab

Re: How to use python in TestMaker

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 23:34, kelin,[EMAIL PROTECTED] wrote: Now I 'm learning python to do testing jobs, and want to use it in TestMaker. The problem is: I don't know how to use python in TestMaker. Just write python program in it or call .py files in it? I am really new about it and need some

Re: Converting existing module/objects to threads

2006-10-18 Thread John Henry
Making your code run in thread mode isn't the hard part. Just add this: import threading class subcontrollerThread(threading.Thread, subcontroller): def __init__(self,id,configurationFile): threading.Thread.__init__(self) subcontroller.__init__(self,id,co

Re: Getting method name from within the class method

2006-10-18 Thread George Sakkis
Mitko Haralanov wrote: > On 18 Oct 2006 14:38:12 -0700 > [EMAIL PROTECTED] wrote: > > > >>> class test(object): > > ... def a_method(self,this,that): > > ... print self.a_method.__name__ > > Doing the above will obviously work! > > However, I don't want to have to use the name of the function i

Re: How to use python in TestMaker

2006-10-18 Thread Paddy
kelin,[EMAIL PROTECTED] wrote: > Hello, > > Now I 'm learning python to do testing jobs, and want to use it in > TestMaker. > The problem is: I don't know how to use python in TestMaker. > Just write python program in it or call .py files in it? > I am really new about it and need some help. > >

Re: Converting existing module/objects to threads

2006-10-18 Thread martdi
I am not sure if I understand you question well, but: in the __init__ of the thread subclass, you can instantiate an object of the class that makes the work or ControllerThread could extend both classes and i don't think there would be a problem. Problems in multithreading usually happen whe

Re: Converting existing module/objects to threads

2006-10-18 Thread [EMAIL PROTECTED]
martdi wrote: > [EMAIL PROTECTED] wrote: > > I have inheirted some existing code, that i will explain in a moment, > > have needed to extend and ultimately should be able to run in threads. > > I've done a bunch of work with python but very little with threads and > > am looking for some pointers

Re: Converting existing module/objects to threads

2006-10-18 Thread [EMAIL PROTECTED]
Gabriel Genellina wrote: > At Wednesday 18/10/2006 22:02, [EMAIL PROTECTED] wrote: > > >This currently works in a non-threaded version, but only for one device > >at a time, there is a need to create a single windows(yeach) service > >that talks to many of these devices at once. I don't need work

Re: Converting existing module/objects to threads

2006-10-18 Thread martdi
[EMAIL PROTECTED] wrote: > I have inheirted some existing code, that i will explain in a moment, > have needed to extend and ultimately should be able to run in threads. > I've done a bunch of work with python but very little with threads and > am looking for some pointers on how to implement, and

How to use python in TestMaker

2006-10-18 Thread kelin,[EMAIL PROTECTED]
Hello, Now I 'm learning python to do testing jobs, and want to use it in TestMaker. The problem is: I don't know how to use python in TestMaker. Just write python program in it or call .py files in it? I am really new about it and need some help. Thanks a lot! -- http://mail.python.org/mailma

Re: Cannot import a module from a variable

2006-10-18 Thread Cameron Walsh
Gabriel Genellina wrote: > At Wednesday 18/10/2006 22:51, Cameron Walsh wrote: > >> previous_directory = os.getcwd() >> try: >> os.chdir(directory) >> [ ... ] >> return modules >> finally: >> os.chdir(previous_directory) >> >> Woah, that actually works?

Corner cases (was: Converting existing module/objects to threads)

2006-10-18 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > So an instance of a controller needs to be deadicated to a hardware > device forever, or until the program endswhich ever comes first. I hope you've got tests in place for both of those conditions :-) -- \ "How many people here have tel

Re: Cannot import a module from a variable

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 22:51, Cameron Walsh wrote: previous_directory = os.getcwd() try: os.chdir(directory) [ ... ] return modules finally: os.chdir(previous_directory) Woah, that actually works? Having the "finally" after the "return"? That could

Re: making a valid file name...

2006-10-18 Thread Neil Cerutti
On 2006-10-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Tim Chase: >> In practice, however, for such small strings as the given >> whitelist, the underlying find() operation likely doesn't put a >> blip on the radar. If your whitelist were some huge document >> that you were searching repeat

Re: Converting existing module/objects to threads

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 22:02, [EMAIL PROTECTED] wrote: This currently works in a non-threaded version, but only for one device at a time, there is a need to create a single windows(yeach) service that talks to many of these devices at once. I don't need worker threads that handle seperate port

Re: Flexable Collating (feedback please)

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 21:36, Ron Adam wrote: >> if self.flag & CAPS_FIRST: >> s = s.swapcase() > > This is just coincidental; it relies on (lowercase)<(uppercase) on the > locale collating sequence, and I don't see why it should be always so. The LC_COLLATE structure (in

Re: Restart a Python COM Server

2006-10-18 Thread m . errami
Alright. I kind of get the idea. But how do I do that? Anyway, it is more for development reason than anything else. It's not that big of a deal. But still it would be nice to have a solution... Thanx again M.E. [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > Hello all. > > I am desperate

Re: Cannot import a module from a variable

2006-10-18 Thread Cameron Walsh
Hi, This has actually been answered in a previous post ("user modules" started by myself), for which I was very grateful. I have since expanded on their solutions to create the following code, of which parts or all may be useful. You'll probably be most interested in the last part of the code, f

Re: codecs.EncodedFile

2006-10-18 Thread Neil Cerutti
On 2006-10-19, Leo Kislov <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> It turns out to be troublesome for my case because the >> EncodedFile object translates calls to readline into calls to >> read. >> >> I believe it ought to raise a NotImplemented exception when >> readline is called. >>

Converting existing module/objects to threads

2006-10-18 Thread [EMAIL PROTECTED]
I have inheirted some existing code, that i will explain in a moment, have needed to extend and ultimately should be able to run in threads. I've done a bunch of work with python but very little with threads and am looking for some pointers on how to implement, and if the lower level modules/object

call Mac gcc -framework from CTypes how

2006-10-18 Thread p . lavarre
gcc -dynamiclib -framework CoreFoundation builds C code for Mac OS X that I call from Py code. Can I somehow get rid of the C, such as: #include void const * kCFTypeDictionaryKeyCallBacks_p(void) { return &kCFTypeDictionaryKeyCallBacks; } ? Thanks in advance, Pat LaVarre P.S. In Windo

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
Gabriel Genellina wrote: > At Wednesday 18/10/2006 03:42, Ron Adam wrote: > >> I put together the following module today and would like some feedback >> on any >> obvious problems. Or even opinions of weather or not it is a good >> approach. >> if self.flag & CAPS_FIRST: >>

Re: codecs.EncodedFile

2006-10-18 Thread Leo Kislov
Neil Cerutti wrote: > It turns out to be troublesome for my case because the > EncodedFile object translates calls to readline into calls to > read. > > I believe it ought to raise a NotImplemented exception when > readline is called. > > As it is it silently causes interactive applications to >

Re: httplib and HTTPS Connections

2006-10-18 Thread Heikki Toivonen
runningwild wrote: > When I try to run https_cli.py however I get the following exception: > This worked just fine showing me the directory listing and allowing me > to navigate. > This was also true for firefox when connecting to > https://localhost:9443/ from the server in > demos/httts.howto/or

Re: making a valid file name...

2006-10-18 Thread bearophileHUGS
Tim Chase: > In practice, however, for such small strings as the given > whitelist, the underlying find() operation likely doesn't put a > blip on the radar. If your whitelist were some huge document > that you were searching repeatedly, it could have worse > performance. Additionally, the find()

Re: Getting method name from within the class method

2006-10-18 Thread Steven D'Aprano
On Wed, 18 Oct 2006 13:59:55 -0700, Mitko Haralanov wrote: > I need to be able to get the name of the currently executed method > within that method. I know that the method object does have the > __name__ attribute but I know know how to access it from withing the > method. Here is a useful (mode

Re: Adding Worksheets to an Excel Workbook

2006-10-18 Thread wesley chun
> From: Tom Plunket > Date: Tues, Oct 17 2006 6:34 pm > > You've got a lot of sleep calls in there- did you find that things > behaved erratically without them? I haven't done any Office > automation with Python, but my DevStudio stuff has always worked a > treat without the sleep calls. sorry,

Re: Getting method name from within the class method

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 19:30, [EMAIL PROTECTED] wrote: > > > >>> class test(object): > > > ... def a_method(self,this,that): > > > ... print self.a_method.__name__ > > > >Doing the above will obviously work! > > > >However, I don't want to have to use the name of the function in the > >print

Re: characters in python

2006-10-18 Thread Leo Kislov
Leo Kislov wrote using google groups beta: > On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: > > Stens wrote: > > > Can python handle this characters: c,c,ž,d,š? [snip] > outfile.write(line.replace(u'd',u'd')) I hope you'll do better than google engeers who mess up croatian characters

Re: creating many similar properties

2006-10-18 Thread James Stroud
Michele Simionato wrote: > George Sakkis wrote: > >>Why is this less hidden or magical than a metaclass ? > > > Because it does not use inheritance. It is not going to create > properties on subclasses without > you noticing it. Also, metaclasses are brittle: try to use them with > __slots__, or

Re: Flexable Collating (feedback please)

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 03:42, Ron Adam wrote: I put together the following module today and would like some feedback on any obvious problems. Or even opinions of weather or not it is a good approach. if self.flag & CAPS_FIRST: s = s.swapcase() This is just coincidental;

Re: Reading a Microsoft access file.

2006-10-18 Thread Roger Upole
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I googled for the answer but all the answer seem to imply that you > have to have Access installed on your system. I have a file that was > created using Access and I want develop a Python script to > read the file and produce a report. C

Re: Flexible Collating (feedback please)

2006-10-18 Thread bearophileHUGS
Ron Adam: Insted of: def __init__(self, flags=[]): self.flags = flags self.numrex = re.compile(r'([\d\.]*|\D*)', re.LOCALE) self.txtable = [] if HYPHEN_AS_SPACE in flags: self.txtable.append(('-', ' ')) if UNDERSCORE_AS_SPACE in flag

?Incorrect Configure script?

2006-10-18 Thread Christopher Taylor
I'm not sure if this is a problem with python or not. I'm trying to compile up mod_python to point to /usr/bin/python2.4 (RH has /usr/bin/python2.3 already installed to I don't want to mess with /usr/bin/python). When it gets to linking in /usr/lib/python2.4/config/libpython2.4.a I get the follow

Re: characters in python

2006-10-18 Thread Leo Kislov
On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: > Stens wrote: > > Can python handle this characters: c,c,ž,d,š? > > > If can how"I wanna to change some characters in text (in the file) to the > characters at this address: > > http://rapidshare.de/files/37244252/Untitled-1_copy.png.html Yo

Re: Classes and Functions - General Questions

2006-10-18 Thread Setash
Andreas, and everyone else - thank you! I do appreciate the information and the quick responses, this single post with <10 replies has significantly helped my understanding level. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting method name from within the class method

2006-10-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Mitko Haralanov wrote: > On 18 Oct 2006 14:38:12 -0700 > [EMAIL PROTECTED] wrote: > >> >>> class test(object): >> ... def a_method(self,this,that): >> ... print self.a_method.__name__ > > Doing the above will obviously work! > > However, I don't want to have to use

Re: characters in python

2006-10-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Stens wrote: > Stens wrote: >> Can python handle this characters: ć,č,ž,đ,š? >> >> If can how" > I wanna to change some characters in text (in the file) to the > characters at this address: > > http://rapidshare.de/files/37244252/Untitled-1_copy.png.html Do you want to

Re: Getting method name from within the class method

2006-10-18 Thread yellowalienbaby
Gabriel Genellina wrote: > At Wednesday 18/10/2006 18:59, Mitko Haralanov wrote: > > > > >>> class test(object): > > > ... def a_method(self,this,that): > > > ... print self.a_method.__name__ > > > >Doing the above will obviously work! > > > >However, I don't want to have to use the name of the

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
This is how I changed it... (I edited out the test and imports for posting here.) locale.setlocale(locale.LC_ALL, '') # use current locale settings class Collate(object): """ A general purpose and configurable collator class. """ options = [ 'CAPS_FIRST', 'NUMERICAL', 'HYPHEN

Re: pexpect with apache

2006-10-18 Thread martdi
Since it wont require pyexpect, and based on the operations you accomplish with your python script, maybe that a bash script instead of a python one might be the best tool for the job you're trying to accomplish. martdi wrote: > Sudo is probably the best solution here, since in the file sudo.conf

Re: pexpect with apache

2006-10-18 Thread martdi
Sudo is probably the best solution here, since in the file sudo.conf you could restrict the www user only to the python script that requires it. Also, using either sudo or the setuid flag would remove the need of pexpect since all the commands will be run as the designated user. for setuid flag:

Re: Getting method name from within the class method

2006-10-18 Thread yellowalienbaby
> for f in $(ls) > do > sed -e "s/print self.a_method.__name__/print self.new_name.__name/g" > done thats a terrible bit of broken shell code, sorry ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting method name from within the class method

2006-10-18 Thread yellowalienbaby
Mitko Haralanov wrote: > On 18 Oct 2006 14:38:12 -0700 > [EMAIL PROTECTED] wrote: > > > >>> class test(object): > > ... def a_method(self,this,that): > > ... print self.a_method.__name__ > > Doing the above will obviously work! > > However, I don't want to have to use the name of the function i

Re: Reading a Microsoft access file.

2006-10-18 Thread John Purser
On Wed, 2006-10-18 at 10:39 -0400, [EMAIL PROTECTED] wrote: > I googled for the answer but all the answer seem to imply that you > have to have Access installed on your system. I have a file that was > created using Access and I want develop a Python script to > read the file and produce a report.

Re: Getting method name from within the class method

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 18:59, Mitko Haralanov wrote: > >>> class test(object): > ... def a_method(self,this,that): > ... print self.a_method.__name__ Doing the above will obviously work! However, I don't want to have to use the name of the function in the print statement (the ".a_method."

Re: Getting method name from within the class method

2006-10-18 Thread Mitko Haralanov
On 18 Oct 2006 14:38:12 -0700 [EMAIL PROTECTED] wrote: > >>> class test(object): > ... def a_method(self,this,that): > ... print self.a_method.__name__ Doing the above will obviously work! However, I don't want to have to use the name of the function in the print statement (the ".a_method."

Re: Getting method name from within the class method

2006-10-18 Thread Larry Bates
Mitko Haralanov wrote: > I need to be able to get the name of the currently executed method > within that method. I know that the method object does have the > __name__ attribute but I know know how to access it from withing the > method. > > Something like this: > > class A: > > def a_m

Re: Determining if a file is locked in Windows

2006-10-18 Thread Larry Bates
elake wrote: > I found this thread about a pst file in Windows being locked and I am > having the same issue. > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locked+files%27&rnum=1 > > The problem is that I have a scr

Re: pexpect with apache

2006-10-18 Thread Lee Harr
> Well, first i don't think it is a good idea to have the python script > tu su to root, but for it to work, i think (Totally unsure about that) > www has to be in group wheel to be able to su. Maybe sudo can help here. -- http://mail.python.org/mailman/listinfo/python-list

Re: right curly quote and unicode

2006-10-18 Thread Leo Kislov
On 10/17/06, TiNo <[EMAIL PROTECTED]> wrote: > Hi all, > > I am trying to compare my Itunes Library xml to the actual files on my > computer. > As the xml file is in UTF-8 encoding, I decided to do the comparison of the > filenames in that encoding. > It all works, except with one file. It is named

Re: Reading a Microsoft access file.

2006-10-18 Thread Karsten W.
You could access the file via the odbc interface. There is a module odbc which comes with the windows package, iirc. Regards, Karsten. [EMAIL PROTECTED] wrote: > I googled for the answer but all the answer seem to imply that you > have to have Access installed on your system. I have a file that w

Re: Classes and Functions - General Questions

2006-10-18 Thread Andreas Hartl
Setash schrieb: > 2) Function overloading - is it possible? > > Can I have the following code, or something which acts the same in > python?: > > > def function(a, b) >do things > > def function(a, b, c) >do things only if I get a third argument Several ways. The simplest and often mo

Re: Getting method name from within the class method

2006-10-18 Thread yellowalienbaby
Mitko Haralanov wrote: > I need to be able to get the name of the currently executed method > within that method. I know that the method object does have the > __name__ attribute but I know know how to access it from withing the > method. > > Something like this: > > class A: > > def a_me

bicycle repair man and idle

2006-10-18 Thread yellowalienbaby
Hi, I'm trying to get bicycle repair man to work with idle. I have installed repair man, and pasted the few entries needed into the config-extensions.def, but when i edit a module with idle i see no bicycle repair man menu. Am I missing anything else I should be doing? Thanks, Matt. -- http:/

Re: httplib and HTTPS Connections

2006-10-18 Thread runningwild
Heikki Toivonen wrote: > runningwild wrote: > > This is the first time I have cared about httplib's HTTPSConnection. > > Please note that the Python builtin SSL support is not really secure. It > does not make sure that you connect to the site you think you are > connecting to, for example. > > If

Re: Flexable Collating (feedback please)

2006-10-18 Thread Ron Adam
Thanks, But I fixed it already. (almost) ;-) I think I will use strings as you suggest, and verify they are valid so a type don't go though silently. I ended up using string based option list. I agree a space separated string is better and easier from a user point of view. The advantage of

callback cashing python

2006-10-18 Thread Bryan
hi, i have a multithreaded c server that calls process_method in a different c thread per each call. process_method calls a python function bar in module foo. function bar calls back into c. i've removed all the type error handling and simplified the code to hopefully show a minimum amount

Re: How to write Smart Python programs?

2006-10-18 Thread Magnus Lycka
Raj wrote: > Hi, > > We just executed a project with Python using TG. The feedback was to > use more python like programming rather than C style code executed in > Python. The feedback is from a Python purist and for some reasons we > cannot solicity his help. > > So we'd like to do is to scrub t

Re: creating many similar properties

2006-10-18 Thread Carl Banks
Michele Simionato wrote: > Carl Banks wrote: > > Come on, I don't think anyone's under the impression we're being > > indiscriminate here. > > Ok, but I don't think that in the case at hand we should recommend a > metaclass > solution. You sound as if you're avoiding metaclasses just for the sake

Re: Classes and Functions - General Questions

2006-10-18 Thread John Salerno
Setash wrote: > Also, I have seen the following syntax used once before, and havent > found any documentation on it, any comments as to use, where to find > docs, etc?: > > from module import x as name > name.function() All that does is give you a method for renaming a particularly unrul

Re: Classes and Functions - General Questions

2006-10-18 Thread Bruno Desthuilliers
Setash a écrit : > I've got a tiny bit of coding background, but its not the most > extensive. > > That said, I'm trying to wrap my head around python and have a couple > questions with classes and functions. > > Two notable questions: > > 1) Classes. How do you extend classes? > > I know its a

Re: Flexible Collating (feedback please)

2006-10-18 Thread Ron Adam
I made a number of changes ... (the new version is listed below) These changes also resulted in improving the speed by about 3 times when all flags are specified. Collating now takes about 1/3 (or less) time. Although it is still quite a bit slower than a bare list.sort(), that is to be exp

Re: Classes and Functions - General Questions

2006-10-18 Thread John Salerno
Setash wrote: > And have class2 inherit class1 without any import statements, or need > it be imported first? > Or need class1 and class2 be both declared in the same .py file if > there is inheritance? If the classes are in the same module, you don't need to do any importing or qualification. I

Getting method name from within the class method

2006-10-18 Thread Mitko Haralanov
I need to be able to get the name of the currently executed method within that method. I know that the method object does have the __name__ attribute but I know know how to access it from withing the method. Something like this: class A: def a_method (self, this, that): print <_

Re: Flexable Collating (feedback please)

2006-10-18 Thread bearophileHUGS
This part of code uses integer "constants" to be or-ed (or added): CAPS_FIRST = 1 NUMERICAL = 2 HYPHEN_AS_SPACE = 4 UNDERSCORE_AS_SPACE = 8 IGNORE_LEADING_WS = 16 COMMA_IN_NUMERALS = 32 ... def __init__(self, flag): self.flag = flag def transform(self, s): """ Transform a string for coll

Re: What happened to RuleDispatch

2006-10-18 Thread Adam Jones
exhuma.twn wrote: > Hi all, > > yesterday I wanted to install TurboGears, which depends on > RuleDispatch. However, I failed to download it. First I got the error > "Bad Gateway" from the server, today it's simply a "Not Found" error. > So what happened to it? Does somebody know? > > I would reall

Re: Flushing standard input

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 16:45, Fabian Steiner wrote: Recently I came across a problem which I still can't solve on my own. Consider this small example: import sys import time time.sleep(3) print sys.stdin.flush() input = raw_input('Your input: ') print 'Your input: ', input While the script i

Reading a Microsoft access file.

2006-10-18 Thread [EMAIL PROTECTED]
I googled for the answer but all the answer seem to imply that you have to have Access installed on your system. I have a file that was created using Access and I want develop a Python script to read the file and produce a report. Can this be done, if could you point me to some doc? Thanks. Wayne

Re: Classes and Functions - General Questions

2006-10-18 Thread Setash
> > > > And have class2 inherit class1 without any import statements, or need > > it be imported first? > > It needs to be imported first: > > class1.py: > > class Class1(object): > pass > > class2.py: > import class1 > > class Class2(class1.Class1): > pass > In respo

Re: pexpect with apache

2006-10-18 Thread martdi
Well, first i don't think it is a good idea to have the python script tu su to root, but for it to work, i think (Totally unsure about that) www has to be in group wheel to be able to su. An other way to make your script run as root is to set the setuid bit on your python script to make it run as

Re: Classes and Functions - General Questions

2006-10-18 Thread Sybren Stuvel
Setash enlightened us with: > 1) Classes. How do you extend classes? > > I know its as easy as: > > class classname(a) >do stuff > > > But where does the parent class need to lie? In the same file? Can > it lie in another .py file in the root directory? It doesn't matter at all, as long as 'a'

Re: Flushing standard input

2006-10-18 Thread elake
I found this. http://mail.python.org/pipermail/python-list/2006-September/359296.html You cannot flush input. The flush method only relates to output. The *other* side of the file has to flush *its* output in order for you to see it as input. -- http://mail.python.org/mailman/listinfo/python-l

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread Gabriel Genellina
At Wednesday 18/10/2006 11:26, abcd wrote: is there a way to make animated GIFs with python? vnc2swf is to much for what i was hoping. i have no problem with installing python packages, but having to use VNC is a bit much. A VNC server is about 400K in size... -- Gabriel Genellina Softlab

Flushing standard input

2006-10-18 Thread Fabian Steiner
Recently I came across a problem which I still can't solve on my own. Consider this small example: import sys import time time.sleep(3) print sys.stdin.flush() input = raw_input('Your input: ') print 'Your input: ', input While the script is sleeping I type in the word 'test1', so that it is pri

Re: unloading extension library

2006-10-18 Thread Fredrik Lundh
Bill Pursell wrote: del sys.modules["spam"] del spam > > Should remove all the references, but I still don't want to wait for > garbage collection. I need to be sure that the dlclose() happens > and the destructors are called. Can I do that? (without relying > on ctypes, preferrably.)

Classes and Functions - General Questions

2006-10-18 Thread Setash
I've got a tiny bit of coding background, but its not the most extensive. That said, I'm trying to wrap my head around python and have a couple questions with classes and functions. Two notable questions: 1) Classes. How do you extend classes? I know its as easy as: class classname(a) do st

Determining if a file is locked in Windows

2006-10-18 Thread elake
I found this thread about a pst file in Windows being locked and I am having the same issue. http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locked+files%27&rnum=1 The problem is that I have a script that can find the pst

Re: More Noob Questions

2006-10-18 Thread Diez B. Roggisch
Omar schrieb: > 1) I'm also learning to program flash movies while I learn to do > python. How can one implement flash movies into their python code? You can't - flash uses action script, a variant of ECMA script. There is a PyPy-javascript-backend available, but I guess that's a little bit bey

Re: unloading extension library

2006-10-18 Thread Bill Pursell
Bill Pursell wrote: > I've got a simple extension module that contains two functions: > void hi(void) __attribute__((constructor)); > void hi(void) { printf("Hi!\n");} > void bye(void) __attribute__((destructor)); > void bye(void) { printf("Bye!\n");} > > > When I run in the interpreter: > > >>> i

Re: Wax: problem subclassing TextBox

2006-10-18 Thread Hans Nowak
alex23 wrote: > Hey everyone, > > I've just started looking at Wax and have hit a problem I can't > explain. I want an app to respond to every character input into a > TextBox. > > Here's a simple, working example: > > +++ > from wax import * > > class MainFrame(VerticalFrame): > def Body(sel

unloading extension library

2006-10-18 Thread Bill Pursell
I've got a simple extension module that contains two functions: void hi(void) __attribute__((constructor)); void hi(void) { printf("Hi!\n");} void bye(void) __attribute__((destructor)); void bye(void) { printf("Bye!\n");} When I run in the interpreter: >>> import spam Hi! >>> del spam >>> Notic

Re: characters in python

2006-10-18 Thread Stens
Stens wrote: Can python handle this characters: ć,�,ž,đ,š? If can how" I wanna to change some characters in text (in the file) to the characters at this address: http://rapidshare.de/files/37244252/Untitled-1_copy.png.html -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a linux command by python?

2006-10-18 Thread Mark Elston
* [EMAIL PROTECTED] wrote (on 10/18/2006 11:32 AM): > Fredrik Lundh wrote: >> haishan chang wrote: >> >>> How to execute a linux command by python? >>> for example: execute "ls" or "useradd oracle" >>> Who can help me? >> start here: >> >> http://www.python.org/doc/lib/ >> >> > > After read

Re: tkinter won't play

2006-10-18 Thread hg
Carl Wenrich wrote: > I installed python 2.4.4 from source. When I try to > run the demo tkinter (hello.py) script, I get a > message saying my python may not be configured for Tk. Under *nix ? Make sure you have the tcl/tk source installed also. hg -- http://mail.python.org/mailman/listinfo/py

Re: How to execute a linux command by python?

2006-10-18 Thread venkatbo
Fredrik Lundh wrote: > haishan chang wrote: > > > How to execute a linux command by python? > > for example: execute "ls" or "useradd oracle" > > Who can help me? > > start here: > > http://www.python.org/doc/lib/ > > After reading the matl. pointed to by the many links listed here, you ca

Re: Win32 python and excel macros

2006-10-18 Thread John Coleman
Mike P wrote: > After just running trying that update it hits the macro perfectly but > hten i get an error message after i type in a couple of values.. as per > below > > Traceback (most recent call last): > File "", line 148, in ? > File ">", line 14, in Run > File "C:\Python24\Lib\site-pa

Re: How to execute a linux command by python?

2006-10-18 Thread Steven Bethard
Daniel Nogradi wrote: >> > How to execute a linux command by python? >> > for example: execute "ls" or "useradd oracle" >> > Who can help me? >> >> start here: >> >> http://www.python.org/doc/lib/ > > And continue here: > > http://www.python.org/doc/lib/os-process.html You probably should

  1   2   3   >