Re: os.walk()

2005-02-17 Thread Dan Perl
rbt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Could someone demonstrate the correct/proper way to use os.walk() to skip certain files and folders while walking a specified path? I've read the module docs and googled to no avail and posted here about other os.walk issues,

Re: more os.walk() issues... probably user error

2005-02-16 Thread Dan Perl
rbt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] rbt wrote: This function is intended to remove unwanted files and dirs from os.walk(). It will return correctly *IF* I leave the 'for fs in fs_objects' statement out (basically leave out the entire purpose of the function).

Re: more os.walk() issues... probably user error

2005-02-16 Thread Dan Perl
rbt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] def build_clean_list(self, path): file_skip_list = ['search_results.txt'] dir_skip_list = ['dev', 'proc', 'Temporary Internet Files'] fs_objects = os.walk(path, topdown=True) ## for fs in

Re: newbie question

2005-02-10 Thread Dan Perl
Peter Hansen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: OTOH, I was thinking of saying in my previous posting that I prefer for n in range(start, 0, -1): to n = start while (n--) I think that the first form is more readable, although that may

Re: newbie question

2005-02-09 Thread Dan Perl
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello All, What is the python equivalent of the following statement? while (n--) Like other posters said, you should give more details with your question. What do you mean by equivalent? The following is *functionally* equivalent:

Re: CGI POST problem was: How to read POSTed data

2005-02-07 Thread Dan Perl
M.E.Farmer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sweet! Glad you fixed it, and documented it all! Thanks for the followups. Now the next poor soul to stumble in can get the right fix. Never know when it could be me ;) Thanks for the comments. I did indeed post the

Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Dan Perl
Almad [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I'm currently starting with Python as a language for writing websites. I must say that I'm overwhelmed by the number of choices I have (mod_python with publisher, Vampire, mps, Spyce), cgi, fcgi, Webware, Zope, Plone,

Re: python code with indention

2005-02-07 Thread Dan Perl
Xah Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is it possible to write python code without any indentation? I read just today in a tutorial that Python on the other hand, does not even allow changes in code's indentation. Maybe the author of that tutorial can help? --

Re: Confused with methods

2005-02-06 Thread Dan Perl
jfj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I don't understand. We can take a function and attach it to an object, and then call it as an instance method as long as it has at least one argument: # class A: pass def foo(x): print x A.foo = foo a=A()

Re: CGI POST problem was: How to read POSTed data

2005-02-06 Thread Dan Perl
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: how is a multipart POST request parsed by CGIHTTPServer? [...] CGIHTTPServer, on the other hand, I have never really trusted. I would suspect that fella. It turns out I was wrong thinking that the POST requests I

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
Pierre Quentel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here is an example of how to get the POST data : #def do_POST(self): #ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) #length =

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
Pierre Quentel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Pierre, I am repeating some questions I already stated in another thread, 'CGI POST problem', but do you have any opinions on how CGIHTTPServer's do_POST handles requests? It looks to me like it always expects form

Re: Python versus Perl ?

2005-02-06 Thread Dan Perl
Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snacktime [EMAIL PROTECTED] wrote: The one drawback coming from the perl world is that you don't have as many options when it comes stuff like application frameworks, and some URK -- _my_ feeling is that we have

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
Dan Perl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks, Pierre, this got me much further but I hit another stumbling block. I can see now that CGIHTTPServer writes all the header lines into os.environ and creates a subprocess for the script with os.popen2 or os.popen3

Re: How to read POSTed data

2005-02-05 Thread Dan Perl
HÃ¥kan Persson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi. I am trying to set up a simple HTTP-server but I have problems reading data that is beeing POSTed. class httpServer(BaseHTTPServer.BaseHTTPRequestHandler): def do_POST(self): input = self.rfile.read()

CGI POST problem was: How to read POSTed data

2005-02-05 Thread Dan Perl
I am piggybacking on Hakan's original posting because I am addressing the same group of people (those with good knowledge in the standard web programming modules), on a related topic. However, my question is independent of Hakan's. I have trouble getting a simple CGI script to work because it

Re: sos!

2005-02-05 Thread Dan Perl
jordan2856977 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hellow everybody! I'm from china. I'm a beginner of python. in china, python is not a fashionable language, so it's difficult to find some books about python. finally,I find a book named python how to program wrote by

Re: sos!

2005-02-05 Thread Dan Perl
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: [...] Aren't you in the wrong newsgroup? :-) Aren't you funny? -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI POST problem was: How to read POSTed data

2005-02-05 Thread Dan Perl
M.E.Farmer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan, I was wondering how you were coming with your project. I had wondered if i had missed something going the CherryPy route instead of CGI. Now I see that you have had a bit of a snag , sorry to hear that. I am glad

Re: sos!

2005-02-05 Thread Dan Perl
jordan2856977 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: [...] Aren't you in the wrong newsgroup? :-) Aren't you funny? i

Re: CGI POST problem was: How to read POSTed data

2005-02-05 Thread Dan Perl
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: how is a multipart POST request parsed by CGIHTTPServer? It isn't; the input stream containing the multipart/form-data content is passed to the CGI script, which can choose to parse it or not using any code it has

Re: advice needed for simple python web app

2005-02-04 Thread Dan Perl
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you're just trying to get a conceptual understanding of web programming, I suggest you start with cgi. Next you might want to read Philip and Alex's Guide to Web Publishing: http://philip.greenspun.com/panda/

Re: [perl-python] get web page programatically

2005-02-04 Thread Dan Perl
Xah Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] # note the line # from library_name import function_name1,function_name2... # it reads the library and import the function name # to see available functions in a module one can use dir # import urllib; print dir(urllib) After

