Re: Trivial string substitution/parser

2007-06-18 Thread Graham Breed
Samuel wote: Thanks, however, turns out my specification of the problem was incomplete: In addition, the variable names are not known at compilation time. I just did it that way, this looks fairly easy already: --- import re def variable_sub_cb(match):

Re: Memory problem with Python

2007-06-18 Thread [EMAIL PROTECTED]
On Jun 17, 8:51 pm, Squzer Crawler [EMAIL PROTECTED] wrote: i am developing distributed environment in my college using Python. I am using therads in client for downloading wepages. Even though i am reusing the thread, memory usage get increased. I don know why.? I am using BerkelyDB for

Re: Memory problem with Python

2007-06-18 Thread Squzer Crawler
On Jun 18, 11:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jun 17, 8:51 pm, Squzer Crawler [EMAIL PROTECTED] wrote: i am developing distributed environment in my college using Python. I am using therads in client for downloading wepages. Even though i am reusing the thread, memory

Re: MS Word parser

2007-06-18 Thread Josiah Carlson
[EMAIL PROTECTED] wrote: I'm currently using antiword to extract content from MS Word files. Is there another way to do this without relying on any command prompt application? There is also wvware http://wvware.sourceforge.net/, but it is also generally a command-line application. Either of

Re: The Modernization of Emacs

2007-06-18 Thread [EMAIL PROTECTED]
On 17 июн, 19:13, Xah Lee [EMAIL PROTECTED] wrote: In the following, i describe some critical changes that are also very easy to fix in emacs. If emacs officially adopt these changes, i think it will make a lot people, at least programers, like emacs and choose emacs as their text editor.

Re: Trivial string substitution/parser

2007-06-18 Thread Duncan Booth
Josiah Carlson [EMAIL PROTECTED] wrote: Samuel wrote: On Sun, 17 Jun 2007 11:00:58 +, Duncan Booth wrote: The elegant and lazy way would be to change your specification so that $ characters are escaped by $$ not by backslashes. Then you can write: from string import Template ...

Re: global destructor not called?

2007-06-18 Thread Duncan Booth
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: def __del__ (self): try: os.remove (self.name + '.old') except: pass And setting: sys.stderr = logger(...) It seems my cleanup (__del__) is never called, ... Mmm... If I read the

Re: Windows XMLRPC Service

2007-06-18 Thread Gabriel Genellina
En Mon, 18 Jun 2007 00:25:25 -0300, [EMAIL PROTECTED] escribió: I'm trying to serve up a simple XMLRPC server as a windows service. I got it to run properly, I'm just not sure how to stop it properly. Most of the documentation/examples I found for this was from forums, so I'd love some links

Re: Matrix Multiplication

2007-06-18 Thread Jeremy Sanders
sturlamolden wrote: Use numpy: www.scipy.org NumPy has a matrix type that overloads the * operator. Just a tiny followup, which may be important unless you carefully read the documentation. The * operator doesn't do matrix multiplication for normal numpy arrays - you do need to use its

Re: PyRun_String with Py_single_input to stdout?

2007-06-18 Thread Gabriel Genellina
En Mon, 18 Jun 2007 01:45:38 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: I'm using PyRun_String with Py_single_input for a python interpreter embedded in my application. I'm using Py_single_input. Py_single input is what I want, but it seems to output to stdout. Before when I was

Using a web service [newbie]

