Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > Martin Walsh wrote: >> And by the way, the '&' has special meaning >> to the webbrowser.get method -- it determines whether a >> BackgroundBrowser or GenericBrowser object is returned. > > LOL, another demerit to documentation. Agreed. But it would be more constructive to o

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > These guys have given their free time so that we can enjoy their module, > hey could have no documentation at all... > That said, my comments about documentation lacking still stand. I think the important thing here is that "these guys" is you and me. Documentation is exa

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Ricardo Aráoz wrote: > Tim Golden wrote: >> Ricardo Aráoz wrote: >>> Martin Walsh wrote: >>>> And by the way, the '&' has special meaning >>>> to the webbrowser.get method -- it determines whether a >>>> BackgroundBrows

Re: [Tutor] Selecting a browser

2007-12-04 Thread Tim Golden
Kent Johnson wrote: > Ricardo Aráoz wrote: >> Tim Golden wrote: >>> Agreed. But it would be more constructive to offer a simple >>> patch to the webbrowser docs. > > You don't even need to give a formal patch. Just write the doc change in > plain text and

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-05 Thread Tim Johnson
> ## I've been having some problems posting to this list, so this is also a kind of test: I just wrote a global lstring def lstrip(S,chars): if S.startswith(chars): return S[len(chars):] else: return S It begs for a extension o

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-05 Thread Tim Johnson
> ## I've been having some problems posting to this list, so this is also a kind of test: I just wrote a global lstring def lstrip(S,chars): if S.startswith(chars): return S[len(chars):] else: return S It begs for a extension o

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-05 Thread Tim Johnson
On Friday 30 November 2007, Eric Brunson wrote: > Tim Johnson wrote: > > Hello: > > I'm seeing some strange behavior with lstrip operating > > on string representations of *nix-style file paths > > > > Example: > >>>> s = '/home/te

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-05 Thread Tim Johnson
Trying this again. This list has not be receiving all of my emails.. == On Friday 30 November 2007, Eric Brunson wrote: > Tim Johnson wrote: > > Hello: > > I'm seeing some strange behavior with lstrip operating > > on string represen

Re: [Tutor] Problems with List Server?

2007-12-05 Thread Tim Johnson
On Monday 03 December 2007, Tim Johnson wrote: > I appear to be having a weird problem with the List Server. > At first, email sent to this address did not appear at > all. > After contacting the ML maintainers only one email from > me to this address go through. When I replied

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-05 Thread Tim Johnson
Gentlemen: There appears to still be a problem. The email below was also sent, but I do not see that it has been received. Send time was about 2 hours previous to this. (09:27:42 Alaska Standard Time) tim

Re: [Tutor] Time module

2007-12-05 Thread Tim Golden
Kent Johnson wrote: > Norman Khine wrote: >> Hello, >> I am having difficulties in converting the following to display the >> difference that has passed in hours and seconds in a nice way. >> >> from datetime import datetime >> now = datetime.now() >> posted = date >> difference = now - posted >>

Re: [Tutor] Selecting a browser

2007-12-06 Thread Tim Golden
Ricardo Aráoz wrote: > I've registered in the issue tracker, but got scared and didn't post > anything. Don't be scared: just post up what you think is wrong as clearly as possible. If you can reasonably provide a patch, do so. Otherwise, just make it clear what's going on. Even if no-one picks i

Re: [Tutor] Problems with List Server?

