Re: Problems with file IO in a thread, and shutil

2008-06-26 Thread Roopesh
Thanks for the reply. I did testing in a clean system, were anti virus/ spyware is not installed. It still gave this problem, in say 1 out of 1000 cases. By any chance would it be possible that the Windows OS has not completed writing to the file even after file.flush() and file.close() is called?

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
But Python C-API[1] it's the main base for extent python with C/c++, and this is not not threadsafe.? I dont understand [1] http://docs.python.org/api/api.html On Thu, Jun 26, 2008 at 4:49 AM, Benjamin <[EMAIL PROTECTED]> wrote: > On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > >

Re: Accounting and financial system

2008-06-26 Thread Marcelo de Moraes Serpa
Btw, sorry it is [OT], I forgot to add the prefix, it is really not a post tied to the language itself. On Tue, Jun 24, 2008 at 1:24 PM, Marcelo de Moraes Serpa < [EMAIL PROTECTED]> wrote: > Hello list, > > In a next project of mine, I will need to implement some accounting and > financial contro

Accounting and financial system

2008-06-26 Thread Marcelo de Moraes Serpa
Hello list, In a next project of mine, I will need to implement some accounting and financial control. It is not a full ERP, only the basic functions for finances and accounting control. However, I have little to no experience in this business domain (accounting and finances) but I really do need

urllib tutorial or manual

2008-06-26 Thread Alex Bryan
I have never used the urllib class and I need to use it for an app I am working on. I am wondering if anyone has any good sites that will fill me in on it(especially the urllib.urlopen module). Or better yet, an example of how you would submit a search term into the search field on a site,

Question on time module

2008-06-26 Thread subhabrata . iisc
Dear Members of the group, I have one function def sum1(n): a1=5 a2=6 a3=a1+a2 a4=a3+8 print "The First sum is" print a3 print "The Second sum is" print a4 Now, I want to do it in a way, a4 is calculated after a given time interval of a3 -this is eas

Re: urllib tutorial or manual

2008-06-26 Thread Simon Brunning
2008/6/24 Alex Bryan <[EMAIL PROTECTED]>: > I have never used the urllib class and I need to use it for an app I am > working on. I am wondering if anyone has any good sites that will fill me in > on it(especially the urllib.urlopen module). Or better yet, an example of > how you would submit a sea

Re: Newbie question about tuples and list comprehensions

2008-06-26 Thread Peter Otten
idiolect wrote: > On Jun 25, 7:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: >> idiolect wrote: >> > Hi all - Sorry to plague you with another newbie question from a >> > lurker. Hopefully, this will be simple. >> >> > I have a list full of RGB pixel values read from an image. I want to >> > tes

Re: Freeze problem with Regular Expression

2008-06-26 Thread John Machin
On Jun 26, 8:29 am, John Machin <[EMAIL PROTECTED]> wrote: > (2) ALWAYS use a raw string for regexes; your \s* will match on lower- > case 's', not on spaces and should have written: (2) ALWAYS use a raw string for regexes. <<<=== Big fat full stop aka period. but he was at the time only half-wa

python for driving the sound card

2008-06-26 Thread Rustom Mody
I am exploring the use of python to drive the sound card to experiment with tunings. How easy is it to write (or is it already available) to write a function chord which takes a (list of) frequencies and plays them? -- http://mail.python.org/mailman/listinfo/python-list

Re: recursion in Class-methods?

2008-06-26 Thread Bruno Desthuilliers
klant a écrit : do i need to call Graph.find_path? > g = Graph({'A': ['B', 'C'], 'B': ['C', 'D'], 'C': ['D'], 'D': ['C'], 'E': ['F'], 'F': ['C']}) g <__main__.Graph instance at 0x01D74378> g.find_all_paths('A', 'C') Traceb

Re: struct.pack behavior