2007-06-18 Thread Alchemist
I am working with Python 2.5 and would like to use of a web service. What shall I install on my setup (or import in my Python script)? I read about Zolera Soap Infrastructure, which seems to be the preferred Python web service framework (http:// pywebsvcs.sourceforge.net/). However, its

Re: The Modernization of Emacs

2007-06-18 Thread [EMAIL PROTECTED]
* Reduce the use of the word buffer in the emacs documentation. Call it opened file or unsaved document. As far as I understand the concept of buffer is much much wider than of unsaved document or file. Should we call dired buffer as unsaved document? It is much wider, which is why

Re: using Mac OS X CoreGraphics via ctypes

2007-06-18 Thread Diez B. Roggisch
Daniel wrote: # the next line causes a segfault - what's the right way to do this? #GCS_RGB = cglib.kCGColorSpaceGenericRGB() Usually, things in the OSX lib that start with k* are a constant - not a function. As is this. Diez That's what I thought too. But when I try passing it

Re: xmlrpclib hangs execution

2007-06-18 Thread itkovian
I think a better fix than the one I posted below is using the HTTPConnection library, as opposed to the HTTP library from httplib. A patch can be found below: --- /sw/lib/python2.5/xmlrpclib.py 2006-11-29 02:46:38.0 +0100 +++ xmlrpclib.py2007-06-15 16:03:17.0 +0200

Re: Do U have anything to share with this students

2007-06-18 Thread Stephen Cowell
Josh Hill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 16 Jun 2007 13:06:23 -, Milt [EMAIL PROTECTED] wrote: On Jun 15, 1:00?pm, [EMAIL PROTECTED] wrote: This is a network of students. Find the people of your kind there http://tinyurl.com/33uvla Click and

Re: a_list.count(a_callable) ?

2007-06-18 Thread Antoon Pardon
On 2007-06-15, Ping [EMAIL PROTECTED] wrote: sum(1 for i in a_list if a_callable(i)) -- Carsten Haesehttp://informixdb.sourceforge.net This works nicely but not very intuitive or readable to me. First of all, the generator expression makes sense only to trained eyes. Secondly, using

Re: Using a web service [newbie]

2007-06-18 Thread Stevo
On Jun 18, 7:55 pm, Alchemist [EMAIL PROTECTED] wrote: I am working with Python 2.5 and would like to use of a web service. What shall I install on my setup (or import in my Python script)? I read about Zolera Soap Infrastructure, which seems to be the preferred Python web service framework

XMLRPC and SSL

2007-06-18 Thread Chaz Ginger
I have a web service that I built and it requires using SSL. I have found a few examples of clients using SSL but none that allow me to change the client's certificate or the chain of certificates the client will use to authenticate the server. I was wondering if anyone knows of a good example

fetching text from the screen

2007-06-18 Thread Juergen Kareta
Hello list, I'm thinking about a python script which fetch some text from the screen independent of what application provides the text on the screen. In this regard it should be similar to the babylon software: www.babylon.com Here my thoughts: 1) getting the mouse position 2) calculate a

Re: labeled break/continue

2007-06-18 Thread faulkner
On Jun 18, 12:35 am, Matt Chisholm [EMAIL PROTECTED] wrote: Hi. I was wondering if there had ever been an official decision on the idea of adding labeled break and continue functionality to Python. I've found a few places where the idea has come up, in the context of named code blocks:

Re: Matrix Multiplication

2007-06-18 Thread Will McGugan
[EMAIL PROTECTED] wrote: Hi, Is there any direct function for matrix multiplication in Python or any of its packages? or do we have to multiply element by element? If you want a pure Python module for 4x4 matrices, then you may want to look at Game Objects

Re: using Mac OS X CoreGraphics via ctypes

2007-06-18 Thread Daniel
On Jun 18, 6:07 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: Daniel wrote: # the next line causes a segfault - what's the right way to do this? #GCS_RGB = cglib.kCGColorSpaceGenericRGB() Usually, things in the OSX lib that start with k* are a constant - not a function. As is this.

Re: smtp server simulation using Python

2007-06-18 Thread Tim Williams
On 17/06/07, William Gill [EMAIL PROTECTED] wrote: I have a (web) development computer w/o an SMTP server and want to test form generated e-mail using a dummy SMTP server that delivers the mail message to a file, or better yet, to a text editor instead of actually sending it. Is it possible

Having lots of fun passing parameters ... help!

2007-06-18 Thread DAC
I've defined a single method in Python using: def funcAdjacents(inputWord, outputFile): ... lots of boring stuff ... and then called it using: funcAdjacents(SampleWord,outputFile.file) Which works OK in Python - I get the results I want. But what I'm trying to do is get inputWord

Re: Having lots of fun passing parameters ... help!

2007-06-18 Thread Diez B. Roggisch
DAC wrote: I've defined a single method in Python using: def funcAdjacents(inputWord, outputFile): ... lots of boring stuff ... and then called it using: funcAdjacents(SampleWord,outputFile.file) Which works OK in Python - I get the results I want. But what I'm trying

Binary code

2007-06-18 Thread getgroup
Can python maky a binary code for exemple .hex for microcontrolor. tks -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Rob Wolfe
[EMAIL PROTECTED] wrote: So, I'm writing this to have your opinion on what tools I should use to do this and what technique I should use. Take a look at parsing example on this page: http://wiki.python.org/moin/SimplePrograms -- HTH, Rob --

Re: Having lots of fun passing parameters ... help!

2007-06-18 Thread DAC
On 18 Jun, 14:57, Diez B. Roggisch [EMAIL PROTECTED] wrote: DAC wrote: I've defined a single method in Python using: def funcAdjacents(inputWord, outputFile): ... lots of boring stuff ... and then called it using: funcAdjacents(SampleWord,outputFile.file) Which works

Discover As Beginning Successful Business In Internet.

2007-06-18 Thread pacovegavilla
Discover As Beginning Successful Business In Internet. If you believed that to begin business in internet single era for experts This very mistaken one! Discover our system proven to begin business in Internet. Entering RIGHT NOW http://www.freedom.ws/pacovegavilla Alone to visit our place

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: I work at this company and we are re-building our website: http://caslt.org/. The new website will be built by an external firm (I could do it myself, but since I'm just the summer student worker...). Anyways, to help them, they first asked me to copy all the text from

Re: The Modernization of Emacs

2007-06-18 Thread Joel J. Adamson
Xah Lee [EMAIL PROTECTED] writes: SIMPLE CHANGES In the following, i describe some critical changes that are also very easy to fix in emacs. If emacs officially adopt these changes, i think it will make a lot people, at least programers, like emacs

Re: Binary code

2007-06-18 Thread Grant Edwards
On 2007-06-18, getgroup [EMAIL PROTECTED] wrote: Can python maky a binary code for exemple .hex for microcontrolor. Are you asking if a Python program can be compiled into a binary executable which is to run on a microcontroller? The answer to that is no. Are you asking if a Python program can

copy locked files

2007-06-18 Thread rubbishemail
Hello, do you know of any way to copy locked / opened files under win xp? I know there is something like Volume Shadow Copy but I don't know how to use it. Maybe someone already has a python solution? Many thanks Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's only one way to do it philosophy isn't good?

2007-06-18 Thread Magnus Lycka
Alex Martelli wrote: PL/1 is basically gone, but its legacy of take what you need and leave the rest is unfortunately alive in other languages that are blind to the enormous advantages of simplicity and uniformity. Reminds me of RUP... No wonder Ivar Jacobson gave up and started all over. --

Re: sqlite3 bug??

2007-06-18 Thread Hyuga
On Jun 17, 9:16 am, mark carter [EMAIL PROTECTED] wrote: Should I also explicitly close the cursor and connection, or is that taken care of automagically? Somebody correct me if I'm wrong, but I'm pretty sure that the Cursor and Connection objects properly clean themselves up when deallocated

Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread sebzzz
Hi, I work at this company and we are re-building our website: http://caslt.org/. The new website will be built by an external firm (I could do it myself, but since I'm just the summer student worker...). Anyways, to help them, they first asked me to copy all the text from all the pages of the

Re: sqlite3 bug??

2007-06-18 Thread Hyuga
On Jun 18, 11:01 am, Hyuga [EMAIL PROTECTED] wrote: In fact, I have code in which references to a db connection are passed around, so I have to be careful about explicitly closing the connection, lest it be in use by some other method somewhere. Hate to reply to myself, but I should clarify

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Neil Cerutti
On 2007-06-18, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I work at this company and we are re-building our website: http://caslt.org/. The new website will be built by an external firm (I could do it myself, but since I'm just the summer student worker...). Anyways, to help them, they first

Re: Do U have anything to share with this students

2007-06-18 Thread John Ashby
Josh Hill wrote: On Sat, 16 Jun 2007 13:06:23 -, Milt [EMAIL PROTECTED] wrote: On Jun 15, 1:00?pm, [EMAIL PROTECTED] wrote: This is a network of students. Find the people of your kind there http://tinyurl.com/33uvla Click and register to access millions of students. Your link

Re: smtp server simulation using Python

2007-06-18 Thread Dave Borne
I have a (web) development computer w/o an SMTP server and want to test form generated e-mail using a dummy SMTP server that delivers the mail message to a file, or better yet, to a text editor instead of actually sending it. Here's a quick and dirty script I use this for email testing

Re: PyRun_String with Py_single_input to stdout?

2007-06-18 Thread [EMAIL PROTECTED]
I found a solution using sys.displayhook here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/593cd28e568c32e1/1e0f930e7ac5ebb2?#1e0f930e7ac5ebb2 On Jun 18, 4:24 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Mon, 18 Jun 2007 01:45:38 -0300, [EMAIL PROTECTED] [EMAIL

Re: Custom wxPython Widget

2007-06-18 Thread kyosohma
On Jun 15, 10:24 pm, Jens Thiede [EMAIL PROTECTED] wrote: What is the best source code to read? Any tips; suggestions? Thanks in advance Jens Thiede I would recommend reading the wxPython demo source code. Also, this website has some custom widgets written in pure wxPython, some of which are

getting the size of an object

2007-06-18 Thread filox
is there a way to find out the size of an object in Python? e.g., how could i get the size of a list or a tuple? -- You're never too young to have a Vietnam flashback -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-18 Thread Robin Becker
Joel J. Adamson wrote: people aware of it; as soon as I became aware of Emacs (from reading Wikipedia, ironically), I began using it and I knew I was stuck with it. It's not even important for the survival of Emacs that it be more many others get stuck with a preferred editor/system/language;

Re: getting the size of an object

2007-06-18 Thread Brett Hoerner
On Jun 18, 11:07 am, filox [EMAIL PROTECTED] wrote: is there a way to find out the size of an object in Python? e.g., how could i get the size of a list or a tuple? Size can mean a lot of things, len(my_list) len(my_tuple) Although I have the feeling you mean how many bytes does this object

Re: Matrix Multiplication

2007-06-18 Thread sturlamolden
On Jun 18, 11:20 am, Jeremy Sanders jeremy [EMAIL PROTECTED] wrote: NumPy has a matrix type that overloads the * operator. Just a tiny followup, which may be important unless you carefully read the documentation. The * operator doesn't do matrix multiplication for normal numpy arrays

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Jay Loden
Neil Cerutti wrote: You could get good results, and save yourself some effort, using links or lynx with the command line options to dump page text to a file. Python would still be needed to automate calling links or lynx on all your documents. OP was looking for a way to parse out part of

RE: copy locked files

2007-06-18 Thread Adam Pletcher
Do you mean files marked in-use by the OS, like DLLs used by an open application? There shouldn't be anything preventing you from copying in-use files, or even read-only files if that's what you meant: import shutil shutil.copy('C:\\my_application\\test.dll', 'C:\\new_folder\\test.dll')

suggestion: recursive collections.defaultdict

2007-06-18 Thread [EMAIL PROTECTED]
It seems like x = defaultdict(defaultdict(list)) should do the obvious, but it doesn't. This seems to work y = defaultdict(lambda: defaultdict(list)) though is a bit uglier. -- http://mail.python.org/mailman/listinfo/python-list

avoid script running twice

2007-06-18 Thread Robin Becker
I wish to prevent a python script from running twice; it's an hourly job, but can take too long. My simplistic script looks like ... def main(): fn = 'MARKER' if os.path.isfile(fn): log('%s: hourly job running already' % formatTime()) else: f = open(fn,'w')

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
Jay Loden wrote: Someone else mentioned lxml but as I understand it lxml will only work if it's valid XHTML that they're working with. No, it was meant as the OP requested. It even has a very good parser from broken HTML. http://codespeak.net/lxml/dev/parsing.html#parsing-html Stefan --

Re: copy locked files

2007-06-18 Thread rubbishemail
Hi Adam, On 18 Jun., 18:41, Adam Pletcher [EMAIL PROTECTED] wrote: Do you mean files marked in-use by the OS, like DLLs used by an open application? I dont know the exact name, but some programs totally lock the files, like Visual Studio shutil.copy('C:\\a\\test\\test.ncb','C:\\b\test.ncb')

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
On 6/18/07, Robin Becker [EMAIL PROTECTED] wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. My simplistic script looks like ... def main(): fn = 'MARKER' if os.path.isfile(fn): log('%s: hourly job running

Re: avoid script running twice

2007-06-18 Thread Wildemar Wildenburger
Robin Becker wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. [snip] but it occurs to me that I might be killed with prejudice during the long running work(). Is there a smart way to avoid running simultaneously. Well I can think

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Evan Klitzke [EMAIL PROTECTED] wrote: On 6/18/07, Robin Becker [EMAIL PROTECTED] wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. My simplistic script looks like ... def main(): fn = 'MARKER'

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Jay Loden
Stefan Behnel wrote: Jay Loden wrote: Someone else mentioned lxml but as I understand it lxml will only work if it's valid XHTML that they're working with. No, it was meant as the OP requested. It even has a very good parser from broken HTML.

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Jay Loden
Stefan Behnel wrote: Jay Loden wrote: Someone else mentioned lxml but as I understand it lxml will only work if it's valid XHTML that they're working with. No, it was meant as the OP requested. It even has a very good parser from broken HTML.

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Robin Becker wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. [snip] but it occurs to me that I might be killed with prejudice during the long running work(). Is there

A patch to support L.count(value, cmp=None, key=None)

2007-06-18 Thread Ping
Hi, I patched Objects/listobject.c to support L.count(value, cmp=None, key=None). I tested it with the same script above by replacing slist with built-in list. It worked correctly with this small test. The patch is below (126 lines, I hope that's not too big to be pasted here). This is the

IPV6 Fatal Error

2007-06-18 Thread Tim Graber
Hello. I am trying to install version 2.5.1 for the first time on our Solaris 10 server (64 bit). When I execute #./config as root user, I get the following error: checking gettaddrinfo bug... buggy Fatal: You must get wroking getaddrinfo() function. or you can specify

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
On 6/18/07, Tim Williams [EMAIL PROTECTED] wrote: On 18/06/07, Evan Klitzke [EMAIL PROTECTED] wrote: On 6/18/07, Robin Becker [EMAIL PROTECTED] wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. My simplistic script looks like

Re: copy locked files

2007-06-18 Thread Jay Loden
Adam Pletcher wrote: Do you mean files marked in-use by the OS, like DLLs used by an open application? There shouldn't be anything preventing you from copying in-use files, or even read-only files if that's what you meant: import shutil shutil.copy('C:\\my_application\\test.dll',

Re: avoid script running twice

2007-06-18 Thread Robin Becker
Evan Klitzke wrote: Another method that you can use is to open up a socket on some predetermined port (presumably above 1024), and then have your program try to connect to that port and talk to the other program to determine whether or not to run (or whether to do some of the

Re: Thunderbird access to this newsgroup

2007-06-18 Thread Steve Holden
Ben Finney wrote: Rostfrei [EMAIL PROTECTED] writes: What is the news server for this newsgroup. Usenet newsgroups are redistributed over many servers worldwide. URL:http://en.wikipedia.org/wiki/Usenet If I ping comp.lang.python it is not resolved. That's right. It's the name

Line Wrapping

2007-06-18 Thread Evan Klitzke
All, Mail messages should be wrapped at 78 characters (as suggested in RFC 2822). I want my python batch scripts/cron jobs to enforce this behavior, and format the mail that is sent out so that newline characters are inserted as appropriate to keep line lengths at 78 characters or less. I wrote a

csv search and print

2007-06-18 Thread axjacob
I have a csv file containing lot of rows columns. I wanted to search thru the heading for each column for a string and then print all the headings and the corresponding rows if a match is found. Any advise? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-18 Thread Hal Vaughan
Joel J. Adamson wrote: Xah Lee [EMAIL PROTECTED] writes: SIMPLE CHANGES In the following, i describe some critical changes that are also very easy to fix in emacs. If emacs officially adopt these changes, i think it will make a lot people, at

Re: avoid script running twice

2007-06-18 Thread Robin Becker
Wildemar Wildenburger wrote: Robin Becker wrote: Well I can think of a dumb way: create a temporary file during the transaction and have your script check for that before running its main body. I think thats the most hassle free way of doing it. /W I looked at the temporary

Re: Line Wrapping

2007-06-18 Thread TeroV
Evan Klitzke wrote: All, Mail messages should be wrapped at 78 characters (as suggested in RFC 2822). I want my python batch scripts/cron jobs to enforce this behavior, and format the mail that is sent out so that newline characters are inserted as appropriate to keep line lengths at 78

Re: Line Wrapping

2007-06-18 Thread Evan Klitzke
On 6/18/07, TeroV [EMAIL PROTECTED] wrote: Evan Klitzke wrote: All, Mail messages should be wrapped at 78 characters (as suggested in RFC 2822). I want my python batch scripts/cron jobs to enforce this behavior, and format the mail that is sent out so that newline characters are

BeautifulSoup - extract the object tag

2007-06-18 Thread gcmartijn
I'm trying to extract something like this: object classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=7,0,19,0 width=640 height=400 param name=movie value=url param name=quality value=highparam name=SCALE

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread sebzzz
I see there is a couple of tools I could use, and I also heard of sgmllib and htmllib. So now there is lxml, Beautiful soup, sgmllib, htmllib ... Is there any of those tools that does the job I need to do more easily and what should I use? Maybe a combination of those tools, which one is better

Re: BeautifulSoup - extract the object tag

2007-06-18 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], gcmartijn wrote: I'm trying to extract something like this: object classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=7,0,19,0 width=640 height=400 param name=movie value=url param

Re: avoid script running twice

2007-06-18 Thread Evan Klitzke
On 6/18/07, Robin Becker [EMAIL PROTECTED] wrote: Evan Klitzke wrote: Another method that you can use is to open up a socket on some predetermined port (presumably above 1024), and then have your program try to connect to that port and talk to the other program to determine

Re: suggestion: recursive collections.defaultdict

2007-06-18 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: It seems like x = defaultdict(defaultdict(list)) should do the obvious, but it doesn't. It *does* the obvious. Parenthesis after a name means: call this object *now*. Any other behavior wouldn't be obvious. Ciao, Marc

Re: How to get existing frames in non-current thread?

2007-06-18 Thread Fabio Zadrozny
Thanks a lot... I guess I'll have to find another way for versions before 2.5 ;-) The original idea came from http://www.majid.info/mylos/stories/2004/06/10/threadframe.html but it uses a compiled C extension, yes. The code is really small and you should not have problems compiling it...

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: I see there is a couple of tools I could use, and I also heard of sgmllib and htmllib. So now there is lxml, Beautiful soup, sgmllib, htmllib ... Is there any of those tools that does the job I need to do more easily and what should I use? Maybe a combination of

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Robin Becker [EMAIL PROTECTED] wrote: Wildemar Wildenburger wrote: Robin Becker wrote: . Well I can think of a dumb way: create a temporary file during the transaction and have your script check for that before running its main body. I think thats the most

Re: avoid script running twice

2007-06-18 Thread Jay Loden
Robin Becker wrote: I wish to prevent a python script from running twice; it's an hourly job, but can take too long. My simplistic script looks like ... def main(): fn = 'MARKER' if os.path.isfile(fn): log('%s: hourly job running already' % formatTime())

Re: A patch to support L.count(value, cmp=None, key=None)

2007-06-18 Thread BJörn Lindqvist
I patched Objects/listobject.c to support L.count(value, cmp=None, key=None). I tested it with the same script above by replacing slist with built-in list. It worked correctly with this small test. The patch is below (126 lines, I hope that's not Great! If you want this change included

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
Tim Williams [EMAIL PROTECTED] wrote: You can also do this by holding a file open in write mode until the script has finished. try: open('lock.txt','w') my_script() except: #print script is already running That only works under windows

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
Robin Becker [EMAIL PROTECTED] wrote: I looked at the temporary files idea, but I'm not certain about the exact details. Normally your create a file and then remove it whilst keeping the file handle; that allows your program to write to it whilst guaranteeing that it will vanish

HTMLParser.HTMLParseError: EOF in middle of construct

2007-06-18 Thread Sergio Monteiro Basto
Hi, Can someone explain me, what is wrong with this site ? python linkExtractor3.py http://www.noticiasdeaveiro.pt test HTMLParser.HTMLParseError: EOF in middle of construct, at line 1173, column 1 at line 1173 of test file is perfectly normal . I like to know what I have to clean up before

Re: Memory problem with Python

2007-06-18 Thread Josiah Carlson
Squzer Crawler wrote: On Jun 18, 11:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jun 17, 8:51 pm, Squzer Crawler [EMAIL PROTECTED] wrote: i am developing distributed environment in my college using Python. I am using therads in client for downloading wepages. Even though i am reusing

Re: Python's only one way to do it philosophy isn't good?

2007-06-18 Thread Douglas Alan
Terry Reedy [EMAIL PROTECTED] writes: |oug writes: Scheme has a powerful syntax extension mechanism I did not and do not see this as relevant to the main points of my summary above. Python has powerful extension mechanisms too, but comparing the two languages on this basis is a whole

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Nick Craig-Wood [EMAIL PROTECTED] wrote: Tim Williams [EMAIL PROTECTED] wrote: You can also do this by holding a file open in write mode until the script has finished. try: open('lock.txt','w') my_script() except:

Re: getting the size of an object

2007-06-18 Thread filox
Brett Hoerner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jun 18, 11:07 am, filox [EMAIL PROTECTED] wrote: is there a way to find out the size of an object in Python? e.g., how could i get the size of a list or a tuple? Size can mean a lot of things, len(my_list)

Re: csv search and print

2007-06-18 Thread John Machin
On Jun 19, 4:12 am, [EMAIL PROTECTED] wrote: I have a csv file containing lot of rows columns. I wanted to search thru the heading for each column for a string and then print all the headings and the corresponding rows if a match is found. Any advise? 1. Clarify your requirements:

Making static dicts?

2007-06-18 Thread Ognjen Bezanov
Hello! Just to ask, is it possible to make a static dictionary in python. So that the keys in the dictionary cannot be removed, changed or new ones added, but the value pairs can. Is this possible with python? thanks, Ognjen. -- http://mail.python.org/mailman/listinfo/python-list

Re: csv search and print

2007-06-18 Thread Sergio Monteiro Basto
On Mon, 2007-06-18 at 13:11 -0700, John Machin wrote: On Jun 19, 4:12 am, [EMAIL PROTECTED] wrote: I have a csv file containing lot of rows columns. I wanted to search thru the heading for each column for a string and then print all the headings and the corresponding rows if a match is

Re: avoid script running twice

2007-06-18 Thread David Wahler
On 6/18/07, Robin Becker [EMAIL PROTECTED] wrote: Evan Klitzke wrote: Another method that you can use is to open up a socket on some predetermined port (presumably above 1024), and then have your program try to connect to that port and talk to the other program to determine whether or not

Re: avoid script running twice

2007-06-18 Thread Jeff McNeil
I've got a rather large log processing job here that has the same requirement. I process and sort Apache logs from an 8-way cluster. I sort and calculate statistics in 15-minute batch jobs. Only one copy should run at once. I open a file and lock it via something like this: import fcntl

Re: avoid script running twice

2007-06-18 Thread Jeff McNeil
Note that in real life, the script exits cleanly if another copy is running... On 6/18/07, Jeff McNeil [EMAIL PROTECTED] wrote: I've got a rather large log processing job here that has the same requirement. I process and sort Apache logs from an 8-way cluster. I sort and calculate statistics

Re: passing arguments to tcpserver classes

2007-06-18 Thread Eric Spaulding
Great -- thanks! (and also to J. Ezequiel). Mark T wrote: Eric Spaulding [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally -- srvr =SocketServer.TCPServer(('',port_num),

Re: XMLRPC and SSL

2007-06-18 Thread Martin v. Löwis
Chaz Ginger schrieb: I have a web service that I built and it requires using SSL. I have found a few examples of clients using SSL but none that allow me to change the client's certificate or the chain of certificates the client will use to authenticate the server. I was wondering if anyone

Re: using Mac OS X CoreGraphics via ctypes

2007-06-18 Thread Richard Jones
Daniel wrote: Thanks Diez. I'll try that if I decide to keep going with ctypes. I got a bit further but had some problems with memory management (i.e. retaining and releasing object references). It seemed like Python/ ctypes was accessing referenced objects after I had released them, which

Re: getting the size of an object

2007-06-18 Thread Brett Hoerner
On Jun 18, 2:48 pm, filox [EMAIL PROTECTED] wrote: is there a long answer? what i want is to find out the number of bytes the object takes up in memory (during runtime). since python has a lot of introspection mechanisms i thought that should be no problem... There isn't an automatic way

Re: A patch to support L.count(value, cmp=None, key=None)

2007-06-18 Thread John Machin
On Jun 19, 5:17 am, BJörn Lindqvist [EMAIL PROTECTED] wrote: persons.count(olle, key = attergetter(name)) is longer and just barely more readable than sum(1 for x in persons if x.name == olle)) The OP's proposal seems to have a very narrow focus, whereas the generator approach can

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
Jeff McNeil [EMAIL PROTECTED] wrote: I've got a rather large log processing job here that has the same requirement. I process and sort Apache logs from an 8-way cluster. I sort and calculate statistics in 15-minute batch jobs. Only one copy should run at once. I open a file and lock

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
Tim Williams [EMAIL PROTECTED] wrote: On 18/06/07, Nick Craig-Wood [EMAIL PROTECTED] wrote: On Windows the open-a-file-for-writing method works well, but as *nix doesn't work the same way then maybe the socket solution is the best cross-platform option. Actually you could combine your

  1   2   >