Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-15 Thread Igor Katson
Gabriel Genellina wrote: En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: I have problems in getting a SocketServer to shutdown. Do you want to do a shutdown or

Re: Python system with exemplary organization/coding style

2009-05-15 Thread TomF
On 2009-05-14 16:18:07 -0700, CTO said: On May 14, 7:01 pm, TomF wrote: I'm looking for a medium-sized Python system with very good coding style and good code organization, so I can learn from it.  I'm reading various books on Python with advice on such things but I'd prefer to see a real sys

Re: python copy method alters type

2009-05-15 Thread greg
Zhenhai Zhang wrote: a: ['a', 1, 3, 4] c: ['c' '2' '3' '4'] The lack of commas here suggests that c is actually a numpy array rather than a list. Did you import copy from Numeric or numpy, by any chance? The following experiment reproduces your result: >>> import numpy >>> a = ['a', 1, 2, 3

Re: ConfigParser examples?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 18:32:57 -0300, Esmail escribió: Can anyone point to on the web, or possibly share a simple example of the use of the ConfigParser module? The (excellent!) article series by Doug Hellmann, "Python Module of the Week", covers ConfigParser (and almost the whole standard li

Re: Appending traceback from exception in child thread

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 15:09:45 -0300, Edd escribió: As the comment on the last line indicates, looking at the .value() of a Future may give the return value of the associated task, or it may also propagate an exception that was raised in a child thread. Inside the implementation I store caught e

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Ned Deily
In article , Sam Tregar wrote: > Can anyone explain why this creates a list containing a > dictionary: > [{'a': 'b', 'foo': 'bar'}] > But this creates a list of keys of the dictionary: > list({ "a": "b", "foo": "bar" }) The first example is a list, expressed as a list display literal, con

Re: Case insensitive version of string.Template?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 12:35:09 -0300, escribió: Using Python 2.6 or higher: Is there a way to configure string.Template() to ignore the case of matched identifiers? In other words, given the following Template string and dictionary where all keys are lowercase, is there a way to have my identifie

WinAppDbg module v1.1 is out!

2009-05-15 Thread Mario Alejandro Vilas Jerez
What is WinAppDbg? == The WinAppDbg python module allows developers to quickly code instrumentation scripts in Python under a Windows environment. It uses ctypes to wrap many Win32 API calls related to debugging, and provides an object-oriented abstraction layer to manipulate thre

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 22:17:43 -0300, Sam Tregar escribió: Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ "a": "b", "foo": "bar" }) I expected them to be equivalent but cl

Re: How do i generate a tuple from a generator ?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 17:58:55 -0300, eye zak escribió: I have a situation where i want a tuple from a generator/sequence comprehension. I am wondering, is this possible ? or is this just a bad idea all together? class iterator(object): __slots__ = ('__iters',) def __init__(self,*a

Re: using urlretrive/urlopen

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 12:03:09 -0300, Rustom Mody escribió: I am trying to talk to a server that runs on localhost The server runs on http://localhost:7000/ and that opens alright in  a web browser. However if I use urlopen or urlretrieve what I get is this 'file' -- obviously not the one that

Re: Tkinter Window On Top

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 16:39:41 -0300, Trevor escribió: Can a Tkinter application create a COM object and keep its own window on top of it? excel = win32com.client.Dispatch('Excel.Application') I would like the user to be able to see and interact with the Excel application but keep the Tkinter

Difference between list() and [] with dictionaries

2009-05-15 Thread Sam Tregar
Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ "a": "b", "foo": "bar" }) I expected them to be equivalent but clearly they're not! I'm using Python 2.6.1 if that helps. -s

Annoying feedparser issues

2009-05-15 Thread John Nagle
This really isn't the fault of the "feedparser" module, but it's worth mentioning. I have an application which needs to read each new item from a feed as it shows up, as efficiently as possible, because it's monitoring multiple feeds. I want exactly one copy of each item as it comes in.

Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: I have problems in getting a SocketServer to shutdown. Do you want to do a shutdown or a close? I want the se

Re: Just wondering