2007-12-06 Thread Tim Johnson
On Thursday 06 December 2007, you wrote: > It arrived. > > Since you appear to be the only one reporting the problem, perhaps it's > something on your end? It was the domain hoster. It has now been corrected. thanks tim ___ Tutor m

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-12-18 Thread Tim Michelsen
Hello, > A list comprehension will work for this. If data is a list of triples of > (year, month, volume) then this will give you a list of the 1997 triples: > > data1997 = [ item for item in data if item[0]==1997 ] I tried your code out (see below). Here is the output: [] [] [] [] [] [1990,

Re: [Tutor] Internet Bandwidth Management

2007-12-28 Thread Tim Golden
Sewqyne Olpo wrote: > Hello. I want to restrict internet conncection on windows xp > machine,sometimes to cut off the connection or to reduce the bandwidth > .. But I dont know exactly where to start and what to learn. Could you > give some hints about this? > Thanks in advance. Couple of things:

[Tutor] send file/mail to imap

2007-12-28 Thread Tim Michelsen
Hello, I have a mbox file locally on my notebook. I would like to send this file to my IMAP account using python. Does anyone know a module or tutorial which does this? I tried * IMAPClient 0.3 - http://pypi.python.org/pypi/IMAPClient/0.3 but it doesn't contain a send function. Thanks in advanc

Re: [Tutor] send file/mail to imap

2007-12-28 Thread Tim Golden
Tim Michelsen wrote: > I have a mbox file locally on my notebook. > > I would like to send this file to my IMAP account using python. Ummm. There seem to be two possible sources of confusion here. Number one is that you don't normally "send" things via IMAP, you use th

Re: [Tutor] shutils.copytree

2008-01-11 Thread Tim Golden
Kent Johnson wrote: > Tony Cappellini wrote: >> I'm using shutils for the first time, and I've un into a problem. >> The docs for copytree are pretty sparse and don't mention any problem >> situations >> >> Under WinXP, I'm trying to copy a directory tree to a USB device using >> copytree, but cop

Re: [Tutor] shutils.copytree

2008-01-11 Thread Tim Golden
Tony Cappellini wrote: >> The source for copytree says, "The destination directory must not >> already exist." I suppose that is why you have a problem but I don't >> know the specific cause. Did you get a traceback? >> >> The source also says, "Consider this example code rather than the >> ultimat

Re: [Tutor] printing format with list

2008-01-24 Thread Tim Golden
Andy Cheesman wrote: > Hi people > > Is there a way to use a list with printf formating without having to > explicitly expanding the list after the % > > e.g > > a = [1, 2, 3] > > print """ Testing > %i, %i, %i """ %(a[0], a[1], a[2]) > It looks as though string formatting on

Re: [Tutor] replacing range with xrange

2008-01-28 Thread Tim Golden
Andy Cheesman wrote: > Hi people, > > After watching a nice Google video on Python 3K, and seeing the > forthcoming removal of range, I've looked at substitution range with > xrange within my code. Direct substitution works for 90% percent of the > case (i.e. for thing in xrange(number): ),

Re: [Tutor] using os module on windows

2008-02-21 Thread Tim Michelsen
> Delete, then copy. Or use rsync instead of Python... Yes, I ended up writing a small *.bat file that uses unison for sychronization. I still do not understand why I got these permission errors when using the python script. Thanks for the help. ___

Re: [Tutor] How to open IE7 to a certain URL?

2008-02-29 Thread Tim Golden
Dick Moores wrote: > I keep missing a certain weekly program on my local NPR station. My > idea is to record it using software I have, Easy Hi-Q Recorder. I can > set it to start recording when the program starts, 8pm, but I need to > have the program playing on my computer. The URL for the stat

Re: [Tutor] How to open IE7 to a certain URL?

2008-02-29 Thread Tim Golden
Kent Johnson wrote: > Dick Moores wrote: > >> #!/usr/bin/env python >> #coding=utf-8 >> import time >> b = '20:00:00' >> while True: >> a = time.strftime('%H:%M:%S') >> time.sleep(0.5) >> if a == b: > > You might want to learn how to use your OS's scheduler to do this part. > I do

Re: [Tutor] Strange XP stdin behaviour.

2005-08-27 Thread Tim Peters
[Alan Gauld] > Thanks Danny, interesting link in that it shows a solution I > didn't know about in the one-liner at the bottom of the discussion. > > But really I was hoping someone could explain *why* there is a > difference. If PATHEXT can detect that intest.py needs to be run > through Python w

Re: [Tutor] IDEs

2005-09-14 Thread Tim Johnson
ave bitmaps for your backgroud, but of course that can be distracting, if you are (for instance) coding over the top of Mariah Carey. For Windows, the finest Shareware edit IMHO is Boxer. But if I programmed only in Python and only on windows, I'd use PythonWin. MTCW tim --

Re: [Tutor] IDEs

2005-09-14 Thread Tim Johnson
laying with JSP at the moment and am very impressed > with the open source NetBeans IDE. It would be nice if someone > modified it to work with Python! :-) > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailma

