[Tutor] Python persistent webserver?

2005-11-08 Thread Howard Kao
Hi all, I know the subject is confusing but I don't know how to describe what I would like to ask concisely. Basically I would like to have a program (or server or whatever) take an HTTP POST method (which contains some information, maybe even an XML file) from a client, process these

Re: [Tutor] TKinter Question

2005-11-08 Thread Michael Lange
On Tue, 08 Nov 2005 00:10:16 -0600 Rob Dowell [EMAIL PROTECTED] wrote: Just a quick TKinter question. Is it possible to have custom frames/widgets? In other words can I customize the way that the GUI looks (i.e. rounded corners on the frames, beveled/raised edges, etc.) I was just

Re: [Tutor] image

2005-11-08 Thread Shi Mu
any python module to calculate sin, cos, arctan? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python persistent webserver?

2005-11-08 Thread Kent Johnson
Howard Kao wrote: Basically I would like to have a program (or server or whatever) take an HTTP POST method (which contains some information, maybe even an XML file) from a client, process these XML/information, and then generate an XML to send back to the client. Currently the environment

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Alex Hunsley
Alan Gauld wrote: Interfaces and abstract classes - I know they don't exist per se in Python. First you need to define what you mean by the terms. Every class has an interface - it is the set of messages to which it responds. Yup, I was thinking more in terms of the Java idea, whereby

Re: [Tutor] Percentage

2005-11-08 Thread Johan Geldenhuys
Now that I have the answer (16.801), How do I round it of to 16.80 ? I only need it to be to the closest 1/100. TIA Jorge Godoy wrote: Frank Moore [EMAIL PROTECTED] writes: Johan, You could try: percentage = (42 * 250)/100 This gives the answer 105.

[Tutor] any code to draw parabola or curve?

2005-11-08 Thread Shi Mu
any code to draw parabola or curve? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] image

2005-11-08 Thread Kent Johnson
Shi Mu wrote: any python module to calculate sin, cos, arctan? The index to the Library Reference has the answer to this question... Kent -- http://www.kentsjohnson.com ___ Tutor maillist - Tutor@python.org

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Alex Hunsley
Kent Johnson wrote: Alex Hunsley wrote: Interfaces and abstract classes - I know they don't exist per se in Python. But what are the closest analogues? I've found a few examples, e.g. for an abstract class the following page has a fairly common suggestion:

[Tutor] overloading binary operator for mixed types: a no-no?

2005-11-08 Thread Alex Hunsley
I'm writing a Vector class (think Vector as in the mathematical vector)... A critical snippet is as follows: class Vector(lister.Lister): def __init__(self, *elems): # ensure that we create a list, not a tuple self.elems = list(elems) def __add__(self, other):

Re: [Tutor] any code to draw parabola or curve?

2005-11-08 Thread Alex Hunsley
Shi Mu wrote: any code to draw parabola or curve? That question is so general and vague it's either unanswerable, or very easy to answer. I'll try the 'very easy' answer: yes, there is probably code somewhere to draw a parabola or curve. Have you tried making a start on this yourself? Did

Re: [Tutor] Percentage

2005-11-08 Thread Jorge Godoy
Johan Geldenhuys [EMAIL PROTECTED] writes: Now that I have the answer (16.801), How do I round it of to 16.80 ? I only need it to be to the closest 1/100. print %.2f % 16.801 16.80 a = 16.80001 b = %.2f % a b '16.80' float(b) 16.801

Re: [Tutor] Percentage

2005-11-08 Thread Johan Geldenhuys
Thanks, that helps. Jorge Godoy wrote: Johan Geldenhuys [EMAIL PROTECTED] writes: Now that I have the answer (16.801), How do I round it of to 16.80 ? I only need it to be to the closest 1/100. print "%.2f" %

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Kent Johnson
Alex Hunsley wrote: Alan Gauld wrote: Interfaces and abstract classes - I know they don't exist per se in Python. First you need to define what you mean by the terms. Every class has an interface - it is the set of messages to which it responds. Yup, I was thinking more in terms of

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Alex Hunsley
Kent Johnson wrote: Alex Hunsley wrote: Alan Gauld wrote: Interfaces and abstract classes - I know they don't exist per se in Python. First you need to define what you mean by the terms. Every class has an interface - it is the set of messages to which it responds.

[Tutor] testing: doctest and unittest

