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

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

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

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

Re: newbie question

2005-02-09 Thread Dan Perl
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > Dan Perl <[EMAIL PROTECTED]> wrote: > . > . > . >>has the conciseness of the C statement. The pre- and post-increment >>and -de

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

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

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

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

2005-02-06 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > CGIHTTPServer, on the other hand, I have never really trusted. I would > suspect that fella. CGIHTTPServer wasn't the culprit after all, it was os.py. See bug report "[ 1100235 ] Scripts started with CGIHTTPServer: missing cgi envir

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

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 w

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 expe

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 = int(self.headers.getheader('content

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 w

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

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 choos

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

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 a

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

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

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 import # 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 about a month, this tutorial has finally r

Re: advice needed for simple python web app

2005-02-04 Thread Dan Perl
"Paul Rubin" 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

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 m

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

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

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

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 woul

advice needed for simple python web app

2005-02-03 Thread Dan Perl
I have a pretty simple python script and I would like to turn it into a web application but web apps are a domain I know very little about. I know that Twisted, CherryPy, Plone and Zope exist but not exactly what they do. I need only advice on a direction to take. For instance a suggestion on

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.

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 de

Re: How do you do arrays

2005-02-01 Thread Dan Perl
A solution that I haven't seen mentioned by other postings in the thread is to implement the array as a dictionary: iMatrix = {} for index in range(majorlop1): k = random.choice(listvalues) + 1 iMatrix[index] = k Mind you, a dictionary does not behave *exactly* like an array. For insta

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 a

Re: Regarding exception handling

2005-01-30 Thread Dan Perl
"Bryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > IMO, that is not the reason for the try/finally statement and it is not > redundant. the try/finally statement guarantees the resource is closed > and the try/finally statement only gets executed if and only if the > openin

Re: Regarding exception handling

2005-01-30 Thread Dan Perl
"Aggelos I. Orfanakos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks. This should now be OK: > > #try: > #try: > #s = ... # socket opens > # > ## various code ... > #except socket.error, x: > ## exception handling > #finally: > #s.close()

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

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 insta

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"); >S

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); > System.out.pri

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

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 ca

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 ac

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

Re: exclude binary files from os.walk

2005-01-26 Thread Dan Perl
"rbt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to exclude binary files (I'm working on Windows XP) > from the file list returned by os.walk()? > > Also, when reading files and you're unsure as to whether or not they are > ascii or binary, I've always th

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 t

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 feedba

Re: [perl-python] 20050125 standard modules

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

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 o

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 p

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

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

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

Re: Python IDE

2004-12-16 Thread Dan Perl
"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 m

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 Q&A mixed up. So what, just because I wrote at the top of the posting you couldn't see my warning sign for the sarca

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. ;-)

Re: from string to raw string

2004-12-15 Thread Dan Perl
ncode, 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 re

from string to raw string

2004-12-14 Thread Dan Perl
Is there a way to convert a regular string to a raw string so that one could get from '\bblah' to r'\bblah' other than parsing the string and modifying the escapes? I am interested in this for the use of regular expressions. I would like to be able to accept re patterns as inputs either from a

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 st

Re: Persistent objects

2004-12-12 Thread Dan Perl
"Paul Rubin" 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

Re: dictionary initialization

2004-12-09 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Dan > > I must confess that upon rereading my words, there is some irony there > (but not really sarcasm, is there?). However, I *really* tried to keep > my tone, well, professional. I realise I didn't do a good job and > apologise

Re: Need help on program!!!

2004-12-03 Thread Dan Perl
"Miklós P" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Dan Perl" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> >> "Hopefully" for whom? For us, who may have to work with him someday or &

Re: Need help on program!!!

2004-12-03 Thread Dan Perl
"Max M" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hopefully his teacher doesn't know about Google, or he can be expelled > from school for using it. "Hopefully" for whom? For us, who may have to work with him someday or use a product that he developed? Most of us here hav

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 h

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 invoke

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

inheritance problem with 2 cooperative methods

2004-12-02 Thread Dan Perl
Here is a problem I am having trouble with and I hope someone in this group will suggest a solution. First, some code that works. 3 classes that are derived from each other (A->B->C), each one implementing only 2 methods, __init__ and setConfig.