Re: [Tutor] How does this work?

2007-02-07 Thread Alan Gauld
Tony Cappellini [EMAIL PROTECTED] wrote I saw a snippet of python which is used to execute another python script, and I'm trying to understand the mechanism. Simple as it is, I don't understand how it works :-) Danny has explained that it is evil and shouldn't be used but here goes on the

Re: [Tutor] get cpu time used by a python script

2007-02-07 Thread Alan Gauld
Kim Branson [EMAIL PROTECTED] wrote whats the simplest cross platform way of getting the cpu time used by a python script? Does the os.times() function give you enough? Its not strictly cpu time... Alan G. ___ Tutor maillist -

Re: [Tutor] How does this work?

2007-02-07 Thread Kent Johnson
Tony Cappellini wrote: I saw a snippet of python which is used to execute another python script, and I'm trying to understand the mechanism. Simple as it is, I don't understand how it works :-) A few more points missed by Danny and Alan. Not to be taken as an endorsement of this strategy...

Re: [Tutor] get cpu time used by a python script

2007-02-07 Thread Kent Johnson
Kim Branson wrote: Hi Chris, that seems to be exactly what i need. The resource module is Unix-only, not cross-platform as you originally requested. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] I m trying to understand why we need Co-routines

2007-02-07 Thread anil maran
Hello Yesterday I spoke to an employee of yahoo egroups and he was explaining that they used coroutines to send mails in egroups because each thread was 2mb in size... Can you point me to resources on how to use co-routines in python or if you have code samples it would be great thanks Anil

[Tutor] python books

2007-02-07 Thread govind goyal
Hi, I want to purchase a python book but confused of which authur?I need suggestion. How is Teach yoursef python in 24 hours by Ivan van laningham? Regards, Govind ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python books

2007-02-07 Thread Kent Johnson
govind goyal wrote: Hi, I want to purchase a python book but confused of which authur?I need suggestion. How is Teach yoursef python in 24 hours by Ivan van laningham? Do you have any programming background or is Python your first programming language? Kent

[Tutor] python24dll not found

2007-02-07 Thread Chris Hallman
My apologies if this isn't the correct forum for such a question, however I was having a problem with Python and couldn't find the cause. I have two systems running Python. My laptop and a server: laptop: WinXP SP2 x86 Python 2.5 pymssql 0.8.0 (for 2.5) pywin32-210 (for 2.5) server: Win2003 no

Re: [Tutor] python books

2007-02-07 Thread Kent Johnson
govind goyal wrote: hi, In regards to programming language I know C,C++ and little of perl syntax. Learning Python is good for people with some programming background. Dive into Python is popular but IMO it focuses too much on flashy features and not enough on the basics. Beginning Python

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
PS To import a file whose name is in a variable (string), see __import__(). I've started doing the import instead of exec/eval , but the person who wrote the module being called, started using the logging module. Now I can't capture the output of the module I'm calling, and display it in a GUI.

Re: [Tutor] Input from and output to a file

2007-02-07 Thread Kent Johnson
govind goyal wrote: hi, 1) I want to read data not from STDIN but from a file which is in specified directory. 2) I want to redirect my output(which is by default STDOUT) to a file. Can anybody suggest these queries? One way to redirect stdin and stdout is just to do it on the

Re: [Tutor] How does this work?

2007-02-07 Thread Kent Johnson
Tony Cappellini wrote: PS To import a file whose name is in a variable (string), see __import__(). I've started doing the import instead of exec/eval , but the person who wrote the module being called, started using the logging module. Now I can't capture the output of the module I'm

Re: [Tutor] python24dll not found

2007-02-07 Thread Tim Golden
[... snip slightly complex problem involving different versions of Python and possibly mismatched module imports ...] Now all my programs, including the new one, are working again. I have no clue what caused this. I've searched Google but I can't find a hit similar to my configuration and

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
If I understand you, you have a python cmdline app that does something useful. You have users who aren't comfortable with the command line, so you are writing a GUI wrapper that calls the cmdline app with popen(). That is correct A better approach is to turn the functional part of the cmdline

[Tutor] same output on diferent sys.stdout.encodings

2007-02-07 Thread Paulino
Hi everyone! I have some strings that include special characters, to be displayed in widget labels ( PyQt4 ). The output changes in diferent OS's due to diferent sys.stdout encoding Not only the labels in the GUI change, but the source file strings are altered when I move from win to linux and

Re: [Tutor] How does this work?

2007-02-07 Thread Luke Paireepinart
Tony Cappellini wrote: If I understand you, you have a python cmdline app that does something useful. You have users who aren't comfortable with the command line, so you are writing a GUI wrapper that calls the cmdline app with popen(). That is correct A better approach is to turn

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
The application needs to be rewritten if this is true. The author's implementation is not logical, regardless- I won't ask him to do this, it's just the way it is. I don't know why it was written this way. if I'm inferring correctly that he knows there are other apps depending on this. Yes

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
You should be able to make the logging module work with you, it is very flexible. You should hook into the logging module. Write a custom handler that pushes log methods into your GUI. Add the handler to the root logger. The cmd line app already uses the logging module- this is where the

Re: [Tutor] How does this work?