2005-11-08 Thread Alex Hunsley
Regards testing, I've been playing with both the unittest (http://pyunit.sourceforge.net/pyunit.html) and doctest (http://docs.python.org/lib/module-doctest.html). I was wondering what peoples thoughts were on the effectiveness and convenience of one versus the other. It seems to me that

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Kent Johnson
Alex Hunsley wrote: Oh yes, I'd always reply to the list in the very least; I was really just wondering what the etiquette was concerning emails also going back to the person you're reply to directly (as well as to the list). I ask because the list is set up so that it appears replies are

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread Alex Hunsley
Kent Johnson wrote: Alex Hunsley wrote: Oh yes, I'd always reply to the list in the very least; I was really just wondering what the etiquette was concerning emails also going back to the person you're reply to directly (as well as to the list). I ask because the list is set up so that it

[Tutor] Raw image display in a GUI window

2005-11-08 Thread Marcin Komorowski
Hello, I want to use Python to do some experimentation with graphic processing/manipulation, and I am looking for a way to be able to manipulate individual pixels of the image, as well as display it in a GUI. Ideal image representation would be something of the form of a two-dimensional array

Re: [Tutor] testing: doctest and unittest

2005-11-08 Thread Colin J. Williams
Alex Hunsley wrote: Regards testing, I've been playing with both the unittest (http://pyunit.sourceforge.net/pyunit.html) and doctest (http://docs.python.org/lib/module-doctest.html). I was wondering what peoples thoughts were on the effectiveness and convenience of one versus the other. It

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Alex Hunsley
Marcin Komorowski wrote: Hello, I want to use Python to do some experimentation with graphic processing/manipulation, and I am looking for a way to be able to manipulate individual pixels of the image, as well as display it in a GUI. Ideal image representation would be something of the form

Re: [Tutor] Python and Semantic Web

2005-11-08 Thread bob
At 08:19 AM 11/8/2005, Matt Williams wrote: Dear List, Does anyone know of any python semweb tools? I'm especially interested in tools to build and handle ontologies. I've come across CWM (built by Tim BL) but not that much else. I'd be really interested in anything that can interface with a DIG

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Kent Johnson
Marcin Komorowski wrote: Hello, I want to use Python to do some experimentation with graphic processing/manipulation, and I am looking for a way to be able to manipulate individual pixels of the image, as well as display it in a GUI. Ideal image representation would be something of the

[Tutor] [OTAnn] Feedback

2005-11-08 Thread shenanigans
I was interested in getting feedback from current mail group users.We have mirrored your mail list in a new application that provides a more aggregated and safe environment which utilizes the power of broadband.Roomity.com v 1.5 is a web 2.01 community webapp. Our newest version adds broadcast

[Tutor] Who called me?

2005-11-08 Thread Bill Campbell
Is there a way in python for a method to determine its parent? In particular, I'm working with SimpleXMLRPCServer, and would like to be able to find the client_address in the routine that has been dispatched. I know that client_address is an attribute of the handler class instance, but don't

[Tutor] lists and strings

2005-11-08 Thread Mike Haft
Hello, I've been working on a problem and have now sorted most of it (thanks to some help from the list). All the ways of writing data to a file I know keep telling me that lists can't be written to the file. I'm trying to convert data from one set of files into files of a different format.

Re: [Tutor] Python and Semantic Web