Re: advice needed for simple python web app

2005-02-03 Thread Dan Perl
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl [EMAIL PROTECTED] writes: Basically, what I'm looking for is a web server that accepts an HTTP request and invokes a python script. But I would like a pythonic solution so a web server like Apache

Re: advice needed for simple python web app

2005-02-03 Thread Dan Perl
M.E.Farmer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am no web expert but have recently used cherrypy to 'webify' a script. It is very easy to get going and has its own server or can be run behind Apache. The only real problem I see is that the docs are still a little lite

Re: advice needed for simple python web app

2005-02-03 Thread Dan Perl
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl [EMAIL PROTECTED] writes: The application is just something I'm playing with to learn a little bit on web apps. It uses an HTML form to send an email. The form takes inputs like the From

Re: advice needed for simple python web app

2005-02-03 Thread Dan Perl
Michele Simionato [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl: The application is just something I'm playing with to learn a little bit on web apps. It uses an HTML form to send an email. The form takes inputs like the From:, To: and Subject: fields and a text

Re: advice needed for simple python web app

2005-02-03 Thread Dan Perl
Brian Beck [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From my experience, this appears to be the order from low-level to high-level interfaces: 1. mod_python: As complex as you need it to be, since you can control anything about the request response process. But more

Re: how to write a tutorial

2005-02-02 Thread Dan Perl
Xah Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] i've noticed that in Python official doc http://python.org/doc/lib/module-re.html and also How-To doc http://www.amk.ca/python/howto/regex/ both mentions the book Mastering Regular Expressions by Jeffrey Friedl. I suggest

Re: [perl-python] string pattern matching

2005-02-01 Thread Dan Perl
Perhaps someone will write a program to automatically follow up on every [perl-python] posting? The follow-up could just contain a statement like the one Daniel mentions. Obviously the program would be written in python. ;-) Any suggestions on how to implement such a program? How would it

Re: Regarding exception handling

2005-01-30 Thread Dan Perl
Aggelos I. Orfanakos [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Good point, but with your way, if s = ... # socket opens fails, then nothing will catch it. What I usually do is what I wrote above (place it below the 2nd try), and when attempting to close it, first use an if

Re: naive doc question

2005-01-29 Thread Dan Perl
Michael Hartl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] i.e., http://docs.python.org/lib/typesmapping.html If you look on the index page of the Python Library Reference (http://docs.python.org/lib/genindex.html), you will find dictionary object, which will take you exactly

Re: [perl-python] sending email