Re: [Tutor] Python Editors (particualrly Vim)

2005-09-22 Thread Tim Johnson
anguage environment mainly on Linux. *but* if I were programming only in python and doing so on Windows, I'd probably use pythonwin. I've used it in the past and was very impressed, a real python IDE. MTCW tim -- Tim Joh

[Tutor] Trying to prevent ftplib from locking my script

2005-10-04 Thread Tim Rupp
ython threading? Thanks in advance! Tim ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Struct headspinner

2005-10-12 Thread Tim Peters
[Liam Clarke] > Erm, can someone please aid me? I'm using Windows XP, haven't tested > this code on Linux yet, but, well watch this... > > '<' indicates little-endian, @ indicates native. i is an integer, Yes x 3. > q is a long. No. q in native mode is C "long long" on Linux, or "_int64" on Win

Re: [Tutor] is mxDateTime recommended?

2005-10-21 Thread Tim Peters
[Lance E Sloan] > ... > (I think it's a little too bad that the timedelta class represents all > deltas as days and seconds. And microseconds. > That must be why they don't support months, since months have > different lengths. IMHO...) That's right. It's hard to argue about what days, seconds

[Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
the next item, and that the value for the last key is the *first* key. Is there a different way to do this? Works fine for me this way, but I'm just curious about an alternative, :-) expecially if it is better. thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
ating the last one, Yes. You are correct! tj > then I'd think of a list, > and using some modulus when iterating. > Can you explain more of what you are trying to do? > > > Hugo > > Tim Johnson wrote: > > Hello: > > > > # I have the f

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Alan Gauld <[EMAIL PROTECTED]> [051028 14:05]: > Tim, > > I don;t know if theres a better way but > > > next_phases = {"open":"review","review":"write","write":"open"} > > > > Note that the value

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Andrei <[EMAIL PROTECTED]> [051028 15:57]: Andrei, I really like your approach. Will which up an object interface for it. Will have other applications, I'm sure. thanks tim > Tim Johnson wrote: > > Hello: > > > > # I have the following dictionary: > >

[Tutor] AJAX resources for Python

2005-10-28 Thread Tim Johnson
Hi All: Are AJAX resources available for python? http://en.wikipedia.org/wiki/AJAX thanks Tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/m

[Tutor] Tainted characters and CGI

2005-10-31 Thread Tim Johnson
the forseeable future, we will be running our CGI services on *nix systems. Thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Tim Johnson
won't change. Not good! I think python is the best way to learn *good* programming. MTCW tim > I'd appreciate hearing any views on this topic. My own view is that > it's always good to learn new things as you then have more tools to > use in your daily programm

Re: [Tutor] Tainted characters and CGI

2005-10-31 Thread Tim Johnson
* Ron Weidner <[EMAIL PROTECTED]> [051031 12:38]: > > > --- Tim Johnson <[EMAIL PROTECTED]> wrote: > > > Hello: > > I need to tighten my handling of CGI transmissions. > > I particular, I need to develop a strategy of safely > > dealing with &quo

Re: [Tutor] Tainted characters and CGI

2005-10-31 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051031 14:16]: > On 01/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Hello: > > I need to tighten my handling of CGI transmissions. > > I particular, I need to develop a strategy of safely dealing > > with "ta

[Tutor] iteritems() vs items()

2005-11-12 Thread Tim Johnson
members must be done in the same manner in which key/value pairs were added. I'm currently using Python 2.3.4 on both workstation and internet servers and must keep backward compatible to that venue. Thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solut

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051112 20:33]: > Tim Johnson wrote: > >I need to get up to speed on iterators. I learned python 1.5~ via > >Alan G's book ... > >For an example, I've written a subclass of dict where keys are kept in > >a ordered fashi

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051113 12:16]: > On 14/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Now if I assign a value to the iteritems method, as in > > it = s.iteritems() > > I get an object of > > and dir(it) shows that (it) has one

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051113 12:04]: > Tim Johnson wrote: > > Question: Can one subclass an iterator object? > > thanks for making this a little clearer. > > Most *classes* can be subclassed. What do you have in mind? Oh, I'm just playin

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
cs.python.org/ref/yield.html It appears that a generator, is an object, but not derived from a class, but from a generator function, using yield. > Liam Clarke-Hutchinson > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tim >

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
Well put. Got it. Thanks Kent tj * Kent Johnson <[EMAIL PROTECTED]> [051113 14:44]: > Tim Johnson wrote: > > * Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > > > >>Someone correct me if I'm wrong, but I believe there is no specific iterator