2007-02-07 Thread Kent Johnson
Tony Cappellini wrote: You should be able to make the logging module work with you, it is very flexible. You should hook into the logging module. Write a custom handler that pushes log methods into your GUI. Add the handler to the root logger. The cmd line app already uses the logging

[Tutor] What should go in a module?

2007-02-07 Thread Don Taylor
I am looking for advice on module size. When I first came upon Python my initial thought was to package very closely-related things into modules. Modules would be small, and may contain a single class or function. An application would consist of lots of modules. Now I am wondering if this is

Re: [Tutor] How does this work?

2007-02-07 Thread Roel Schroeven
Tony Cappellini schreef: However, the problem now is more of an issue with the recent use of the logging module in the target app, and not being able to capture it's output, even though it is displayed on the screen. I don't know a lot about the logging module, but doesn't it send its output

[Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Tim Johnson
Nope, I'm not criticizing the writing or the technical info at... Just the sloppy publishing. I ordered the Reference Manual for Version 2.5 and got Version 2.3 instead. Reason, they have the same ISBN. The vendor said that this is very unusual. This should be corrected, don't you think?

Re: [Tutor] How does this work?

2007-02-07 Thread Kent Johnson
Kent Johnson wrote: You should be able to make the logging module work with you, it is very flexible. You should hook into the logging module. Write a custom handler that pushes log methods into your GUI. Add the handler to the root logger. Here is a simple, working example of this. It

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Bob Gailer
Tim Johnson wrote: Nope, I'm not criticizing the writing or the technical info at... Just the sloppy publishing. I ordered the Reference Manual for Version 2.5 and got Version 2.3 instead. Reason, they have the same ISBN. The vendor said that this is very unusual. This should be

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
Thanks. I'm not using wx, but that doesn't matter. I'll see if there's some way I can get the author to let me pass in the logging handler to his main. On 2/7/07, Kent Johnson [EMAIL PROTECTED] wrote: Kent Johnson wrote: You should be able to make the logging module work with you, it is very

Re: [Tutor] I m trying to understand why we need Co-routines

2007-02-07 Thread Alan Gauld
anil maran [EMAIL PROTECTED] wrote Yesterday I spoke to an employee of yahoo egroups and he was explaining that they used coroutines to send mails in egroups because each thread was 2mb in size... Can you point me to resources on how to use co-routines in python or if you have code samples

[Tutor] min max confusion

2007-02-07 Thread frank h.
hello all here is a disturbing session with min() and max() for which I have absolutely no explanation t = (952L, 945L, 941L, 939L, 949L, 972L, 956L, 965L, 973L, 965L) min(t) 939L max(t) exceptions.TypeError Traceback (most recent call last) TypeError: 'int'

Re: [Tutor] python books

2007-02-07 Thread Alan Gauld
govind goyal [EMAIL PROTECTED] wrote I want to purchase a python book but confused of which authur? I need suggestion. How is Teach yoursef python in 24 hours by Ivan van laningham? Its aimed at the beginning programmer with no knowlege of other programming languages. It is based on the very

Re: [Tutor] min max confusion

2007-02-07 Thread frank h.
:-)) turns out I found the problem: max was a local integer variable in my namespace. as such it was obviously not callable On 2/7/07, frank h. [EMAIL PROTECTED] wrote: hello all here is a disturbing session with min() and max() for which I have absolutely no explanation t = (952L, 945L,

Re: [Tutor] What should go in a module?

2007-02-07 Thread Alan Gauld
Don Taylor [EMAIL PROTECTED] wrote I am looking for advice on module size. There is no absolute answer to this. When I first came upon Python my initial thought was to package very closely-related things into modules. Modules would be small, and may contain a single class or function. An

Re: [Tutor] python books

2007-02-07 Thread Terry Carroll
On Wed, 7 Feb 2007, Alan Gauld wrote: And if you are interested in Mayan calendars and Python it's essential reading. I think this should be nominated for QOTW. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Bob Gailer
Tim Johnson wrote: Nope, I'm not criticizing the writing or the technical info at... Just the sloppy publishing. I ordered the Reference Manual for Version 2.5 and got Version 2.3 instead. Reason, they have the same ISBN. The vendor said that this is very unusual. According to

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Tim Johnson
On Thursday 08 February 2007 01:50 am, Bob Gailer wrote: libraries, universities, wholesalers and distributors. IMHO the revision should be considered a new edition therefore have a new ISBN. Right on! Hopefully this gets to someone with some contact with the publisher. thanks tj -- Tim

Re: [Tutor] What should go in a module?

2007-02-07 Thread Rikard Bosnjakovic
On 2/8/07, Alan Gauld [EMAIL PROTECTED] wrote: I am really just asking about applications here, not libraries or frameworks. The same rules apply. A module is a library in Python terms. I think he meant that he's developing applications only. -- - Rikard.

Re: [Tutor] min max confusion

2007-02-07 Thread János Juhász
Hi Frank, From: frank h. [EMAIL PROTECTED] Subject: [Tutor] min max confusion t = (952L, 945L, 941L, 939L, 949L, 972L, 956L, 965L, 973L, 965L) min(t) 939L max(t) exceptions.TypeError Traceback (most recent call last) TypeError: 'int' object is not