2005-01-29 Thread Dan Perl
I recommend the example in the Python Library Reference as a better example: http://www.python.org/doc/lib/SMTP-example.html. You can also find the entire description of the smtplib module in the same section (http://www.python.org/doc/lib/module-smtplib.html). Xah Lee's example is missing:

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
StepH [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] But i've prob with the 1st test : test_badFile. When I run the test, unittest say that no error is Raised. But when I run the mps2xml module with a bad file as arg., the exception is well Raised. I assume you don't actually

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
StepH [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Do you say that it's not possible to test (using unittest) if an exception is well raised if the tested code catch it ? How to solve this paradoxe ? How to automaticaly test such code ? Then you need a side-effect in catching

Re: How to test that an exception is raised ?

2005-01-28 Thread Dan Perl
StepH [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So why the assertRaises function in unittest ? My goal is to test if an exception is well raised when a bad filename is passed to the mps2xml function. It is for functions in which the exception is raised and not caught. You

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl
Xah Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] public class test { public static void main(String[] args) { String a = new String(a string); String b = new String(another one); StringBuffer c = new StringBuffer(40); c.append(a); c.append(b);

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl
Dan Perl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Actually, it can be as simple as: public class test { public static void main(String[] args) { String c = new String(a string+ another one); System.out.println(c); } } I forgot. It can be even simpler

Re: what's OOP's jargons and complexities?

2005-01-28 Thread Dan Perl
PA [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jan 29, 2005, at 01:09, Martin Ambuhl wrote: Xah Lee wrote his usual masturbatory crap: Well... I have to admit that I tremendously enjoyed such masturbatory crap (sic). Eagerly looking toward the next installment. At

Re: Talking to the wind

2005-01-27 Thread Dan Perl
Terry Reedy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey all, I have seen no evidence that XL even reads the responses that have been directed thereto. The above is like /dev/null, Why don't you ever answer the messages I keep sending to you? Terry J. Reedy According

Re: 20050126 find replace strings in file

2005-01-26 Thread Dan Perl
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I guess there is no way to check if the file opened fine? What if the filesystem or file is locked for this user/session. Pretty puny language if it cannot tell you that it cannot do what you tell it to. .. Same for the

Re: [perl-python] 20050125 standard modules

2005-01-25 Thread Dan Perl
but that such an abuse will also be prevented in the future. Thanks, Dan Perl -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050125 standard modules

2005-01-25 Thread Dan Perl
I was wrong. He is just crossposting to the newsgroups without having them as members of the group. I wish there was a good way like that to stop these daily postings! Dan Dan Perl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I sent the following feedback message to Yahoo

Re: Python 2.1 - 2.4 differences

2005-01-24 Thread Dan Perl
I'm not sure whether it's worth learning python from a book on 2.1 because of the changes that were made especially in 2.2 (see http://www.python.org/doc/2.2.1/whatsnew/, http://www.python.org/2.2.1/descrintro.html). I don't know of a specific e-book on Python although there are several good

Re: how to write a tutorial

2005-01-23 Thread Dan Perl
Xah Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] the beginning two paragraphs should be deleted. Nobody gives a shit except a few smug academicians where the author wrote it for pleasing himself. For 99% of readers, it is incomprehensible and irrelevant. the first paragraph

Re: Cookbook 2nd ed Credits

2005-01-05 Thread Dan Perl
Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Premshree Pillai [EMAIL PROTECTED] wrote: Btw, is there a comprehensive list of ALL contributors put up anywhere? Not yet -- do you think I should put it up on my website? Updating the status of the recipes on the web

Re: Cookbook 2nd ed Credits

2005-01-05 Thread Dan Perl
Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl [EMAIL PROTECTED] wrote: Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Premshree Pillai [EMAIL PROTECTED] wrote: Btw, is there a comprehensive list of ALL contributors put up

Re: [OT] Python IDE

2004-12-17 Thread Dan Perl
Fuzzyman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: Mike Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl [EMAIL PROTECTED] writes: Mike Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] A: What's the most

Re: Python IDE

2004-12-16 Thread Dan Perl
Interesting. I've never met anyone like that. If they are in high tech, they must be hardware people, otherwise how would they make a living? And I'm not sure socialists is the correct term in this case, it sounds to me more like communists. Or liberals for our friends in the US. ;-) (for

Re: Python IDE

2004-12-16 Thread Dan Perl
Mike Meyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] A: What's the most obnoxious thing on Usenet? Q: topposting. What is Jeopardy, Alex? You got your QA mixed up. So what, just because I wrote at the top of the posting you couldn't see my warning sign for the sarcasm

Re: from string to raw string

2004-12-15 Thread Dan Perl
, and codecs in the library reference and I found out more about them. I'm sure it's going to be useful. Thanks! Dan Scott David Daniels [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: Is there a way to convert a regular string to a raw string so that one could get

Re: from string to raw string

2004-12-14 Thread Dan Perl
Yeah, you're right. I got it all twisted in my mind. It's late and I must be getting tired. Thanks. Dan Brian Beck [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: Is there a way to convert a regular string to a raw string so that one could get from '\bblah

Re: Persistent objects

2004-12-12 Thread Dan Perl
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've had this recurring half-baked desire for long enough that I thought I'd post about it, even though I don't have any concrete proposals and the whole idea is fraught with hazards. Basically I wish there was a

Re: inheritance problem with 2 cooperative methods

2004-12-03 Thread Dan Perl
This is almost the same code as Greg's with the only difference being that test for configuration having been done. But the test is unnecessary. I don't see how setConfig could be invoked in the super of the base class (A), so such a test would be relevant only in subclasses, if they DO

Re: Need help on program!!!

2004-12-03 Thread Dan Perl
That was also my impression. Even the description of the problem looks like it's just copied from the assignment, so probably didn't even take the time to restate the problem in his own words. But we're speculating. Either way, this is not a normal request: I need a program to do this, plz

Re: inheritance problem with 2 cooperative methods

2004-12-02 Thread Dan Perl
Thank you very much, Greg, that does the job! Somehow I couldn't see it and I needed someone to point out to me. Dan Greg Ewing [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dan Perl wrote: So far, so good! But let's assume that I want to change the __init__ methods so