Re: [Tutor] Any TurboGears users out there?

2005-11-14 Thread Tim Johnson
s. I hope to do some testing in the next couple of days, time permitting. tj > Alan G > Author of the learn to program web tutor > http://www.freenetpages.co.uk/hp/alan.gauld > > > ___ > Tutor maillist - Tutor@python.o

[Tutor] Class Inheritance -> NameError

2005-11-30 Thread Tim Johnson
;hello') >>> s = mylib.sub() Traceback (most recent call last): File "", line 1, in ? File "mylib.py", line 1612, in __init__ val() NameError: global name 'val' is not defined ## what do I need to do to make the 'test method visible ## class &

Re: [Tutor] Class Inheritance -> NameError

2005-11-30 Thread Tim Johnson
| Do I understand that classes inherit methods, but not | | variable attributes? | -------------- Thanks: I've use inherited classes before but haven't tried

Re: [Tutor] Class Inheritance -> NameError

2005-11-30 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051130 19:21]: <..snip...> > On 01/12/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > superclass __init__ methods, or when you want to call them. So, it is > up to you to make that call. > > You can do that like this: > >

Re: [Tutor] Escaping double quotes

2005-12-07 Thread Tim Johnson
* Tim Johnson <[EMAIL PROTECTED]> [051207 15:56]: > I must be having a Senior Moment here, but the following > baffles me: > >>> label = 'this is "quoted"' > >>> label.replace('"','\"') > 'this is &qu

[Tutor] Escaping double quotes

2005-12-07 Thread Tim Johnson
I must be having a Senior Moment here, but the following baffles me: >>> label = 'this is "quoted"' >>> label.replace('"','\"') 'this is "quoted"' ## This works >>> label.replace('"&#x

Re: [Tutor] Escaping double quotes

2005-12-08 Thread Tim Johnson
all > otherwise your solution can also be done with raw strings: > > >>> label.replace('"','\\"') > 'this is \\"quoted\\"' > >>> label.replace('"',r'\"') > 'this is \\"quoted\\"' Good tip tho' I keep forgetting about raw strings. > ok, i'll stop thinking about it now. ;-) Thanks! tj > cheers, > -wesley -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] bitwise manipulation

2005-12-08 Thread Tim Johnson
made calls like set_bit(vInteger,bit_position) and unset_bit(vInteger,bit_position). Thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] bitwise manipulation

2005-12-08 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051208 16:55]: > On 09/12/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Are there any python resources available that can make setting/unsetting > > bits directly? I used to do that in "C" with preprocessor macros that

[Tutor] Introspecting class and method names

2005-12-14 Thread Tim Johnson
scope of the method? If so, how? and pointers to docs would be welcome also. thanks -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Simple XML parsing

2005-12-15 Thread Tim Wilson
ting the information. Anyone have any pointers? -Tim -- Tim Wilson Twin Cities, Minnesota, USA Educational technology guy, Linux and OS X fan, Grad. student, Daddy mailto: [EMAIL PROTECTED] aim: tis270 blog: http://technosavvy.org ___ Tutor maillist - T

Re: [Tutor] Books

2005-12-21 Thread Tim Johnson
gp/product/0735710902/qid=1135222880/sr=2-1/ref=pd_bbs_b_2_1/103-3865586-6854221?s=books&v=glance&n=283155 Foundations of Python Network Programming: http://www.amazon.com/gp/product/1590593715/qid=1135222941/sr=2-1/ref=pd_bbs_b_2_1/103-3865586-6854221?s=books&v=glance&n=

Re: [Tutor] Python RE uses DFA or NFA for string check?

2006-01-10 Thread Tim Peters
[Intercodes] > This question is just out of curiosity. I am working with this dragon book. > From what I have learnt so far, RE uses either NFA or DFA to check whether > the string is accepted or not. (Correct?) In the world of "computer science" regular expressions, yes. But the things _called_