2005-11-08 Thread Matt Williams
Mea Culpa, Mea Culpa, Mea Maxima Culpa (or, MCMCMMC to repeat my sin of poly-acronymony. Semantic Web - (loosely) the idea of incorporating semantic information in the WWW, so it becomes machine understandable (rather than just parsable). CWM is Tim Berners-Lee's (and others) tool to handle

Re: [Tutor] lists and strings

2005-11-08 Thread Hugo González Monteverde
Hi Mike, Converting an (almost)arbitrary object into a string is what the Pickle module does. CPickle is faster. Take a look into into it in the docs. Here's an example: import cPickle lala = [1, 2, 3, 'four', 'V'] lala [1, 2, 3, 'four', 'V'] fileo = open('lala.pkl', 'w')

Re: [Tutor] lists and strings

2005-11-08 Thread Pujo Aji
yes it is... convert list to string: L = [1,2,3] L = [str(x) for x in L] s = string.join(L,' ') print len(s) convert list to a file myF = open(namaFile,w) for s in myList[:-1]: myF.write(str(s)+\n) myF.write(str(myList[len(myList)-1])) myF.close() Cheers, pujo On 11/8/05, Mike Haft [EMAIL

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Marcin Komorowski
Thanks Alex, Do you know if I can find somewhere sample code that would, lets say, create a 100x100 image and display it? Thanks, Marcin - Original Message - From: Alex Hunsley [EMAIL PROTECTED] To: Marcin Komorowski [EMAIL PROTECTED] Cc: python-tutor tutor@python.org Sent: Tuesday,

Re: [Tutor] interfaces and abstract classes in python

2005-11-08 Thread alan . gauld
Yup, I was thinking more in terms of the Java idea, whereby an interface is declared specifically and then a class claiming to implement it causes compilation problems if it doesn't properly implement it. I guessed as much but that is an idea dreamt up by Microsoft for COM and picked up by

Re: [Tutor] overloading binary operator for mixed types: a no-no?

2005-11-08 Thread alan . gauld
Alex, I assume you've looked at NumPy? It has a bunch of math stuff written as a Python module in C. So its fast and proven correct. (Lawrence Livermore Labs wrote it I believe) It should do all the heavy lifting you need, and might even provide a full solution. Just a thought, Alan G.

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Kent Johnson
Marcin Komorowski wrote: Thanks Kent, this looks promising. Are you very familiar with the Python Imaging Library? No, I have just used it for a few small things. I know it mostly by reputation. Can I pick your brains if I have questions? Best to ask questions to the list, I will answer

Re: [Tutor] Who called me?

2005-11-08 Thread Liam Clarke-Hutchinson
I believe only by explicitly passing a reference to the parent? Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Campbell Sent: Wednesday, 9 November 2005 7:00 a.m. To: Tutor Subject: [Tutor] Who called me? Is there a way in

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread alan . gauld
I want to use Python to do some experimentation with graphic processing/manipulation, and I am looking for a way to be able to manipulate individual pixels of the image, as well as display it in a GUI. Sounds like a job for the Python Image Library - PIL. Alan G

Re: [Tutor] Who called me?

2005-11-08 Thread Kent Johnson
Bill Campbell wrote: Is there a way in python for a method to determine its parent? In particular, I'm working with SimpleXMLRPCServer, and would like to be able to find the client_address in the routine that has been dispatched. I know that client_address is an attribute of the handler

Re: [Tutor] [OTAnn] Feedback

2005-11-08 Thread Liam Clarke-Hutchinson
Oh dear. Is Web 2.01 like that whole Web 2 I've heard so much about, but better? Is it the semantic web, but not so pedantic? Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of shenanigans Sent: Wednesday, 9 November 2005 5:57

Re: [Tutor] Who called me?

2005-11-08 Thread Andrei
Bill Campbell wrote: Is there a way in python for a method to determine its parent? In particular, I'm working with SimpleXMLRPCServer, and would like to be able to find the client_address in the routine that has been dispatched. I know that client_address is an attribute of the handler

Re: [Tutor] Who called me?

2005-11-08 Thread Colin J. Williams
Liam Clarke-Hutchinson wrote: I believe only by explicitly passing a reference to the parent? Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Campbell Sent: Wednesday, 9 November 2005 7:00 a.m. To: Tutor Subject: [Tutor] Who

[Tutor] How to launch executable from a Python script??

2005-11-08 Thread Chris Irish
Hello all :) I made a GUI app with pyGTK that I want to be able to launch a game I've downloaded from the pygame website when a button is clicked. I was able to do this on a linux box since the file was a .py file, but I'm not sure how to do it on a windows box since the file is an

Re: [Tutor] [OTAnn] Feedback

2005-11-08 Thread Danny Yoo
On Wed, 9 Nov 2005, Liam Clarke-Hutchinson wrote: Is Web 2.01 like that whole Web 2 I've heard so much about, but better? Is it the semantic web, but not so pedantic? That was bad, and the first spam I've seen on the list in a while. I'm blocking this joker off the mailing list now.

Re: [Tutor] Who called me?

2005-11-08 Thread Kent Johnson
Kent Johnson wrote: Bill Campbell wrote: Is there a way in python for a method to determine its parent? In particular, I'm working with SimpleXMLRPCServer, and would like to be able to find the client_address in the routine that has been dispatched. I know that client_address is an attribute

Re: [Tutor] lists and strings

2005-11-08 Thread Shantanoo Mahajan
+++ Hugo Gonz?lez Monteverde [08-11-05 13:13 -0600]: | Hi Mike, | | Converting an (almost)arbitrary object into a string is what the Pickle module does. CPickle is faster. Take | a look into into it in the docs. | Is there a way to dump the varialble in XML format and retrive it? e.g. a=this

Re: [Tutor] lists and strings

2005-11-08 Thread Christopher Arndt
Shantanoo Mahajan schrieb: +++ Hugo Gonz?lez Monteverde [08-11-05 13:13 -0600]: | Hi Mike, | | Converting an (almost)arbitrary object into a string is what the Pickle module does. CPickle is faster. Take | a look into into it in the docs. | Is there a way to dump the varialble in XML

Re: [Tutor] lists and strings

2005-11-08 Thread Kent Johnson
Mike Haft wrote: All the ways of writing data to a file I know keep telling me that lists can't be written to the file. I'm trying to convert data from one set of files into files of a different format. But the easiest way to get the data from the first set of files is in a list(s). So, is

[Tutor] TKinter Question

2005-11-08 Thread John Fouhy
On 08/11/05, Rob Dowell [EMAIL PROTECTED] wrote: Just a quick TKinter question. Is it possible to have custom frames/widgets? In other words can I customize the way that the GUI looks (i.e. rounded corners on the frames, beveled/raised edges, etc.) I was just wondering if it was possible and

Re: [Tutor] TKinter Question

2005-11-08 Thread Danny Yoo
On 08/11/05, Rob Dowell [EMAIL PROTECTED] wrote: Just a quick TKinter question. Is it possible to have custom frames/widgets? In other words can I customize the way that the GUI looks (i.e. rounded corners on the frames, beveled/raised edges, etc.) I was just wondering if it was

Re: [Tutor] How to launch executable from a Python script??

2005-11-08 Thread Pujo Aji
Try to add .py in PATHEXT environment windows XP After that, you can call your python program just like you call exe file. Hope this help. pujo On 11/8/05, Chris Irish [EMAIL PROTECTED] wrote: Hello all :)I made a GUI app with pyGTK that I want to be able to launch a game I'vedownloaded from the

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Alex Hunsley
Kent Johnson wrote: Marcin Komorowski wrote: Thanks Kent, this looks promising. Are you very familiar with the Python Imaging Library? No, I have just used it for a few small things. I know it mostly by reputation. Can I pick your brains if I have questions? Best to ask

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread Alex Hunsley
Alex Hunsley wrote: Marcin Komorowski wrote: Hello, I want to use Python to do some experimentation with graphic processing/manipulation, and I am looking for a way to be able to manipulate individual pixels of the image, as well as display it in a GUI. Ideal image representation

