[Tutor] installers and more

2007-03-05 Thread Kirk Bailey
1. Installers. Apps which are hard to install do not get installed. MiniWiki is now fit for public display and use, but it still takes the geek nature to install it. I need to become expert with one of the free installers to turn it into something a business executive would be willing to downlo

Re: [Tutor] Quicktime in python

2007-03-05 Thread Alan Gauld
"Ashok Nayar" <[EMAIL PROTECTED]> wrote >I need a little help. I'm trying to learn how to manipulate > Quicktimes through python. Are you on a Mac? If so MacPyhon includes bindings for manipulating QT media. They are pretty low level and I've never used them so I can't tell you much more t

[Tutor] Quicktime in python

2007-03-05 Thread Ashok Nayar
I need a little help. I'm trying to learn how to manipulate Quicktimes through python. I want to be able to set up a grid of quicktime movies and be able to resize them all to a consistent width and height so it's all neat and tidy. I have found very little documentation regarding quicktim

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-05 Thread Rikard Bosnjakovic
On 3/6/07, zannah marsh <[EMAIL PROTECTED]> wrote: > step through them as you would in an array or list. so i had this: > for i in word1 > if word1[i] == word2[i]... For this construction to work in Python, you use the range()-function. for index in range(len(word1)): Say word1 i

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-05 Thread Rikard Bosnjakovic
On 3/6/07, zannah marsh <[EMAIL PROTECTED]> wrote: > thanks Rikard, that makes sense. No problems, but please post answers to the list and not to my mail adress. This list is braindead that doesn't use a reply-to-tag for the posts, but we've had that debate already so there's no need for another.

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-05 Thread Rikard Bosnjakovic
On 3/6/07, zannah marsh <[EMAIL PROTECTED]> wrote: > if item == item in word2: #checks characters against each other Here's the error. Loop variable "item" contains the actual character in word1. The syntax "item in word2" checks if this character is _anywhere_ in word2. What you want to

[Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-05 Thread zannah marsh
I am very new to Python (I've been learning it for about 2 weeks, in a class). I wrote this function ( as part of a larger program, for my homework) which is supposed to step through two given strings and check for differences between the strings. It returns a list of the indices at which the char

Re: [Tutor] Tutor Digest, Vol 37, Issue 15

2007-03-05 Thread learner404
On 3/5/07, Tony Cappellini <[EMAIL PROTECTED]> wrote: Rename your file from .py to .pyw. This will prevent the DOS window from appearing It's not the DOS window from the Python script I was talking about (in my mail I said "my python script is launched with pythonw") but the one resulting fr

Re: [Tutor] executing a string representing python code

2007-03-05 Thread ALAN GAULD
> That's neat. When just the function call is the string, > eval() seems appropriate. (For example, if reading what > function to call from a file.) Its conventient but incredibly dangerous. Its much better in that case to create a dictionary of allowed (ie safe!) functions that can vbe read and

Re: [Tutor] Tutor Digest, Vol 37, Issue 15

2007-03-05 Thread Tony Cappellini
Rename your file from .py to .pyw. This will prevent the DOS window from appearing Message: 6 Date: Mon, 5 Mar 2007 16:51:42 +0100 From: learner404 <[EMAIL PROTECTED]> Subject: [Tutor] Hiding/Killing a DOS window (from a previous os.system call) To: "Tutor Python" Message-ID: <[EMAI

Re: [Tutor] executing a string representing python code

2007-03-05 Thread Cecilia Alm
That's neat. When just the function call is the string, eval() seems appropriate. (For example, if reading what function to call from a file.) def some_func(val): return val s = eval('some_func("that\'s also pretty cool")') s "that's also pretty cool" At any rate, thanks for the response

Re: [Tutor] Hiding/Killing a DOS window (from a previous os.system call)

2007-03-05 Thread learner404
Thanks a lot Alan ! both solutions work like a charm :) On 3/5/07, Alan Gauld <[EMAIL PROTECTED]> wrote: "learner404" <[EMAIL PROTECTED]> wrote > I'm launching an external app through an os.system() or os.popen() > but I > don't want the resulting DOS window to hang-on there forever Try us

Re: [Tutor] Hiding/Killing a DOS window (from a previous os.system call)

2007-03-05 Thread Alan Gauld
"learner404" <[EMAIL PROTECTED]> wrote > I'm launching an external app through an os.system() or os.popen() > but I > don't want the resulting DOS window to hang-on there forever Try using os.spawnl() instead: >>> pid = os.spawnl(os.P_NOWAIT,r'C:\Windows\System32\notepad.exe') >>> print pid 28

Re: [Tutor] help me to do my exercise

2007-03-05 Thread Alan Gauld
"Vasile Filat" <[EMAIL PROTECTED]> wrote > I just started learning Python from a book translated intro > Russian. It is my first exercise from the book and I don't > know why it is not working. OK, First please send the code as text rather than as an image. It makes it much easier to comment when

Re: [Tutor] executing a string representing python code

2007-03-05 Thread Alan Gauld
"Cecilia Alm" <[EMAIL PROTECTED]> wrote > Thanks, Adam. I guess the exec would be exec("some_func"). > The result seems pretty similar to eval(), allthough eval() seems > more > straight-forward if the aim is to assign the returned value ("Done") > to a > variable. s = eval('some_func("was

Re: [Tutor] help me to do my exercise

2007-03-05 Thread Eric Walstad
In addition to what the others have said, you have a syntax error on line 7 of your leap.py file. The 'for' loop will want an iterable to loop over. The syntax error relates to the list you are trying to use, a slice of sys.argv. Remember, lists are denoted by square brackets '[' and ']'.

[Tutor] Hiding/Killing a DOS window (from a previous os.system call)

2007-03-05 Thread learner404
Hello, I'm launching an external app through an os.system() or os.popen() but I don't want the resulting DOS window to hang-on there forever (my python script is launched with pythonw): I use a sys.exit() to kill the script who launched the external app.Thepython script is killed, the app is laun

[Tutor] Fwd: executing a string representing python code

2007-03-05 Thread Cecilia Alm
Thanks, Adam. I guess the exec would be exec("some_func"). The result seems pretty similar to eval(), allthough eval() seems more straight-forward if the aim is to assign the returned value ("Done") to a variable. eval('some_func("wasn\'t that cool")') Hello World wasn't that cool 'Done' in ot

Re: [Tutor] help me to do my exercise

2007-03-05 Thread Christopher Arndt
Vasile Filat schrieb: > Help me please to correct my code which I will include below. It is customary to include code examples either inline in your message or attach them as a plain text source code file. Some mailing list frown on attachments in general (but this one doesn't, to my knowledge), b

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
Thanks Kent, I think I've hacked my way around this but it's a little weird. Simplest to demonstrate with code (assuming cStringIO and tarfile are imported and my_tarfile_string & archive_member_name are specified): __ #approach 1 filelike=cStringIO.StringIO(my_tarfile_string) tar = tarfile.open(

Re: [Tutor] help me to do my exercise

2007-03-05 Thread Rikard Bosnjakovic
On 3/5/07, Vasile Filat <[EMAIL PROTECTED]> wrote: > I just started learning Python from a book translated intro Russian. It is my > first exercise from the book and I don't know why it is not working. Help me > please to correct my code which I will include below. You need to tell us why it's

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Kent Johnson
Barton David wrote: > Thanks Kent, > > But.. I've actually found that that doesn't work (raises a ReadError), > and neither does.. tf=tarfile.open(mode="r|*",fileobj=filelike) > ..which raises "AttributeError: _Stream instance has no attribute > 'dbuf'" > > However if I explicitly state the

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
Thanks Kent, But.. I've actually found that that doesn't work (raises a ReadError), and neither does.. >>>tf=tarfile.open(mode="r|*",fileobj=filelike) ..which raises "AttributeError: _Stream instance has no attribute 'dbuf'" However if I explicitly state the compression type.. e.g. >>>tf=tarfile.

[Tutor] executing a string representing python code

2007-03-05 Thread Adam Pridgen
here's the magic you are looking for: func_str = \ ''' def some_func(value): # youwould check value instance here and do something to it print "Hello World", value return "Done" ''' exec(func_str) f = locals()["some_func"] print f("wasn't that cool!") When you exec the str, it will create