Re: [Tutor] remove from mailing list

2006-01-28 Thread Tim Peters
[kristi holsinger] > please remove [EMAIL PROTECTED] from the mailing list! thank you This is self-service. You need to go to http://mail.python.org/mailman/listinfo/tutor and unsubscribe youself (look for the "Unsubscribe or edit options" button near the bottom of the page). _

Re: [Tutor] IDE - Editors - Python

2006-02-06 Thread Tim Johnson
uages to I program in or intend to program in? To what extent does content management matter? How many other programmers am I working with? Avoid debuggers like a plague. If someone applies for a job with us and starts talking about their proficiency in debuggers, the

Re: [Tutor] IDE - Editors - Python

2006-02-06 Thread Tim Johnson
entire Autocad Tech staff to a training session where they were trained to use Cad without the mouse. Following the session, they found that they had a 15% increase in productivity. I borrowed the tag from Danny. I probably use it a little differently than he does. Maybe I should use

Re: [Tutor] IDE - Editors - Python

2006-02-06 Thread Tim Johnson
* Danny Yoo <[EMAIL PROTECTED]> [060206 09:57]: > >Avoid debuggers like a plague. If someone applies for a job > > with us and starts talking about their proficiency in > > debuggers, the interview stops right there and we keep looking. &g

Re: [Tutor] [Python-Dev] small floating point number problem

2006-02-08 Thread Tim Peters
[Raymond Hettinger] > ... > The asymmetric handling of denormals by the atof() and ftoa() functions is > why you see a difference. A consequence of that asymmetry is the breakdown > of the expected eval(repr(f))==f invariant: Just noting that such behavior is a violation of the 754 standard for s

[Tutor] Trying a csv error

2006-02-10 Thread Tim Johnson
pt cvs._csv.Error: ## or something like this print "bad csv record, skipping " continue except StopIteration: break The problem is that python does not recognize the error objects and gives me: "'module' object has no attribute '_cs

Re: [Tutor] Trying a csv error

2006-02-10 Thread Tim Johnson
Hi Danny: Thanks! tim (who_should_have_read_the_docs) * Danny Yoo <[EMAIL PROTECTED]> [060210 13:56]: > > I'd like to do the following > > while(1): > > try: > > reader.next() ## csv object method > > except cvs._csv.Error: ## or somet

[Tutor] using popen(n) to intercept stdout

2006-02-15 Thread Tim Johnson
call another process on the same machine and capture the output of that process, assuming that the child process is writing to stdout. thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using popen(n) to intercept stdout

2006-02-15 Thread Tim Johnson
en I can trap for IOError and hand either a legal response or an error. Hope I'm still on the right track. thanks tim * Hugo González Monteverde <[EMAIL PROTECTED]> [060215 20:25]: > I also noticed that if you want to get the manpage, you will be hurt by > the interactivity of '

Re: [Tutor] html and mod_python

2006-03-23 Thread Tim Golden
[Patty] | I tried the following piece of code and got : | | "TypeError: not enough arguments for format string" | | tag = """ | | %s | | - | 0% | 10% | 20% [... snip similar lines ...] | """ % (selected_value,selected_value)

Re: [Tutor] TypeError: dict objects are unhashable

2006-03-24 Thread Tim Golden
[Ben Vinger] | I want to create a dictionary (from SQL usernames) of | the format: | accounts = { | ('psmit', '123456'): 'psmit', | ('rmatt', 'mypass'): 'rmatt', | } Although possible, this structure looks a little topsy-turvy: you're keying the dictionary on the username

Re: [Tutor] How do I monitor running processes?

2006-03-26 Thread Tim Golden
[Ars] | Is there a command that will monitor all running | processes/programs(on Windows ME)? I'd like to make a | program that makes a beep when an unrecognized process, such | as an adware program, is running. That way I'd know | immediately when one of these stealth programs not on my saf

Re: [Tutor] Authen::ACE

2006-03-26 Thread Tim Golden
[Asif Iqbal] | Does anyone know if there is any python module similar to Authen::ACE | available that I can use to authenticate against a RSA SecurID server? I don't believe there is, I'm afraid. Certainly, if a Google for python securid doesn't turn anything up, it's not likely. However, it's a