Re: [Tutor] overloading binary operator for mixed types: a no-no?

2005-11-08 Thread Alex Hunsley
[EMAIL PROTECTED] wrote: Alex, I assume you've looked at NumPy? Yup, I'm aware of it and it would do the job just fine (and faster too, probably). However, I'm happy writing my own code (+tests) for the moment - I'm getting more experience of writing stuff in Python. I may switch to NumPy

Re: [Tutor] testing: doctest and unittest

2005-11-08 Thread Alex Hunsley
Colin J. Williams wrote: Alex Hunsley wrote: Regards testing, I've been playing with both the unittest (http://pyunit.sourceforge.net/pyunit.html) and doctest (http://docs.python.org/lib/module-doctest.html). I was wondering what peoples thoughts were on the effectiveness and convenience

[Tutor] Video

2005-11-08 Thread Eric Walker
I would like to do some testing of video streams from say a vcr tape. Possibly using the PVR type capture card. Maybe modules to control it.. or some info on how I can control it through C/C++ and link those functions into python. Are there any python user groups or modules that could help me

[Tutor] Testing for gui

2005-11-08 Thread Ken Stevens
How does one test for a running gui in python? Thanks, Ken -- A journey of a thousand miles starts under one's feet. -- Lao Tsu ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Testing for gui

2005-11-08 Thread Liam Clarke-Hutchinson
Hi Ken, How do you mean? I assume you're referring to a non-Windows environment? In Linux, I'd imagine that using os.popen(ps) would do it. Cheers, Liam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ken Stevens Sent: Wednesday, 9 November 2005

Re: [Tutor] Testing for gui

