Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Tim, I copied your code exactly from my browser and ran it, so I don't think there was a typo. I could upgrade to Python 2.5.2 I suppose to compare and contrast, but I need to support older Python versions anyway so it's a bit academic... Your speculation about garbage collection did set me goin

Re: Cyclic imports

2008-06-26 Thread Torsten Bronger
Hallöchen! James writes: >> # a.py >> import b >> # refer to b.b >> >> # b.py >> import a >> # refer to a.a > > Thanks Dan, but that still doesn't work for me I'm afraid... > > I renamed the modules avoid name overloading -- a.py is now: > import b > > class A(): > print('b.b_mod:', b.b_mod)

Re: Cyclic imports

2008-06-26 Thread James
> # a.py > import b > # refer to b.b > > # b.py > import a > # refer to a.a Thanks Dan, but that still doesn't work for me I'm afraid... I renamed the modules avoid name overloading -- a.py is now: import b class A(): print('b.b_mod:', b.b_mod) b is now defined, but b.b_mod isn't: File "m

Re: Web Crawler - Python or Perl?

2008-06-26 Thread Chuck Rhode
On Sun, 22 Jun 2008 10:47:59 -0700, subeen wrote: > You can avoid the problem using the following code: > import socket > timeout = 300 # seconds > socket.setdefaulttimeout(timeout) Yes, I tried that, too, but I forget what went wrong with it. Perhaps, the socket kept up the handshake even thou

Re: Cyclic imports

2008-06-26 Thread Dan Bishop
On Jun 26, 10:40 pm, James <[EMAIL PROTECTED]> wrote: > Hi all, > I'm looking for some advice dealing with cyclic, cross-package > imports. > > I've created the following demo file structure: > ./a/__init__.py > ./a/a.py > ./b/__init__.py > ./b/b.py > ./main.py > > a.py imports a class from b.py an

Re: Learning Python in a group

2008-06-26 Thread Mr. Juju
Taygun Kekec wrote: hi guys. I would be glad to join your group because i want to learn deeper python but i am frustrated of isolation too. It would provide stimulation and encourage to study and will boost our desire to learn. So count me in! hello all, I just started studying python myself a

Cyclic imports

2008-06-26 Thread James
Hi all, I'm looking for some advice dealing with cyclic, cross-package imports. I've created the following demo file structure: ./a/__init__.py ./a/a.py ./b/__init__.py ./b/b.py ./main.py a.py imports a class from b.py and vice versa, and main.py imports them both. However, because a.py has not

How to "rebind" py2.5.1 to run from comprompt after uninstalling py3.0?

2008-06-26 Thread defn noob
I installed python30 and so command prompt runs all pythonprograms through that which i didnt want so i uninstalled it. now i cant start any pythonprograms through the commandprompt. how do I "rebind" python25 to luanch when claling .py-files from the command prompt? -- http://mail.python.org/mai

warning for unused packages/modules/objects

2008-06-26 Thread Daniel Fetchinson
How difficult would it be to implement a system in python that would warn if there are unnecessarily imported packages/modules/objects in the code? I mean that when developing some code one frequently imports stuff, deletes the import, changes stuff here and there, imports other stuff, later decide

Re: Working with the Windows Registry

2008-06-26 Thread s0suk3
On Jun 26, 4:24 am, teh_sAbEr <[EMAIL PROTECTED]> wrote: > 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

Re: python interface to Firefox and Thunderbird

2008-06-26 Thread Larry Bates
yardennis wrote: 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, cooki

Design principles and architecture of an information transfer standard based on XML and SOAP

2008-06-26 Thread xkenneth
All, So i'm just about to undertake my first real open source project, and I'm looking for a bit of advice. There's an oilfield standard called WITSML (Wellsite Information Transfer Standard Markup Language - witsml.org), it's basically a collection of XML schemas and a spec for an client-serve

Re: recursion in Class-methods?

2008-06-26 Thread Saul Spatz
defn noob wrote: 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: newpath = find_path

Re: sqlite3 alternative option

2008-06-26 Thread Gandalf
you where right! thank you ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help capturing output of re.search

2008-06-26 Thread John Machin
On Jun 27, 10:45 am, [EMAIL PROTECTED] wrote: > On Jun 26, 5:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Jun 27, 10:01 am, [EMAIL PROTECTED] wrote: > > > > >You may like to read this:http://www.amk.ca/python/howto/regex/ > > > > This is a good resource. Thank you. > > > Someone else

