Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-04 Thread Dustin J. Mitchell
[EMAIL PROTECTED] wrote: > 1. What's involved in a port of a C program into Python? (drawmap is > offered in a number of linux distributions btw.) It really (really) depends on the C program -- C's so flexible that you can write in a "Pythonish" style (specifically, avoiding pointer tricks, kee

Re: [Tutor] time(duration) formats & basic time math query

2006-07-05 Thread Dustin J. Mitchell
kevin parks wrote: > I have been handed a huge number of documents which have hundreds of > pages of times and durations, all calculated and notated by several > different people over the course of many years. Sadly, no made any > guidelines at all about how this work would proceed and all th

Re: [Tutor] How can I copy files recursively?

2006-07-10 Thread Dustin J. Mitchell
Richard Querin wrote: > I know this is probably a dumb question: > > I've got mp3 files that are downloaded (by ipodder) into individual > subfolders. I'd like to write a quick script to move (not copy) all the > mp3 files in those folders into a single destination folder. I was > thinking I could

Re: [Tutor] question about headers and smtplib

2006-07-31 Thread Dustin J. Mitchell
shawn bright wrote: > the only difference in one from the other is that in the headers of the > other app (not my python script) > there exist the following lines: > > MIME-Version: 1.0 > X-Mailer: OstroSoft SMTP Control (4.0.20) > Content-Type: text/plain; charset="us-ascii" > Content-Transfer-En

Re: [Tutor] Python for basic web-testing

2006-08-06 Thread Dustin J. Mitchell
Hans Dushanthakumar wrote: > Hi, >How do I use python for basic web-tasks like inputting data or > clicking buttons on web-pages. For eg, how do I enter my username and > password and click on the "OK" button on the yahoo mail page? > I had a look at the webbrowser module documentation > (http:

Re: [Tutor] Syntax Error? Variable Scope?

2006-11-02 Thread Dustin J. Mitchell
Chuck Coker wrote: > from net.grinder.script import Test > from net.grinder.script.Grinder import grinder > from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest > from HTTPClient import NVPair > connectionDefaults = HTTPPluginControl.getConnectionDefaults() > httpUtilities = HTTPPlugi

Re: [Tutor] Two Questions...(i) Checking for None (ii) Making commandline arguments mutually exclusive

2006-11-04 Thread Dustin J. Mitchell
> if x == None > > As simple as that. In fact, I think the following is even a little more readable: if x is None and in fact that syntax has some advantages in various corner cases. It's largely a matter of preference. Dustin ___ Tutor maillist

Re: [Tutor] A question abt exception handling

2006-11-04 Thread Dustin J. Mitchell
import traceback try: something_funny() except: traceback.print_exc() should do the trick for you. Dustin ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me to debug this script .. I tried but ....

2006-11-05 Thread Dustin J. Mitchell
Asrarahmed Kadri wrote: > "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", > line 310, in RunScript > exec codeObject in __main__.__dict__ > File "C:\project stuff-programs\Scriptdate.py", line 18, in ? > t1 = my_version_datecheck.dateCheck(dt1,0) > File "my_ver

Re: [Tutor] Encoding and XML troubles

2006-11-05 Thread Dustin J. Mitchell
For what it's worth, the vast majority of the XML out there (especially if you're parsing RSS feeds, etc.) is written by monkeys and is totally ill-formed. It seems the days of 'it looked OK in my browser' are still here. To find out if it's your app or the XML, you could try running the XML thro

Re: [Tutor] Help me to debug this script .. I tried but ....

2006-11-05 Thread Dustin J. Mitchell
Kent Johnson wrote: > Dustin J. Mitchell wrote: >> Asrarahmed Kadri wrote: >>> "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", >>> line 310, in RunScript >>> exec codeObject in __main__.__dict__ >>> File