2005-11-08 Thread Liam Clarke-Hutchinson
Hmm, no x-server. If you're looking to detect running Python GUI packages, you could check the namespaces for 'em, but beyond that, I'm stumped. -Original Message- From: Ken Stevens [mailto:[EMAIL PROTECTED] Sent: Wednesday, 9 November 2005 1:23 p.m. To: Liam Clarke-Hutchinson Subject:

Re: [Tutor] Testing for gui

2005-11-08 Thread John Fouhy
From: Ken Stevens [mailto:[EMAIL PROTECTED] Yes. Under Linux no x-server running? I guess it really wouldn't be applicable under a windows enviroment, although I would like my code to be transportable. Just under a MS windows enviroment it would always be a gui environment. What happens if

[Tutor] Using debuglevel with urllib2?

2005-11-08 Thread Terry Carroll
With urllib, you can set httplib.HTTPConnection.debuglevel to see the HTTP conversation. But it doesn't work with urllib2. Can someone explain how to use it in conjunction with urllib2? Longer story: debuuglevel is a nice debug tool that lets you see the client-server HTTP conversation:

Re: [Tutor] Raw image display in a GUI window

2005-11-08 Thread R. Alan Monroe
Marcin Komorowski wrote: Thanks Kent, this looks promising. Are you very familiar with the Python Imaging Library? No, I have just used it for a few small things. I know it mostly by reputation. Somewhat related question: Why isn't PIL in the standard library? Alan

Re: [Tutor] testing: doctest and unittest

2005-11-08 Thread Kent Johnson
Alex Hunsley wrote: Regards testing, I've been playing with both the unittest (http://pyunit.sourceforge.net/pyunit.html) and doctest (http://docs.python.org/lib/module-doctest.html). I was wondering what peoples thoughts were on the effectiveness and convenience of one versus the other.

[Tutor] Spanish text in BS problem

2005-11-08 Thread Ismael Garrido
Hello I'm using Beautiful Soup to scrape a site (that's in Spanish) I sometimes come across strings like: 'Ner\\xf3n como cantor' Which gets printed: Ner\xf3n como cantor When they should be: Nerón como cantor I don't know if it is my fault (due to me misusing BS) or is it a BS fault.

Re: [Tutor] Using debuglevel with urllib2?

2005-11-08 Thread Kent Johnson
Terry Carroll wrote: With urllib, you can set httplib.HTTPConnection.debuglevel to see the HTTP conversation. But it doesn't work with urllib2. Can someone explain how to use it in conjunction with urllib2? You have to create your own HTTPHandler, set it to debug and install it in

[Tutor] Problem appending to a list using a property within a class

2005-11-08 Thread Roy Bleasdale
I have created a List within a class. If I try and append to the list using the set function using the property value my variable stops being a list. Can anyone explain why the set function called by the class property does not append to the list? Here is some sample code: class ShoppingBag:

[Tutor] Find multiple lines in a file

2005-11-08 Thread Bill Burns
I have a PostScript file which contains the following lines (the numbers are for reference only and are *not* in the file): 1 2 /Policies 3 /PageSize 3 4 5 setpagedevice These lines never change and are always formatted like this (at least in the PostScript files that I'm generating

Re: [Tutor] Problem appending to a list using a property within a class

2005-11-08 Thread John Fouhy
On 09/11/05, Roy Bleasdale [EMAIL PROTECTED] wrote: I have created a List within a class. If I try and append to the list using the set function using the property value my variable stops being a list. Can anyone explain why the set function called by the class property does not append to the

Re: [Tutor] Using debuglevel with urllib2?

2005-11-08 Thread Terry Carroll
On Tue, 8 Nov 2005, Kent Johnson wrote: You have to create your own HTTPHandler, set it to debug and install it in urllib2. Like this: Thanks, Kent! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Video

2005-11-08 Thread Eric Walker
no takrs on this one? --- Eric Walker [EMAIL PROTECTED] wrote: I would like to do some testing of video streams from say a vcr tape. Possibly using the PVR type capture card. Maybe modules to control it.. or some info on how I can control it through C/C++ and link those functions into

Re: [Tutor] Video

2005-11-08 Thread Danny Yoo
On Tue, 8 Nov 2005, Eric Walker wrote: I would like to do some testing of video streams from say a vcr tape. Possibly using the PVR type capture card. Maybe modules to control it.. or some info on how I can control it through C/C++ and link those functions into python. Are there any python