2009-05-15 Thread Dave Angel
norseman wrote: Marco Mariani wrote: Gediminas Kregzde wrote: def doit(i): pass def main(): a = [0] * 1000 t = time() map(doit, a) print "map time: " + str(time() - t) Here you are calling a function ten million times, build a list with of ten million None results, then

Re: Configure options for minimal Python 2.6

2009-05-15 Thread Martin v. Löwis
> I want to compile a minimal Python 2.6 for Debian Etch without support > for optional features such as tk and sphinx. The configure script's > help says that features can be disabled with an '--without-PACKAGE', so > I guess disabling tk is '--without-tk', but where is there a list of the > feat

ANN: ActivePython 2.6.2.2, 3.1.0b1.0, 2.5.4.4 is now available

2009-05-15 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 2.6.2.2, 3.1.0b1.0 and 2.5.4.4 are now available for download from: http://www.activestate.com/activepython/ This is a patch release that updates ActivePython to core Python 2.6.2 and 3.1b2. This release also contains updates to Tcl/Tk 8.5.7 and Tix 8

Re: python

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 14:58:16 +0100, wrote: hello, I´m a student of linguistic an I need do this exercises. Can anybody help me,please? Thanks Sorry, we're allergic to homework. If you've got any more specific questions about how bits of Python work, do ask, but don't ask us to do your assign

Re: Need advice on distributing small module

2009-05-15 Thread kj
In <99246143-a853-4041-bc45-eeb648388...@r3g2000vbp.googlegroups.com> Carl Banks writes: >On May 14, 1:26=A0pm, kj wrote: >> I've written a tiny module that I'd like to make available online >> from my website. =A0This module is not "production-grade" code; it >> is meant only as an illustratio

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 17:12:24 +0100, wrote: How do you parse a string enclosed in Curly Braces? For instance: x = "{ABC EFG IJK LMN OPQ}" I want to do x.split('{} ') and it does not work. Why does it not work and what are EXCEPTIONS to using the split method? Other people have already done

Re: How to get the formal args of a function object?

2009-05-15 Thread kj
In Chris Rebert writes: >Take a look at inspect.getargspec(func): >http://docs.python.org/library/inspect.html#inspect.getargspec Thank you much, that did the trick. And inspect is a very handy module to know about. kynn -- NOTE: In my address everything before the first period is backwards

Re: How to catch str exception?

2009-05-15 Thread Cameron Simpson
On 15May2009 13:36, <> wrote: | "anuraguni...@yahoo.com" writes: | > there are many such exceptions and hence it is not feasible to catch | > them all or know them all unless i go thru src code. | | But that is true of all exceptions. The alternative seems to be a | "checked exception" scheme l

Re: How to catch str exception?

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 12:50:59 +0100, anuraguni...@yahoo.com wrote: try:     raise "abc" except:     e, t, tb = sys.exc_info()     if not isinstance(e, str):         raise     print "caught", e This seems to be the solution, thanks Do be aware that string exceptions are going away, so at

Photoimage on button appears pixelated when button is disabled

2009-05-15 Thread Dustan
In tkinter, when I place a photoimage on a button and disable the button, the image has background dots scattered through the image. Searching the web, I wasn't able to find any documentation on this behavior, nor how to turn it off. So here I am. How do I keep this from happening? Also, how can I

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread John Machin
On May 16, 3:25 am, MRAB wrote: > Chris Rebert wrote: > > On Fri, May 15, 2009 at 9:12 AM,   wrote: > >> How do you parse a string enclosed in Curly Braces? > > >> For instance: > > >> x = "{ABC EFG IJK LMN OPQ}" > > >> I want to do x.split('{} ') and it does not work. Why does it not work > >> an

ConfigParser examples?

2009-05-15 Thread Esmail
Hi all, Can anyone point to on the web, or possibly share a simple example of the use of the ConfigParser module? I have a program that has a lot of flags in various places (yes, ugly I know), so I am trying to consolidate this information in a configuration file so that the program can pull the

Re: ConfigParser and newlines