Re: [Tutor] removing file from zip archive.

2006-03-29 Thread Tim Golden
| How can we remove one file inside of a zip archive? | | I'm using this method: | | import zipfile | | ziparchive = zipfile.ZipFile('test.odt', 'r') | xmldata = ziparchive.read('content.xml') | ziparchive.close (Warning: not my area of expertise, but...) Your example

Re: [Tutor] remove not-empty directory

2006-03-30 Thread Tim Golden
[kakada] | Just a quick question again, how can I remove not-empty | directory in python? | | assumed I have the following directory: | | ( temp/a/b/ | temp/a/c/d.odt | temp/e.xml) | | I want to remove the whole temp/ directory. Look at the shutil module, and in particular at the rmtree f

Re: [Tutor] Apple Remote "Mouse"

2006-03-31 Thread Tim Golden
[Johnston Jiaa] | I recently bought a Macbook Pro from Apple. As it comes with | a remote, I thought it would be great to use it as a mouse | when not in Front Row. The fast forward button would move | the cursor to the left, the volume increase would move it up | the screen, etc and the pla

Re: [Tutor] Doctest, object references and the use of ellipses

2006-04-01 Thread Tim Peters
[Don Taylor] > I am trying to use Doctest and am having trouble using the ellipsis > feature when trying to match an object reference. > > Here is the code: > > def add_change_listener(self, listener): > ''' > > Returns list of listeners just for testing. > >>> def m

Re: [Tutor] Doctest, object references and the use of ellipses

2006-04-01 Thread Tim Peters
[Tim Peters] >> That "should work", provided there aren't differences in whitespace >> that are invisible to us in this medium. For example, if, in your >> source file, there's actually a (one or more) trailing space on your >> line of expected output,

Re: [Tutor] defined()

2006-04-03 Thread Tim Golden
[János Juhász] | I can't find the defined() function in python, so I used | | 'variable name' in dir() | | for check if the variable defined. | | >>> name = 'Joe' | >>> if 'name' in dir(): | ... print name | ... I'm not entirely sure where you'd want to use this,

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
. Kind of like hasattr() > I'm interested in what use you would make of such a thing? My business partner is a perl programmer. He uses defined() a lot, I think, I've seen it in his code I use value? a lot in rebol. I like python's in operator. Very handy ti

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
* Bob Gailer <[EMAIL PROTECTED]> [060403 17:12]: > > def defined(name): > return name in globals() > Hah! Good tip. I'll call it value() I think "language wars" are a waste of time, but I like the way that using different languages inform the programm

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
ur business partner doesn't have the line 'use strict' in their > code, then give them a good kick and tell them to use it! It's criminal > for a professonal Perl programmer not to "use strict", I'm sure he has his "stay out of jail card"

Re: [Tutor] underscore function

2006-04-13 Thread Tim Golden
[linda.s] | I got a sample code and found some | function definition looks like def _abc | There is one underscore before the function name "abc", | what does it mean? It's a convention which indicates to any user of the code (including the original developer) that the function is not intended to

Re: [Tutor] checking diagonals on a chessboard

2006-04-13 Thread Tim Peters
es a row #, col #, and diag #. > > Scratching your head over how to number the diagonals I'll leave to you. > They counted 30 diagonals, so if you come up with a different count, you > either have an original approach or have blundered somewhere. > > (Hopefully that was the k

Re: [Tutor] getting system temporary directory.

2006-04-26 Thread Tim Golden
[Keo Sophon] | Does python has any function to get a system tempdir of an OS? You want to be looking at the tempfile module (and in particular at the gettempdir). http://docs.python.org/lib/module-tempfile.html TJG This e

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Tim Golden
ython console: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import codecs >>> inFile = "in.utf8" >>> outFil

Re: [Tutor] Setting a global variable on class initialisation

2006-04-27 Thread Tim Golden
[Max Russell] | I know that overall Global variables are bad idea, however, | I have a situation where on on initialisation of a class, I | need to read in two files and then populate two lists. | The lists need to would appear to need to be outwith the | class I am working with and global. |

Re: [Tutor] Not Really Questions

2006-06-04 Thread Tim Johnson
is more productive, line for line, from my experience. But because of python's OOP engineering it, it scales better, enabling more maintainable code in larger projects. Consequently, I use python for big projects, rebol for small. """ The right tool for the righ

Re: [Tutor] bounced email

2006-06-06 Thread Tim Peters
[Kermit Rose] > My last email to you bounced. > > > Why? > > From: [EMAIL PROTECTED] > Date: 06/06/06 20:30:49 > To: [EMAIL PROTECTED] > Subject: The results of your email commands > > > The results of your email command are provided below. Attached is your > original message. > > - Unprocessed: >

Re: [Tutor] IDE for Python

2006-07-25 Thread Tim Johnson
in my own way. The trade-off is time tj > Mike > http://users.adelphia.net/~mahansen/programming/editorides.html > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor

[Tutor] Cookies with CGI

2006-07-26 Thread Tim Johnson
Hello: I'd like to set (write) and get (read) cookies on a client computer via CGI. Does python have the libraries to do this. If so, pointers to the libraries and documentation is welcomed. thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-so

Re: [Tutor] Cookies with CGI

2006-07-26 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [060726 17:49]: > Tim Johnson wrote: > > Hello: > > > > I'd like to set (write) and get (read) cookies on a client > > computer via CGI. > > > > Does python have the libraries to do this. If so, pointers

Re: [Tutor] Communicating with Win2000 runas.exe

2006-08-17 Thread Tim Golden
[Barnaby Scott] | So I'm thinking along these lines: | | import subprocess | sp = subprocess.Popen(r'C:\WINNT\SYSTEM32\runas.exe | /user:administrator | C:\Program Files\Microsoft Games\Age of Mythology\aom.exe') | #some sort of code to send the password here... | #help! I *think* -- and I'm ha

Re: [Tutor] Communicating with Win2000 runas.exe

2006-08-18 Thread Tim Golden
[Tim Golden] | > [Barnaby Scott] | > | > | So I'm thinking along these lines: | > | | > | import subprocess | > | sp = subprocess.Popen(r'C:\WINNT\SYSTEM32\runas.exe | > | /user:administrator | > | C:\Program Files\Microsoft Games\Age of Mythology\aom.exe'

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Dick Moores, computes 100 factorial as 9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864 but worries about all the trailing zeros] > Yes, I'm sure you are. I'd forgotten about all tho

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Tim Peters] >> For a fun :-) exercise, prove that the number of trailing zeroes in n! >> is the sum, from i = 1 to infinity, of n // 5**i (of course as soon as >> you reach a value of i such that n < 5**i, the quotient is 0 at that i >> and forever after). >> >

Re: [Tutor] puzzled again by decimal module

2006-08-18 Thread Tim Peters
[Tim Peters] >> You would in this case, and that would be wrong. In fp you'd get an >> approximation to the exact n * (1./5 + 1./5**2 + ...) == n/4. (use >> the rule for the sum of an infinite geometric series). For example, >> that way you'd compute that 4

Re: [Tutor] program that 'waits' for file?

2006-08-29 Thread Tim Golden
[Kay White] | I'm trying to make a program that will wait for a specific | file to be made by another program, and when that happens it | opens and modifies that file. The other program is a | commercial game that allows the player to take screenshots. | It saves the screenshots in a particula

[Tutor] Problems serving up PDF

2006-09-14 Thread Tim Johnson
understand" the file type. Does anyone have any experience with this issue? Or could anyone recommend a more appropriate place to post this question? Thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problems serving up PDF

2006-09-14 Thread Tim Johnson
* Luke Paireepinart <[EMAIL PROTECTED]> [060914 17:36]: > Tim Johnson wrote: > >Hi: > > > >This is *not* really a python problem, but :-) since this > >is such an helpful list and others may have the same issue... > > > >I have a python script whi

Re: [Tutor] Problems serving up PDF

2006-09-14 Thread Tim Johnson
ted this to a forum: One expert response reads like this: "I think that's just the way Mozilla acts." Actually, I like the way Firefox does it. Looks like we just live with the differences. thanks again tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

<    1   2   3   4   5   6   >