2008-06-26 Thread John Machin
On Jun 26, 12:38 pm, "Steven Clark" <[EMAIL PROTECTED]> wrote: > On Wed, Jun 25, 2008 at 7:03 PM, John Machin <[EMAIL PROTECTED]> wrote: > > On Jun 26, 9:00 am, "Steven Clark" <[EMAIL PROTECTED]> wrote: > >> Can anyone explain to me why > >> struct.pack('HB',1,2) gives 3 bytes, whereas struct.pack(

Komodo Edit newbie Q

2008-06-26 Thread John Dann
I'm learning Python using the Komodo Edit freeware code editor. One thing I'm finding a little confusing is that the code completion lists (what I would call Intellisense coming from a .Net background) are often very incomplete, especially with imported classes like wx. It's like KE can't look far

Looping-related Memory Leak

2008-06-26 Thread Tom Davis
I am having a problem where a long-running function will cause a memory leak / balloon for reasons I cannot figure out. Essentially, I loop through a directory of pickled files, load them, and run some other functions on them. In every case, each function uses only local variables and I even made

Re: Working with the Windows Registry

2008-06-26 Thread teh_sAbEr
Great! It works properly now but I have one more question, would anyone know how to get the changes to take effect immediately? Like some sort of Python way to force the desktop to reload? AFAIK the only way that'll happen is if I use the Display Properties dialog box. The Registry value is changed

Re: Looping-related Memory Leak

2008-06-26 Thread Carl Banks
On Jun 26, 5:19 am, Tom Davis <[EMAIL PROTECTED]> wrote: > I am having a problem where a long-running function will cause a > memory leak / balloon for reasons I cannot figure out. Essentially, I > loop through a directory of pickled files, load them, and run some > other functions on them. In ev

Re: Mobile Devices

2008-06-26 Thread rodmc
Thanks for your reply, I may dig out my really old Symbian phone and try it out. rod -- http://mail.python.org/mailman/listinfo/python-list

Re: Looping-related Memory Leak

2008-06-26 Thread Peter Otten
Tom Davis wrote: > I am having a problem where a long-running function will cause a > memory leak / balloon for reasons I cannot figure out. Essentially, I > loop through a directory of pickled files, load them, and run some > other functions on them. In every case, each function uses only local

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Matthieu Brucher
Hi, The C-API uses references counts as well, so it is not threadsafe. Matthieu 2008/6/26 Pau Freixes <[EMAIL PROTECTED]>: > But Python C-API[1] it's the main base for extent python with C/c++, and > this is not not threadsafe.? I dont understand > > [1] http://docs.python.org/api/api.html > > O

Re: poplib - retr() getting stuck

2008-06-26 Thread Roopesh
Thanks for the help. At present I have modified the poplib code as follows (In POP3 and POP3_SSL classes): Is it the correct way? def __init__(self, host, port = POP3_PORT): self.host = host self.port = port msg = "getaddrinfo returns an empty list" self.sock =

Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread ShashiGowda
Hey there i made a script to download all images from a web site but it runs damn slow though I have a lot of bandwidth waiting to be used please tell me a way to use urllib to open many connections to the server to download many pics simultaneously Any off question suggestions are also ok... -

instructions on adding external Tcl/Tk widget into Tkinter?

2008-06-26 Thread oyster
It is so funny that the official GUI lib for python is Tkinter, but I cannot find an articles which explains indetail how can we use thounsands of Tcl/Tk widget in Tkinter. For example, I have download the dll at http://www.hwaci.com/sw/tkhtml/index.html, renamed it to tkhtml12.dll and put it in

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Pau Freixes
Hi Ok, if I understand between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS is not possible use a C/Python api functions ? Sorry, but when thread enter another time with Py_END_ALLOW_THREADS this thread enter to competition to lock GIL ? Thks Thks On Thu, Jun 26, 2008 at 12:16 PM, Matthieu

Re: Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread Gerhard Häring
ShashiGowda wrote: Hey there i made a script to download all images from a web site but it runs damn slow though I have a lot of bandwidth waiting to be used please tell me a way to use urllib to open many connections to the server to download many pics simultaneously Any off question suggest

extend getattr()

2008-06-26 Thread Rotlaus
Hello, lets assume i have some classes: class A(object): def __init__(self): b = B() class B(object): def __init__(self): c = C() class C(object): def __init__(self): pass and now i wanna do something like this: a=A() c=getattr(a, 'b.c') I know this doesn'

Re: extend getattr()

2008-06-26 Thread Gerhard Häring
Rotlaus wrote: Hello, lets assume i have some classes: [...] a=A() c=getattr(a, 'b.c') I know this doesn't work, but what can i do to get this or a similar functionality to get it work for this sample and for even more nested classes? Just recursively apply the getattr(), like this: class A

Re: Threads, GIL and re.match() performance

2008-06-26 Thread Jeff
> However, I assumed that calls to (thread safe) C Library functions > release the global interpreter lock. This is mainly applicable to external C libraries. The interface to them may not be thread-safe; anything that uses the Python API to create/manage Python objects will require use of the GI

Re: extend getattr()

2008-06-26 Thread Cédric Lucantis
Le Thursday 26 June 2008 13:06:53 Rotlaus, vous avez écrit : > Hello, > > lets assume i have some classes: > > class A(object): > def __init__(self): > b = B() > > class B(object): > def __init__(self): > c = C() > note you're just defining some local variables here, should

Re: the problem about the DLL file generate by py2exe

2008-06-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Dear All, > > I have try to use the py2exe to compile the DLL file > > first i write the simple python script "test01.py": > def test001(): > return 1 > > then write the setup.py: > # setup.py > from distutils.core import setup > import py2exe > import sys > > if

Re: very large graph

2008-06-26 Thread boggom
Drawing a large graph like this is not very insightful by itself, and doing this well is still an art form. Many cool visualizations, and all very domain and question dependent, can be found at http://www.visualcomplexity.com/vc/ You can also search on flickr for network and graph drawing. Much o

Making code more efficient and effective

2008-06-26 Thread cokofreedom
I've written up a little piece of code that isn't that foolproof to scan through a file (java presently) to find functions and then look for them throughout the document and output the name of the function, followed by how many times it appears and the lines it appears on. What I was looking for w

where is the error?

2008-06-26 Thread lajam
Hello, I'm trying to assign data into an array with the nonzero function. There is my code. from numarray import * diff_temp=(logical_and(values[:,5] > -2,values[:,5] < 2)).nonzero() This command works fine but when I apply the following, values_matchup=values_Stumpf[diff_temp_Stumpf,:] I have

Re: Making code more efficient and effective

2008-06-26 Thread Cédric Lucantis
Le Thursday 26 June 2008 14:11:35 [EMAIL PROTECTED], vous avez écrit : > I've written up a little piece of code that isn't that foolproof to > scan through a file (java presently) to find functions and then look > for them throughout the document and output the name of the function, > followed by h

ask for a RE pattern to match TABLE in html

2008-06-26 Thread oyster
that is, there is no TABLE tag between a TABLE, for example something with out table tag what is the RE pattern? thanks the following is not right [^table]*? -- http://mail.python.org/mailman/listinfo/python-list

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread Cédric Lucantis
Le Thursday 26 June 2008 15:53:06 oyster, vous avez écrit : > that is, there is no TABLE tag between a TABLE, for example > something with out table tag > what is the RE pattern? thanks > > the following is not right > [^table]*? The construct [abc] does not match a whole word but only one char, s

python, acpi and hid code howto

2008-06-26 Thread Oguz Yarimtepe
Hi all, Is it possible to get the hid code of any pressed key via python? If anyone used such a thing before, i will be happy to get some clues. -- Oğuz Yarımtepe -- http://mail.python.org/mailman/listinfo/python-list

ConfigParser: Can I read(ConfigParser.get()) a configuration file and use it to call a funciton?

2008-06-26 Thread jamitwidme
Hello. I am a novice programmer and have a question I have a configuration file(configuration.cfg) I read this from reading.py using ConfigParser When I use ConfigParser.get() function, it returns a string. I want to call a function that has the same name as the string from the configuration file.

Re: ConfigParser: Can I read(ConfigParser.get()) a configuration file and use it to call a funciton?

2008-06-26 Thread Cédric Lucantis
Le Thursday 26 June 2008 16:41:27 [EMAIL PROTECTED], vous avez écrit : > Hello. I am a novice programmer and have a question > > I have a configuration file(configuration.cfg) > I read this from reading.py using ConfigParser > When I use ConfigParser.get() function, it returns a string. > I want to

Adding functions to an existing instance

2008-06-26 Thread Allen
I need a way to add a method to an existing instance, but be as close as possible to normal instance methods. Using 'new' module or such code as 'def addfunc(...): def helper(...) .. setattr(...)' causes a cyclic reference which requires using 'gc.collect' to release the object. Also 'new' is

Re: ConfigParser: Can I read(ConfigParser.get()) a configuration file and use it to call a funciton?

2008-06-26 Thread Matimus
On Jun 26, 7:41 am, [EMAIL PROTECTED] wrote: > Hello. I am a novice programmer and have a question > > I have a configuration file(configuration.cfg) > I read this from reading.py using ConfigParser > When I use ConfigParser.get() function, it returns a string. > I want to call a function that has

Re: where is the error?

2008-06-26 Thread Gary Herron
[EMAIL PROTECTED] wrote: Hello, I'm trying to assign data into an array with the nonzero function. There is my code. from numarray import * diff_temp=(logical_and(values[:,5] > -2,values[:,5] < 2)).nonzero() Does that have something to do with the question below? This command works fine

Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Thanks Tim, very helpful again. I've now reported this as http://bugs.python.org/issue3210 and implemented your suggested workaround. Regards, Geoff On Jun 25, 9:19 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > geoffbache wrote: > > Am currently being very confused over the following code on Windo

Re: Making code more efficient and effective

2008-06-26 Thread bearophileHUGS
Cédric Lucantis: > PAT = re.compile('^[ ]*(public|protected|private)[ ]+([a-zA-Z0-9_]+) > [ ]+([a-zA-Z0-9_]+)[ ]+\((.*)\).*$') > ... > It might be hard to read but will avoid a lot of obscure parsing code. You can use the VERBOSE mode, to add comments and split that RE into some lines. I think th

Re: automatically import modules upon interpreter invocation

2008-06-26 Thread Jeffrey Froman
Daniel Fetchinson wrote: > Is there a way of making python execute the above whenever it starts > up so that I don't have to type it all the time? Create a script containing these statements, and specify its location with the PYTHONSTARTUP environment variable. Your script will run whenever pytho

Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Tim, Unfortunately my previous message was premature, it seems your workaround doesn't work either on my system (Windows XP, Python 2.5.1) I get the following printed out Traceback (most recent call last): File "C:\TextTest\processown.py", line 12, in os.remove ("filename") WindowsError:

Re: Making code more efficient and effective

2008-06-26 Thread cokofreedom
On Jun 26, 5:42 pm, [EMAIL PROTECTED] wrote: > Cédric Lucantis: > > > PAT = re.compile('^[ ]*(public|protected|private)[ ]+([a-zA-Z0-9_]+) > > [ ]+([a-zA-Z0-9_]+)[ ]+\((.*)\).*$') > > ... > > It might be hard to read but will avoid a lot of obscure parsing code. > > You can use the VERBOSE mode, to

url.encore/quote

2008-06-26 Thread zowtar
urlencode({'page': i, 'order': 'desc', 'style': 'flex power'}) return: page=1&order=desc&style=flex+power but I want: page=1&order=desc&style=flex%20power and url.quote don't put the &'s and ='s any idea guys? -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows process ownership trouble

2008-06-26 Thread Tim Golden
geoffbache wrote: Tim, Unfortunately my previous message was premature, it seems your workaround doesn't work either on my system (Windows XP, Python 2.5.1) I get the following printed out Traceback (most recent call last): File "C:\TextTest\processown.py", line 12, in os.remove ("filena

Re: Mako vs. Cheetah?

2008-06-26 Thread John Salerno
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I always have the desire to learn one thing well instead of split my >attention between several options, so I'm trying to decide which of these >two to start learning. Are there any particular things I should look at >w

Re: url.encore/quote

2008-06-26 Thread ianitux
On 26 jun, 12:53, zowtar <[EMAIL PROTECTED]> wrote: > urlencode({'page': i, 'order': 'desc', 'style': 'flex power'}) > return: > page=1&order=desc&style=flex+power > > but I want: > page=1&order=desc&style=flex%20power > > and url.quote don't put the &'s and ='s > any idea guys? Hi, a quick soluti

Re: Freeze problem with Regular Expression

2008-06-26 Thread Peter Pearson
On 25 Jun 2008 15:20:04 GMT, Kirk <[EMAIL PROTECTED]> wrote: > Hi All, > the following regular expression matching seems to enter in a infinite > loop: > > > import re > text = ' MSX INTERNATIONAL HOLDINGS ITALIA srl (di seguito MSX ITALIA) > una ' > re.findall('[^A-Z|0-9]*((?:[0

Re: Storing value with limits in object

2008-06-26 Thread Josip
Thanks alot. I'm going to use this with few modifications to tailor it to my needs. Thumbs up! > #!/usr/bin/env python > > ## VERSION 2 > ## > ## changelog: > ## - Uses inheritance from _Limited > ## - Added _LimitedLong and llong > ## - limit choose between int, long, and float > > class _Limite

Re: Mako vs. Cheetah?

2008-06-26 Thread Michael Mabin
Cheetah also allows you to embed Python code in the HTML. On Thu, Jun 26, 2008 at 11:10 AM, John Salerno <[EMAIL PROTECTED]> wrote: > "John Salerno" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >I always have the desire to learn one thing well instead of split my > >attention b

Re: extend getattr()

2008-06-26 Thread George Sakkis
On Jun 26, 7:39 am, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Le Thursday 26 June 2008 13:06:53 Rotlaus, vous avez écrit : > > > Hello, > > > lets assume i have some classes: > > > class A(object): > > def __init__(self): > > b = B() > > > class B(object): > > def __init__(self)

Re: Bind compiled code to name?

2008-06-26 Thread Martin v. Löwis
>> d = {} >> exec source_code in d >> some_name = d['some_name'] > > This works quite well! I can't believe after googling for half on hour I > didn't notice this "exec ... in ..." syntax. > One more thing though, is there a way to access "some_name" as a > attribute, instead as a dictionary: >

Re: Bind compiled code to name?

2008-06-26 Thread Martin v. Löwis
>> d = {} >> exec source_code in d >> some_name = d['some_name'] > > This works quite well! I can't believe after googling for half on hour I > didn't notice this "exec ... in ..." syntax. > One more thing though, is there a way to access "some_name" as a > attribute, instead as a dictionary: >

Re: Is there any way to find out sizeof an object

2008-06-26 Thread zooko
Here are a few little tools that I developed to do this kind of thing: http://allmydata.org/trac/pyutil/browser/pyutil/pyutil/memutil.py Regards, Zooko -- http://mail.python.org/mailman/listinfo/python-list

I Need A Placeholder

2008-06-26 Thread Ampedesign
I'm trying to build a try/except case, and I want to have the except function like such: try: # Do some code here var = 1 # For example except: #Do nothing here The only problem is if I leave a comment only in the except block, I get an error back saying that the except

Re: I Need A Placeholder

2008-06-26 Thread Gary Herron
Ampedesign wrote: I'm trying to build a try/except case, and I want to have the except function like such: try: # Do some code here var = 1 # For example except: #Do nothing here try: # Do some code here var = 1 # For example except: pass

Re: I Need A Placeholder

2008-06-26 Thread Daniel Mahoney
On Thu, 26 Jun 2008 10:03:47 -0700, Ampedesign wrote: > I'm trying to build a try/except case, and I want to have the except > function like such: > > try: > # Do some code here > var = 1 # For example > except: > #Do nothing here > > The only problem is if I leave a co

Re: I Need A Placeholder

2008-06-26 Thread Ampedesign
On Jun 26, 10:06 am, Daniel Mahoney <[EMAIL PROTECTED]> wrote: > On Thu, 26 Jun 2008 10:03:47 -0700, Ampedesign wrote: > > I'm trying to build a try/except case, and I want to have the except > > function like such: > > > try: > >       # Do some code here > >       var = 1         # For example >

Re: I Need A Placeholder

2008-06-26 Thread Duncan Booth
Ampedesign <[EMAIL PROTECTED]> wrote: > I'm trying to build a try/except case, and I want to have the except > function like such: > > try: > # Do some code here > var = 1 # For example > except: > #Do nothing here > > The only problem is if I leave a comment only in th

How to get a multicast to wait for all nodes?

2008-06-26 Thread Ryuke
I have a code that receives gps information from nodes and gives off its own coordinates via radios connected by Ethernet. but the code continues to run after receiving only 1 set of coordinates, how do i get it to wait for multiple nodes to send before continuing -- http://mail.python.org/mailman

Re: I Need A Placeholder

2008-06-26 Thread Joshua Kugler
Ampedesign wrote: > I'm trying to build a try/except case, and I want to have the except > function like such: > > try: > # Do some code here > var = 1 # For example > except: > #Do nothing here > > The only problem is if I leave a comment only in the except block, I >

Re: url.encore/quote

2008-06-26 Thread Duncan Booth
zowtar <[EMAIL PROTECTED]> wrote: > urlencode({'page': i, 'order': 'desc', 'style': 'flex power'}) > return: > page=1&order=desc&style=flex+power > > but I want: > page=1&order=desc&style=flex%20power > > and url.quote don't put the &'s and ='s > any idea guys? Why does it matter to you? The +

Re: I Need A Placeholder

2008-06-26 Thread Ampedesign
On Jun 26, 10:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Ampedesign <[EMAIL PROTECTED]> wrote: > > I'm trying to build a try/except case, and I want to have the except > > function like such: > > > try: > >       # Do some code here > >       var = 1         # For example > > except: > >    

RE: I Need A Placeholder

2008-06-26 Thread Deverter,Mark
I typically use pass for a place holder. try: # Do some code here var = 1 # For example except: pass HTH, Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ampedesign Sent: Thursday, June 26, 2008 12:04 PM To: python-list@pyt

Re: Windows process ownership trouble

2008-06-26 Thread Tim Golden
geoffbache wrote: Tim, Unfortunately my previous message was premature, it seems your workaround doesn't work either on my system (Windows XP, Python 2.5.1) I get the following printed out Traceback (most recent call last): File "C:\TextTest\processown.py", line 12, in os.remove ("filena

Re: I Need A Placeholder

2008-06-26 Thread John Salerno
"Joshua Kugler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > except: >pass > > is the usual technique there. Is there any other? -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows process ownership trouble

2008-06-26 Thread Tim Golden
Tim Golden wrote: geoffbache wrote: Tim, Unfortunately my previous message was premature, it seems your workaround doesn't work either on my system (Windows XP, Python 2.5.1) I get the following printed out Traceback (most recent call last): File "C:\TextTest\processown.py", line 12, in

Re: I Need A Placeholder

2008-06-26 Thread Carsten Haese
John Salerno wrote: "Joshua Kugler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] except: pass is the usual technique there. Is there any other? Sure. Evaluating any side-effect free expression and ignoring the result will work: try: # do somthing except: None

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread Stefan Behnel
oyster wrote: > that is, there is no TABLE tag between a TABLE, for example > something with out table tag > what is the RE pattern? thanks > > the following is not right > [^table]*? Why not use an HTML parser instead? Try lxml.html. http://codespeak.net/lxml/ Stefan -- http://mail.python.org/

Re: I Need A Placeholder

2008-06-26 Thread Peter Otten
John Salerno wrote: > "Joshua Kugler" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> except: >>pass >> >> is the usual technique there. > > Is there any other? if 0: 42 Proof: >>> def cp(pass_): ... return compile("try: 1/0\nexcept:\n %s" % pass_, "", "exec") ... >>>

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread Grant Edwards
On 2008-06-26, Stefan Behnel <[EMAIL PROTECTED]> wrote: > oyster wrote: >> that is, there is no TABLE tag between a TABLE, for example >> something with out table tag >> what is the RE pattern? thanks >> >> the following is not right >> [^table]*? > > Why not use an HTML parser instead? Stating i

python interface to Firefox and Thunderbird

2008-06-26 Thread yardennis
Hi, I need python moudles that can auto install python 2.5 (web install or a EXE file) auto download and install Firefox3 and Thunderbird 2 auto import from IE 6, 7 and OE 5,6 and Outlook read contacts and emails from Thunderbird store read Firefox 3 bookmarks, history, cookies and password Ca

Re: Komodo Edit newbie Q

2008-06-26 Thread Todd Whiteman
John Dann wrote: I'm learning Python using the Komodo Edit freeware code editor. One thing I'm finding a little confusing is that the code completion lists (what I would call Intellisense coming from a .Net background) are often very incomplete, especially with imported classes like wx. It's like

Re: Adding functions to an existing instance

2008-06-26 Thread [EMAIL PROTECTED]
On 26 juin, 17:18, Allen <[EMAIL PROTECTED]> wrote: > I need a way to add a method to an existing instance, but be as close as > possible to normal instance methods. def set_method(obj, func, name=None): if not name: name = func.__name__ setattr(obj, name, func.__get__(obj, type(obj))) cl

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Le Thursday 26 June 2008 15:53:06 oyster, vous avez écrit : > > that is, there is no TABLE tag between a TABLE, for example > > something with out table tag > > what is the RE pattern? thanks > > > > the following is not

Re: Freeze problem with Regular Expression

2008-06-26 Thread Peter Pearson
On Thu, 26 Jun 2008 11:20:01 -0500, Peter Pearson wrote: > On 25 Jun 2008 15:20:04 GMT, Kirk <[EMAIL PROTECTED]> wrote: [snip] >> the following regular expression matching seems to enter in a infinite >> loop: [snip] >> import re >> text = ' MSX INTERNATIONAL HOLDINGS ITALIA srl (di seguito MSX IT

Re: Problems with file IO in a thread, and shutil

2008-06-26 Thread MRAB
On Jun 26, 8:06 am, Roopesh <[EMAIL PROTECTED]> wrote: > Thanks for the reply. I did testing in a clean system, were anti virus/ > spyware is not installed. It still gave this problem, in say 1 out of > 1000 cases. > > By any chance would it be possible that the Windows OS has not > completed writi

Re: url.encore/quote

2008-06-26 Thread John Salerno
"zowtar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > urlencode({'page': i, 'order': 'desc', 'style': 'flex power'}) > return: > page=1&order=desc&style=flex+power > > but I want: > page=1&order=desc&style=flex%20power > > and url.quote don't put the &'s and ='s > any idea guys?

Re: Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread MRAB
On Jun 26, 11:48 am, ShashiGowda <[EMAIL PROTECTED]> wrote: > Hey there i made a script to download all images from a web site but > it runs damn slow though I have a lot of bandwidth waiting to be used > please tell me a way to use urllib to open many connections to the > server to download many p

Re: I Need A Placeholder

2008-06-26 Thread John Salerno
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if 0: 42 How Pythonic. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: python-dbus example request

2008-06-26 Thread Casey McGinty
You will need this page to figure out the name of the device, and details on how to access it. However it is not python specific. http://people.freedesktop.org/~david/hal-spec/hal-spec.html -- http://mail.python.org/mailman/listinfo/python-list

simplest c python api callback example

2008-06-26 Thread Tim Spens
The following is a simple complete example using the c python api to generate callbacks from c to python. But when I run the c code I get a segfault in PyInt_FromLong () (see below). Most of this example code was taken from pg 1478 of the 3rd edition python o'reilly book. I cannot see what I'

Help me optimize my feed script.

2008-06-26 Thread bsagert
I wrote my own feed reader using feedparser.py but it takes about 14 seconds to process 7 feeds (on a windows box), which seems slow on my DSL line. Does anyone see how I can optimize the script below? Thanks in advance, Bill # UTF-8 import feedparser rss = [ 'http://feeds.feedburner.com/typepad/

Re: ConfigParser: Can I read(ConfigParser.get()) a configuration file and use it to call a funciton?

2008-06-26 Thread jamitwidme
Thank you for the answers. Now I understood how to call a function, let me ask you another question. configuration.cfg --- [1234] title: abcd function: efgh --- reading.py -

Re: url.encore/quote

2008-06-26 Thread ianitux
On 26 jun, 15:53, "John Salerno" <[EMAIL PROTECTED]> wrote: > "zowtar" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > urlencode({'page': i, 'order': 'desc', 'style': 'flex power'}) > > return: > > page=1&order=desc&style=flex+power > > > but I want: > > page=1&order=desc&styl

Re: url.encore/quote

2008-06-26 Thread John Salerno
"ianitux" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> and see if that works? I'm not sure if quote() will convert the %20 into >> +, >> though, but it may. > > This is what quot do. > import urllib u = urllib u.quote(u.urlencode({'page': 'i', 'order': 'desc', 'st

Help me on Backspace please

2008-06-26 Thread cakomo
Hi I am a beginner on Python and have a problem.. I have text file and reading it line by line and there are backspace characters in it like '\b' or anything you want like "#". I want to replace these chars. with Backspace action. I mean deleting the previous char. and the \b char also. and writi

sqlite3 alternative option

2008-06-26 Thread Gandalf
Hi every one I'm looking for a good alternative db to replace sqlite I'm using pySQlite3, And I tried to translate very big database from Mysql to sqlite. I generated through PHP a python script that insert 200,000 records to my sqlite db and took me more then 5 hours and managed to insert only

Re: recursion in Class-methods?

2008-06-26 Thread defn noob
class Graph(object): where does anyone write like that? I've seen only examples like i have written. is the object then passed to init? class Graph(object): def __init__(self, dictionary): self.structure = dictionary or class Graph(object): def __init__(self, object):

Re: recursion in Class-methods?

2008-06-26 Thread defn noob
> > > if start == end: > > return path > > if not self.dictionary.has_key(start): > >if start not in self.dictionnary: > > > return None > > for node in self.dictionary[start]: > > if node not in path: > > newpa

Re: Help me optimize my feed script.

2008-06-26 Thread Carl Banks
On Jun 26, 3:30 pm, [EMAIL PROTECTED] wrote: > I wrote my own feed reader using feedparser.py but it takes about 14 > seconds to process 7 feeds (on a windows box), which seems slow on my > DSL line. Does anyone see how I can optimize the script below? Thanks > in advance, Bill > > # UTF-8 > import

list previous or following list elements

2008-06-26 Thread antar2
Hello Suppose I have a textfile (text1.txt) with following four words: Apple balcony cartridge damned paper bold typewriter and I want to have a python script that prints the words following the word starting with the letter b (which would be cartridge) or differently put, a script that prints

Re: Help me on Backspace please

2008-06-26 Thread Craig Radcliffe
Something like this might do the trick: import re f = open("file.txt") old_text = f.readlines() f.close() new_text = [re.sub(r'.\b', '', i) for i in old_text] f = open("file_modified.txt", "w") f.writelines(new_text) I don't know how necessary the separate read and writes are, but it'll be good

Re: Help me optimize my feed script.

2008-06-26 Thread Jason Scheirer
On Jun 26, 12:30 pm, [EMAIL PROTECTED] wrote: > I wrote my own feed reader using feedparser.py but it takes about 14 > seconds to process 7 feeds (on a windows box), which seems slow on my > DSL line. Does anyone see how I can optimize the script below? Thanks > in advance, Bill > > # UTF-8 > impor

Re: Error when interfacing with TCP/IP

2008-06-26 Thread Terry Reedy
Devarajulu, Baskar (D.) wrote: Hi, I'm using Python and working for automation of testing ,I face error when the script accessed TCP/IP Interface COMM_TYPE = 1# Choose 1 - TCP IP Communication or 0 - RS232 communication. TCP_ip = '136.18.201.53' # the TCP IP addre

Strange urllib.unquote() behavior

2008-06-26 Thread Jonas Galvez
To me, at least. >>> urllib.unquote("content%28type%3D%2527Car%2527%29") 'content(type=%27Car%27)' >>> urllib.unquote('content(type=%27Car%27)') "content(type='Car')" The quoted string is coming from a URL parameter parsed in a Google App Engine request handler. So right now I have to apply unqu

Re: list previous or following list elements

2008-06-26 Thread Terry Reedy
antar2 wrote: Hello Suppose I have a textfile (text1.txt) with following four words: I see seven. Just say 'list of words' Apple balcony cartridge damned paper bold typewriter and I want to have a python script that prints the words following the word starting with the letter b (which w

  1   2   >