2009-05-15 Thread Minesh Patel
> Not as best I can tell.  From my /usr/lib/python2.5/ConfigParser.py file, > around line 441: > >  if line[0].isspace() and cursect is not None and optname: >    value = line.strip() >    if value: >      cursect[optname] = "%s\n%s" % (cursect[optname], value) > > That "value = line.strip()" is wh

Re: Just wondering

2009-05-15 Thread norseman
Marco Mariani wrote: Gediminas Kregzde wrote: def doit(i): pass def main(): a = [0] * 1000 t = time() map(doit, a) print "map time: " + str(time() - t) Here you are calling a function ten million times, build a list with of ten million None results, then throw it away.

Re: Just wondering

2009-05-15 Thread norseman
Gediminas Kregzde wrote: Hello, I'm Vilnius college II degree student and last semester our teacher introduced us to python I've used to program with Delphi, so I very fast adopted to python Now I'm developing cross platform program and use huge amounts of data. Program is needed to run as fast

Re: How do i generate a tuple from a generator ?

2009-05-15 Thread Emile van Sebille
On 5/15/2009 1:58 PM eye zak said... Hi, I have a situation where i want a tuple from a generator/sequence comprehension. I am wondering, is this possible ? or is this just a bad idea all together? class iterator(object): __slots__ = ('__iters',) def __init__(self,*args): asser

How do i generate a tuple from a generator ?

2009-05-15 Thread eye zak
Hi, I have a situation where i want a tuple from a generator/sequence comprehension. I am wondering, is this possible ? or is this just a bad idea all together? class iterator(object): __slots__ = ('__iters',) def __init__(self,*args): assert len(args) != 0 self.__iters =

Re: How to catch str exception?

2009-05-15 Thread MRAB
Paul Rubin wrote: "anuraguni...@yahoo.com" writes: there are many such exceptions and hence it is not feasible to catch them all or know them all unless i go thru src code. But that is true of all exceptions. The alternative seems to be a "checked exception" scheme like Java's, which in prac

Re: How to catch str exception?

2009-05-15 Thread Paul Rubin
"anuraguni...@yahoo.com" writes: > there are many such exceptions and hence it is not feasible to catch > them all or know them all unless i go thru src code. But that is true of all exceptions. The alternative seems to be a "checked exception" scheme like Java's, which in practice imposes a hug

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread Peter Otten
k...@fiber-space.de wrote: > ttable = string.maketrans("{} ", "\1\1\1") > print x.translate(ttable).split("\1") # -> ['', 'ABC', 'EFG', 'IJK', > 'LMN', 'OPQ', ''] > > The validity of the translation+split depends on the presence of \1 in > the original string of course. Keep one of the split

Re: Finding location of an executable in a windows machine?

2009-05-15 Thread Terry Reedy
nonse...@mynonsense.net wrote: My python script calls another windows program file. I have the path to that program hardcoded in it. Is there a way for python to automatically find the path to this program? testapp_path = "C:\\Program Files\\testapp\\version\\61\\" Or do i have to do a brute fo

Tkinter Window On Top

2009-05-15 Thread Trevor
Can a Tkinter application create a COM object and keep its own window on top of it? excel = win32com.client.Dispatch('Excel.Application') I would like the user to be able to see and interact with the Excel application but keep the Tkinter application on top. -- http://mail.python.org/mailman/lis

Re: How to catch str exception?

2009-05-15 Thread Terry Reedy
anuraguni...@yahoo.com wrote: but the whole point of catching such exception is that i can print its value there are many such exceptions and hence it is not feasible to catch them all or know them all unless i go thru src code. I think you have discovered why they are gone in Py3 ;-). -- htt

Re: SOAPpy(10060, 'Operation timed out')

2009-05-15 Thread Piet van Oostrum
> "Zhang, Ning" (ZN) wrote: >ZN> Hi all >ZN> I am working for a energy company, we currently want to use api to load >ZN> data into the database. >ZN> I am new for soappy package. I have done a bit research on >ZN> http://www.ibm.com/developerworks/webse ... #resources >ZN>

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread kay
On 15 Mai, 18:12, xama...@yahoo.com wrote: > How do you parse a string enclosed in Curly Braces? > > For instance: > > x = "{ABC EFG IJK LMN OPQ}" > > I want to do x.split('{} ') and it does not work. Why does it not work > and what are EXCEPTIONS to using the split method? > > That I want to split