What happened to _tkinter.so?

2008-06-26 Thread akineko
Hello Python developers, I have noticed something curious while I was investigating a problem with the PyInstaller. In my environment, the PyInstaller couldn't find TCL/TK installation path even I have it. I found the PyInstaller uses output from ldd to find the a path to TCL/TK libraries. But n

Re: Need help capturing output of re.search

2008-06-26 Thread joemacbusiness
On Jun 26, 5:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 27, 10:01 am, [EMAIL PROTECTED] wrote: > > > >You may like to read this:http://www.amk.ca/python/howto/regex/ > > > This is a good resource.  Thank you. > > Someone else pointed out that I needed to change the > > > if reCheck == "

Re: list previous or following list elements

2008-06-26 Thread bearophileHUGS
Terry Reedy: > I believe > wordlist = open('words.txt','r').read().split('\n') > should give you the list in Python. This looks better (but it keeps the newlines too. Untested. Python 2.x): words = open("words.txt").readlines() for i, word in enumerate(words): if word.startswith("b"):

Re: sqlite3 alternative option

2008-06-26 Thread jay graves
On Jun 26, 6:30 pm, Allen <[EMAIL PROTECTED]> wrote: > Gandalf wrote: > > 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

Re: Need help capturing output of re.search

2008-06-26 Thread John Machin
On Jun 27, 10:01 am, [EMAIL PROTECTED] wrote: > >You may like to read this:http://www.amk.ca/python/howto/regex/ > > This is a good resource. Thank you. > Someone else pointed out that I needed to change the > > if reCheck == "None": > > to > > if reCheck == None: # removed the "s "Somebody els

Re: list previous or following list elements

2008-06-26 Thread norseman
Terry Reedy wrote: 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

Re: Help me on Backspace please

2008-06-26 Thread John Machin
On Jun 27, 6:32 am, [EMAIL PROTECTED] wrote: > 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 del

Re: Need help capturing output of re.search

2008-06-26 Thread joemacbusiness
>You may like to read this: http://www.amk.ca/python/howto/regex/ This is a good resource. Thank you. Someone else pointed out that I needed to change the if reCheck == "None": to if reCheck == None: # removed the "s This worked great! Thanks! --JM -- http://mail.python.org/mailman/listin

Re: sqlite3 alternative option

2008-06-26 Thread Allen
Gandalf wrote: 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

Re: Need help capturing output of re.search

2008-06-26 Thread John Machin
On Jun 27, 8:31 am, [EMAIL PROTECTED] wrote: > Hi - > > I need help capturing the output of a RegEx search. > I dont understand why this conditional fails. > > Here is the code: > > #= start snip > == > #!/usr/local/bin/python > >

Re: Adding functions to an existing instance

2008-06-26 Thread Allen
[EMAIL PROTECTED] wrote: 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.__g

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

2008-06-26 Thread Jonathan Gardner
On Jun 26, 3:22 pm, MRAB <[EMAIL PROTECTED]> wrote: > Try something like: > > re.compile(r'.*?', re.DOTALL) So you would pick up strings like "foo"? I doubt that is what oyster wants. -- http://mail.python.org/mailman/listinfo/python-list

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

2008-06-26 Thread Jonathan Gardner
On Jun 26, 11:07 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-06-26, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > > Why not use an HTML parser instead? > > > > Stating it differently: in order to correctly recognize HTML > tags, you must use an HTML parser.  Trying to write an HTML > pa

Need help capturing output of re.search

2008-06-26 Thread joemacbusiness
Hi - I need help capturing the output of a RegEx search. I dont understand why this conditional fails. Here is the code: #= start snip == #!/usr/local/bin/python import os import re dirName = '/home/user/bin/logs' os.chdir(dir

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

2008-06-26 Thread MRAB
On Jun 26, 7:26 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > 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 w

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

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: 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

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: 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

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 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

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: 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):

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

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

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

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: 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 -

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/

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'

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

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: 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: 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: 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: 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: 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: 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: 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

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: 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

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 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 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: 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 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
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 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: 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: 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 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 >

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 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

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 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 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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

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 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

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.

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

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

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: 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

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

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

  1   2   >