Re: Appending traceback from exception in child thread

2009-05-15 Thread Chris Mellon
On Fri, May 15, 2009 at 1:09 PM, Edd wrote: > Hi folks, > > I have a some threadpool code that works like this : > >    tp = ThreadPool(number_of_threads) >    futures = [tp.future(t) for t in tasks] # each task is callable >    for f in futures: >        print f.value() # <-- may propagate an exc

Re: ConfigParser and newlines

2009-05-15 Thread Tim Chase
test.cfg [Foo_Section] BODY = Line of text 1 Continuing Line of text 1 Executing the code === Python 2.5.1 Stackless 3.1b3 060516 (release25-maint, Mar 6 2009, 14:12:34) [GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2 Type "help", "copyright", "credits

Re: ConfigParser and newlines

2009-05-15 Thread Mike Driscoll
On May 15, 1:09 pm, Minesh Patel wrote: > I am using ConfigParser to parse a config file and I want to maintain > the newlines, how is it possible. Example given below. BTW, is there > an alternative to configParser, should I use 'exec' instead. Is there > any support for yaml built-in or possibly

ConfigParser and newlines

2009-05-15 Thread Minesh Patel
I am using ConfigParser to parse a config file and I want to maintain the newlines, how is it possible. Example given below. BTW, is there an alternative to configParser, should I use 'exec' instead. Is there any support for yaml built-in or possibly in the future? test.cfg [Foo_Secti

Re: Can I get a value's name

2009-05-15 Thread Ken Seehart
jalanb3 wrote: Context for this question arises from some recent code. In particular the "replace_line" method, which takes in a regexp to look for, and a replacement for when it matches. It is supposed to work for single lines only (we add ^ and $ to the regexp), so arguments which have '\n'

Appending traceback from exception in child thread

2009-05-15 Thread Edd
Hi folks, I have a some threadpool code that works like this : tp = ThreadPool(number_of_threads) futures = [tp.future(t) for t in tasks] # each task is callable for f in futures: print f.value() # <-- may propagate an exception The idea being that a Future object represents

Re: DOM implementation

2009-05-15 Thread Paul Boddie
On 15 Mai, 18:27, "Emanuele D'Arrigo" wrote: > > I just had a look at libxml2dom, in particular its events.py file. > Given that we are working from a standard your implementation is > exceedingly similar to mine and had I know before I started writing my > own classes I would have started from it

Re: Finding location of an executable in a windows machine?

2009-05-15 Thread Dave Angel
nonse...@mynonsense.net wrote: My python script calls another windows program file. I have the path to that program hardcoded in it. Is there a way for python to automatically find the path to this program? testapp_path = "C:\\Program Files\\testapp\\version\\61\\" Or do i have to do a brute fo

Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread Dave Angel
xama...@yahoo.com wrote: If I have an integer k, for instance; k = 32 // BASE 10 How do I get print to print it out in HEX and PREFIXED with 0x? What is the PROPER WAY? This does not work: print "This is hex 32: ", int(k, 16) Xav How about print "This is hex 32: ", hex(k) (This w

Re: introspection question: get return type

2009-05-15 Thread Aahz
In article <4a0d2e07$0$9422$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Aahz a écrit : >> In article <4a0c6e42$0$12031$426a7...@news.free.fr>, >> Bruno Desthuilliers wrote: >>> Marco Mariani a écrit : Bruno Desthuilliers wrote: > Oh, you meant the "return type" ? Nope, no way.

Re: Finding location of an executable in a windows machine?

2009-05-15 Thread MRAB
nonse...@mynonsense.net wrote: My python script calls another windows program file. I have the path to that program hardcoded in it. Is there a way for python to automatically find the path to this program? testapp_path = "C:\\Program Files\\testapp\\version\\61\\" Or do i have to do a brute fo

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread MRAB
Chris Rebert wrote: On Fri, May 15, 2009 at 9:12 AM, wrote: How do you parse a string enclosed in Curly Braces? For instance: x = "{ABC EFG IJK LMN OPQ}" I want to do x.split('{} ') and it does not work. Why does it not work and what are EXCEPTIONS to using the split method? .split() take

Re: Sorting a dictionary

2009-05-15 Thread J. Cliff Dyer
On Fri, 2009-05-15 at 09:57 -0700, Tobiah wrote: > On Tue, 12 May 2009 14:17:54 +0200, Jaime Fernandez del Rio wrote: > > > This one I think I know... Try with: > > > > for k in sorted(word_count) : > > print k,"=",word_count[k] > > > > You need to do the sorting before iterating over the ke

RE: Printing a hex character and prefixing it correctly

2009-05-15 Thread Andreas Tawn
> If I have an integer k, for instance; > > k = 32 // BASE 10 > > How do I get print to print it out in HEX and PREFIXED with 0x? What > is the PROPER WAY? > > This does not work: > > print "This is hex 32: ", int(k, 16) > > Xav k = 32 print "This is hex 32: ", hex(k) Cheers, Drea -- ht

Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread BgEddy
xama...@yahoo.com wrote: > If I have an integer k, for instance; > > k = 32 // BASE 10 > > How do I get print to print it out in HEX and PREFIXED with 0x? What > is the PROPER WAY? > > This does not work: > > print "This is hex 32: ", int(k, 16) > > Xav How about this : k=32 print "This i

Re: Sorting a dictionary

2009-05-15 Thread Tobiah
On Tue, 12 May 2009 14:17:54 +0200, Jaime Fernandez del Rio wrote: > This one I think I know... Try with: > > for k in sorted(word_count) : > print k,"=",word_count[k] > > You need to do the sorting before iterating over the keys... Isn't that what's happening here? I read this as the 'sor

Finding location of an executable in a windows machine?

2009-05-15 Thread nonsense
My python script calls another windows program file. I have the path to that program hardcoded in it. Is there a way for python to automatically find the path to this program? testapp_path = "C:\\Program Files\\testapp\\version\\61\\" Or do i have to do a brute force approach to searching all dri

Autosizing column widths in Excel using win32com.client ?

2009-05-15 Thread nonsense
Is there a way to autosize the widths of the excel columns as when you double click them manually? -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a hex character and prefixing it correctly

2009-05-15 Thread Chris Rebert
On Fri, May 15, 2009 at 9:15 AM, wrote: > If I have an integer k, for instance; > > k = 32 // BASE 10 > > How do I get print to print it out in HEX and PREFIXED with 0x? What > is the PROPER WAY? > > This does not work: > >  print "This is hex 32: ", int(k, 16) print "This is hex 32:", hex(k) p

Re: DOM implementation

2009-05-15 Thread Emanuele D'Arrigo
Hi Paul, thank you for your swift reply! On May 15, 3:42 pm, Paul Boddie wrote: > Sure! Just keep your observations coming! I've made a very lazy > attempt at DOM Events support in libxml2dom, I just had a look at libxml2dom, in particular its events.py file. Given that we are working from a sta

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread Mike Driscoll
On May 15, 11:12 am, xama...@yahoo.com wrote: > How do you parse a string enclosed in Curly Braces? > > For instance: > > x = "{ABC EFG IJK LMN OPQ}" > > I want to do x.split('{} ') and it does not work. Why does it not work > and what are EXCEPTIONS to using the split method? > > That I want to sp

Printing a hex character and prefixing it correctly

2009-05-15 Thread xamalek
If I have an integer k, for instance; k = 32 // BASE 10 How do I get print to print it out in HEX and PREFIXED with 0x? What is the PROPER WAY? This does not work: print "This is hex 32: ", int(k, 16) Xav -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread Chris Rebert
On Fri, May 15, 2009 at 9:12 AM, wrote: > How do you parse a string enclosed in Curly Braces? > > For instance: > > x = "{ABC EFG IJK LMN OPQ}" > > I want to do x.split('{} ') and it does not work. Why does it not work > and what are EXCEPTIONS to using the split method? .split() takes a *substr

Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread xamalek
How do you parse a string enclosed in Curly Braces? For instance: x = "{ABC EFG IJK LMN OPQ}" I want to do x.split('{} ') and it does not work. Why does it not work and what are EXCEPTIONS to using the split method? That I want to split based on '{', '}' and WHITESPACE. Please advise. Regards

Re: Your Favorite Python Book

2009-05-15 Thread Lou Pecora
In article , Mike Driscoll wrote: > On May 11, 4:45 pm, Chris Rebert wrote: > > > > I like "Python in a Nutshell" as a reference book, although it's now > > slightly outdated given Python 3.0's release (the book is circa 2.5). > > > > Cheers, > > Chris "Python in a Nutshell" -- Absolutely!

Re: (Windows) Finding out which process has locked a file.

2009-05-15 Thread Tim Golden
CinnamonDonkey wrote: Thanx for the response Tim! :-) Great site! > I'm genuinely surprised to hear you say that... Early morning frustration... I appologise to all... you are totally right. Thank you to all for the responses. Well it's big of you to apologise. In return, I've managed to kno

Re: How to catch str exception?

2009-05-15 Thread Dave Angel
anuraguni...@yahoo.com wrote: except TypeError,e: print "1",e # is caught here 1 exceptions must be classes or instances, not str doesn't happen so in 2.5.2 I tested it in 2.6.2 Perhaps you could try something like: try: raise "xxx" except Exception, e: print "1",e # is

Re: Your Favorite Python Book

2009-05-15 Thread Mike Driscoll
On May 11, 4:45 pm, Chris Rebert wrote: > On Mon, May 11, 2009 at 1:44 PM, Sam Tregar wrote: > > Greetings.  I'm working on learning Python and I'm looking for good books to > > read.  I'm almost done with Dive into Python and I liked it a lot. I found > > Programming Python a little dry the last

Case insensitive version of string.Template?

2009-05-15 Thread python
Using Python 2.6 or higher: Is there a way to configure string.Template() to ignore the case of matched identifiers? In other words, given the following Template string and dictionary where all keys are lowercase, is there a way to have my identifiers expanded based on their lowercase values? impor

Re: Import w/ '.' syntax

2009-05-15 Thread mrstevegross
> In that specific case, you're looking for a module 'bar' in the 'foo' > package, which should be located somewhere on sys.path. > > http://docs.python.org/tutorial/modules.html > > That covers it pretty well. Aha! 'packages'! That makes sense. Thanks, --Steve -- http://mail.python.org/mailman/

Re: Import w/ '.' syntax

2009-05-15 Thread Jeff McNeil
On May 15, 10:50 am, mrstevegross wrote: > Remind me: is it possible to craft an import statement like this: >   import foo.bar > > If so, what's going on here exactly? Is Python looking for a module > called 'bar', in a directory called 'foo', in a search path somewhere? > Or am I totally misunde

using urlretrive/urlopen

2009-05-15 Thread Rustom Mody
I am trying to talk to a server that runs on localhost The server runs on http://localhost:7000/ and that opens alright in  a web browser. However if I use urlopen or urlretrieve what I get is this 'file' -- obviously not the one that the browser gets: Query 'http://localhost:7000/' not implemen

Re: Your Favorite Python Book

2009-05-15 Thread Jeff McNeil
On May 11, 5:45 pm, Chris Rebert wrote: > On Mon, May 11, 2009 at 1:44 PM, Sam Tregar wrote: > > Greetings.  I'm working on learning Python and I'm looking for good books to > > read.  I'm almost done with Dive into Python and I liked it a lot. I found > > Programming Python a little dry the last

Import w/ '.' syntax

2009-05-15 Thread mrstevegross
Remind me: is it possible to craft an import statement like this: import foo.bar If so, what's going on here exactly? Is Python looking for a module called 'bar', in a directory called 'foo', in a search path somewhere? Or am I totally misunderstanding the import semantics. Thanks, --Steve --

Re: DOM implementation

2009-05-15 Thread Paul Boddie
On 15 Mai, 15:23, "Emanuele D'Arrigo" wrote: > Hey Paul, > > would you mind continuing this thread on Python + DOM? I'm trying to > implement a DOM Events-like set of classes and I could use another > brain that has some familiarity with the DOM to bounce ideas with. If > you are too busy never mi

Re: Can't run PyQt apps with MacPython

2009-05-15 Thread Morad
On May 15, 10:34 am, Morad wrote: > On May 13, 7:29 pm, David Boddie wrote: > > > > > On Wednesday 13 May 2009 17:53, Morad wrote: > > > > I recently got a new MacBook Pro with Leopard, and would like to > > > develop using Python and PyQt. I installed the latest Qt SDK, updated > > > MacPython t

Re: How to catch str exception?

2009-05-15 Thread MRAB
anuraguni...@yahoo.com wrote: It would be better to write your own exception class: class MyException(Exception): pass and how would i automatically inject this into 3rd part library Ah, I wasn't reading carefully enough! :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: python

2009-05-15 Thread Mike Driscoll
On May 15, 8:58 am, anica_1...@hotmail.com wrote: > hello, I´m a student of linguistic an I need do this exercises. Can > anybody help me,please? > Thanks > > ◑ Read in some text from a corpus, tokenize it, and print the list of > all wh-word types that occur. (wh-words in English are used in > que

Re: Can't run PyQt apps with MacPython

2009-05-15 Thread Morad
On May 13, 7:29 pm, David Boddie wrote: > On Wednesday 13 May 2009 17:53, Morad wrote: > > > I recently got a new MacBook Pro with Leopard, and would like to > > develop using Python and PyQt. I installed the latest Qt SDK, updated > > MacPython to V 2.5.4 and then proceeded to install SIP and PyQ

Re: How to catch str exception?

2009-05-15 Thread anuraguni...@yahoo.com
> It would be better to write your own exception class: > > class MyException(Exception): >      pass and how would i automatically inject this into 3rd part library -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch str exception?

2009-05-15 Thread MRAB
anuraguni...@yahoo.com wrote: but the whole point of catching such exception is that i can print its value there are many such exceptions and hence it is not feasible to catch them all or know them all unless i go thru src code. If string exceptions are so difficult to use, don't use them! :-)

Re: python

2009-05-15 Thread Andre Engels
We may be willing to help you with your homework, but we will not be doing it for you. Please tell us what you have got (whether it be a non-working a program, a partial program or just some ideas about what you might need to do) and what you think is stopping you from getting further. 2009/5/15

Re: How to catch str exception?

2009-05-15 Thread anuraguni...@yahoo.com
> except TypeError,e: >     print "1",e # is caught here > > 1 exceptions must be classes or instances, not str doesn't happen so in 2.5.2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Your Favorite Python Book

2009-05-15 Thread Sam Tregar
Thanks for the suggestions everyone! I've got a copy of Core Python 2nd Edition on the way. -sam -- http://mail.python.org/mailman/listinfo/python-list

python

2009-05-15 Thread anica_1069
hello, I´m a student of linguistic an I need do this exercises. Can anybody help me,please? Thanks ◑ Read in some text from a corpus, tokenize it, and print the list of all wh-word types that occur. (wh-words in English are used in questions, relative clauses and exclamations: who, which, what, a

Re: mod_python and xml.dom.minidom

2009-05-15 Thread dpapathanasiou
> Were you getting this issue with xml.dom showing on first request all > the time, or only occasionally occurring? If the latter, were you > running things in a multithreaded configuration and was the server > being loaded with lots of concurrent requests? It was the former. > For your particul

Re: DOM implementation

2009-05-15 Thread Emanuele D'Arrigo
Hey Paul, would you mind continuing this thread on Python + DOM? I'm trying to implement a DOM Events-like set of classes and I could use another brain that has some familiarity with the DOM to bounce ideas with. If you are too busy never mind. Also, I thought of keeping the discussion here rather

Re: New to python, can i ask for a little help? (Andrew Chung)

2009-05-15 Thread Gabor Urban
I gues, it was rather simple... Begin with simple tasks, figure out how to do them. If you are proceding well, then increase difficulty/complexity. Gabor -- Linux: Choice of a GNU Generation -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch str exception?

2009-05-15 Thread Dave Angel
anuraguni...@yahoo.com wrote: import sys try: raise "xxx" except str,e: print "1",e # is not caught here except:# is caught here print "2",sys.exc_type,sys.exc_value In the above code a string exception is raised which though deprecated but still a 3rd party library I use uses it. So

Re: Representing a Tree in Python

2009-05-15 Thread Jaime Fernandez del Rio
If you run Dijkstra without a third argument, i.e. without an end node, the it will compute the shortest paths from your start node to all nodes in the tree. So by doing something like: start_node = 1 end_nodes = [2,3,5] D, P = Dijkstra(G, start_node) You will then have in D a dictionary with di

Re: Your Favorite Python Book

2009-05-15 Thread Evan Kroske
Sam Tregar wrote: Greetings. I'm working on learning Python and I'm looking for good books to read. I'm almost done with Dive into Python and I liked it a lot. I found Programming Python a little dry the last time I looked at it, but I'm more motivated now so I might return to it. What's your

Re: capture stdout and stderror from within a Windows Service?

2009-05-15 Thread Tim Golden
Chris Curvey wrote: Ahhh, Blake put me on the right track. If you want any of the streams, you have to supply values for all of them, like so: p = subprocess.Popen(step, shell=True stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = p.com

Re: Just wondering

2009-05-15 Thread Peter Otten
Jaime Fernandez del Rio wrote: >> (1) building another throwaway list and >> (2) function call overhead for calling doit() >> >> You can avoid (1) by using filter() instead of map() > > Are you sure of this? > I'm afraid there is no builtin function to do an inplace modification > of a sequence

Re: File System Redirection Windows x 64 box.

2009-05-15 Thread Dave Angel
Rohit Srivastava wrote: Hi, In Windows 2003 x64, I want to call iscsicli.exe which is there only in system32 directory. Now since in x64 system windows actually redirect the 32 bit application to sysWOW64 directory, if it is looking for system32. For more information look for

Re: Just wondering

2009-05-15 Thread Bruno Desthuilliers
Gediminas Kregzde a écrit : Hello, I'm Vilnius college II degree student and last semester our teacher introduced us to python I've used to program with Delphi, so I very fast adopted to python Now I'm developing cross platform program and use huge amounts of data. Program is needed to run as f

Re: Just wondering

2009-05-15 Thread Jaime Fernandez del Rio
> (1) building another throwaway list and > (2) function call overhead for calling doit() > > You can avoid (1) by using filter() instead of map() Are you sure of this? My python returns, when asked for help(filter) : Help on built-in function filter in module __builtin__: filter(...) filter

Re: creating python code with dynamic file name

2009-05-15 Thread Dave Angel
bijoy franco wrote: hi, How can i create python code, for which filename can be defined on the fly..? for example, in a blog, when each article selected, respective python code with headline of the article as filename should be called. thanks bijoy You could have been much clearer in yo

Re: Just wondering

2009-05-15 Thread Peter Otten
Gediminas Kregzde wrote: > Now I'm developing cross platform program and use huge amounts of > data. Program is needed to run as fast as it coud. I've read all tips > about geting performance, but got 1 bug: map function is slower than > for loop for about 5 times, when using huge amounts of data.

Configure options for minimal Python 2.6

2009-05-15 Thread Andrew Malcolmson
I want to compile a minimal Python 2.6 for Debian Etch without support for optional features such as tk and sphinx. The configure script's help says that features can be disabled with an '--without-PACKAGE', so I guess disabling tk is '--without-tk', but where is there a list of the feature/packag

Re: Just wondering

2009-05-15 Thread Jaime Fernandez del Rio
map is creating a new list of 10,000,000 items, not modifying the values inside list a. That's probably where your time difference comes from... Jaime On Fri, May 15, 2009 at 1:56 PM, Gediminas Kregzde wrote: > Hello, > > I'm Vilnius college II degree student and last semester our teacher > intr

  1   2   >