Re: [Tutor] adding a watermark to a sequence of images

2008-07-21 Thread Terry Carroll
On Mon, 21 Jul 2008, Christopher Spears wrote: > By all means, share your script! Even if I don't use it, I can learn > something from it! Well, maybe. If nothing else, perhaps you'll learn some new bad habits. The timestamp on this file shows that I dropped this project in June 2005, and you

[Tutor] question about socket status

2008-07-21 Thread Rupp, Romaine
Hello, I am new to programming with python and sockets. I would like to determine the status of a socket as it is returned when you do 'netstat -a | grep '. I would like to know if the socket state is ESTABLISHED, LISTEN , CLOSE_WAIT, etc. Is there a way to get this information through a socke

Re: [Tutor] Raw string

2008-07-21 Thread Mark Tolonen
"Neven Gorsic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mon, Jul 21, 2008 at 9:44 AM, Monika Jisswel <[EMAIL PROTECTED]> wrote: instead of s='e:\mm tests\1. exp files\5.MOC-1012.exp' try to use : s = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace( '\\', '') for m

Re: [Tutor] Online class/education for Python?

2008-07-21 Thread Alan Gauld
"Danyelle Gragsone" <[EMAIL PROTECTED]> wrote I have the first edition of Python Programming for the Absolute Beginner. Will this work instead of the 2nd edition? Python changes little and slowly between versions so the answer is almost certainly yes. New features are by definition major and

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Dick Moores
At 01:42 PM 7/21/2008, Terry Carroll wrote: On Mon, 21 Jul 2008, Daniel Sarmiento wrote: > What about the following function? > > if x == 0: > return False > return True I don't like it, myself. You have multiple points of exit, and, yes, you can see that the fallthough is only executed if

Re: [Tutor] Tkinter Help

2008-07-21 Thread Alan Gauld
"Ruivaldo Neto" <[EMAIL PROTECTED]> wrote I have a Python app that runs as a Windows Service. Inside this application, there is a Thread that starts a webservice. When this webservice is called, this thread displays a simple Tkinter window with some entry´s for input. Thats usually a very ba

Re: [Tutor] adding a watermark to a sequence of images

2008-07-21 Thread Christopher Spears
By all means, share your script! Even if I don't use it, I can learn something from it! Thanks! --- On Mon, 7/21/08, Terry Carroll <[EMAIL PROTECTED]> wrote: > From: Terry Carroll <[EMAIL PROTECTED]> > Subject: Re: [Tutor] adding a watermark to a sequence of images > To: [EMAIL PROTECTED], tut

Re: [Tutor] Configuration File Pattern

2008-07-21 Thread Daniele
> What I use in this situation is the INI config file parser in the > standard lib. It's easy to use > > http://docs.python.org/lib/module-ConfigParser.html > Awesome! Really easy and intuitive. Thanks a lot ___ Tutor maillist - Tutor@python.org http:

Re: [Tutor] Tkinter Help

2008-07-21 Thread arsyed
On Mon, Jul 21, 2008 at 1:59 PM, Ruivaldo Neto <[EMAIL PROTECTED]> wrote: > Hi, > > I have a Python app that runs as a Windows Service. Inside this > application, there is a Thread that starts a webservice. > When this webservice is called, this thread displays a simple Tkinter > window with some

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Terry Carroll
On Mon, 21 Jul 2008, Daniel Sarmiento wrote: > What about the following function? > > if x == 0: > return False > return True I don't like it, myself. You have multiple points of exit, and, yes, you can see that the fallthough is only executed if the condition is not met, but it makes you

Re: [Tutor] adding a watermark to a sequence of images

2008-07-21 Thread Terry Carroll
On Sun, 20 Jul 2008, Christopher Spears wrote: > Has anyone used Python to watermark of sequence of images? There's a recipe for watermarking using PIL here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 I have a half-baked program that goes through a directory of images and t

Re: [Tutor] Online class/education for Python?

2008-07-21 Thread Danyelle Gragsone
Hi, I have the first edition of Python Programming for the Absolute Beginner. Will this work instead of the 2nd edition? thanks, Danyelle ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Online class/education for Python?

2008-07-21 Thread Dave Kuhlman
On Sun, Jul 20, 2008 at 09:17:51PM -0400, bhaaluu wrote: > > If you're disciplined enough to shell out $$$ for an online class > and do the work, why not just do it on your own? The tuition for > a class will buy you several very nice Python books: > > Learning Python. Lutz. > Programming Python.

Re: [Tutor] Configuration File Pattern

2008-07-21 Thread Lie Ryan
> Message: 9 > Date: Mon, 21 Jul 2008 16:08:45 +0200 > From: Daniele <[EMAIL PROTECTED]> > Subject: [Tutor] Configuration File Pattern > To: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=UTF-8 > > Hi list, > I've recently developed a basic python

Re: [Tutor] Raw string

2008-07-21 Thread Lie Ryan
> Thanks, > I am aware of goodies that raw string offers, but my question was > how to use it with variable that already contains string. :) If you really have to, you may use something like this: # Untested def kludge(s): s = 'r"""%s"""' % repr(s) return eval(s) Most people would fr

[Tutor] Tkinter Help

2008-07-21 Thread Ruivaldo Neto
Hi, I have a Python app that runs as a Windows Service. Inside this application, there is a Thread that starts a webservice. When this webservice is called, this thread displays a simple Tkinter window with some entry´s for input. But the mainloop simple stays running without presenting any popup

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Marc Tompkins
On Mon, Jul 21, 2008 at 10:20 AM, Daniel Sarmiento <[EMAIL PROTECTED]> wrote: > What about the following function? > > if x == 0: >return False > return True > > > I am a beginner, but I think it is more clear (at least to me) what > the function does. And it is only one line longer than > > v

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Marc Tompkins
On Mon, Jul 21, 2008 at 10:29 AM, Marc Tompkins <[EMAIL PROTECTED]> wrote: > > How about > >> return (x!=0) >> > ? > > Short and cryptic! > Sorry - I had deleted all the old messages in the thread, and only responded to the latest. My bad - I see now that I've joined in beating a dead horse. -

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Daniel Sarmiento
What about the following function? if x == 0: return False return True I am a beginner, but I think it is more clear (at least to me) what the function does. And it is only one line longer than value = (x != 0) return value ___ Tutor maillist -

Re: [Tutor] Configuration File Pattern

2008-07-21 Thread Chad Crabtree
What I use in this situation is the INI config file parser in the standard lib. It's easy to use ##CONFIG FILE [paths] images=/home/user/Images ##CODE### import ConfigParser config=ConfigParser.ConfigParser() config.readfp(open(conf,'r')) print config http://docs.python.org/lib/module-Con

[Tutor] Configuration File Pattern

2008-07-21 Thread Daniele
Hi list, I've recently developed a basic python program which needs to store some data in a file (e.g. a directory path). What the program needs is a dictionary containing the data, so I used the pickle module to store the dictionary in a file and read it back when the program is launched. I wanted

Re: [Tutor] seaxtradusa site

2008-07-21 Thread Kirk Bailey
BTW, wordwrap issue, all that is on ONE LINE. Kirk Bailey wrote: ok, here is the link; http://www.seaxtradusa.org/ In the footer of all webppages (not in the wiki or in the forum), is a link so i can edit pages on the site without bothering to use a shell account or upload pages or anything. I

[Tutor] seaxtradusa site

2008-07-21 Thread Kirk Bailey
ok, here is the link; http://www.seaxtradusa.org/ In the footer of all webppages (not in the wiki or in the forum), is a link so i can edit pages on the site without bothering to use a shell account or upload pages or anything. I just wrote this, and it is password protected. This is a handy l

Re: [Tutor] Raw string

2008-07-21 Thread Neven Goršić
2008/7/21 Martin Walsh <[EMAIL PROTECTED]>: > Neven Goršić wrote: >> I read from one file plenty of parameters and among them one file name >> of other file. >> That file name is 'e:\mm tests\1. exp files\5.MOC-1012.exp' and I hold >> it in variable s. > > As John pointed out, if you're really read

Re: [Tutor] List installed python modules

2008-07-21 Thread Tim Golden
Eli Brosh wrote: Hello, Is there a way to get a list of installed python modules and their versions ? i.e. I would like to know if matplotlib is installed on my computer and what version is it. And so with other modules. You've got two slightly different requirements there: 1) List all mod

Re: [Tutor] Raw string

2008-07-21 Thread Monika Jisswel
> > I don't know in advance what the file name will be... import re for line in myfile: if re.search(r'\', line): line = line.replace('\\', '') if you have lines that contain a \ in them that you don't want to substitute then you need another if statement. ___

Re: [Tutor] Raw string

2008-07-21 Thread Martin Walsh
Neven Goršić wrote: > I read from one file plenty of parameters and among them one file name > of other file. > That file name is 'e:\mm tests\1. exp files\5.MOC-1012.exp' and I hold > it in variable s. As John pointed out, if you're really reading this string from a file (with something like file

[Tutor] List installed python modules

2008-07-21 Thread Eli Brosh
Hello, Is there a way to get a list of installed python modules and their versions ? i.e. I would like to know if matplotlib is installed on my computer and what version is it. And so with other modules. Thanks Eli ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Import modeuls

2008-07-21 Thread Kent Johnson
On Mon, Jul 21, 2008 at 5:15 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > They want me to do one test runner which runs any test... And ideally it > should work on any platform You might want to look at nose or py.test, they both have test runners. I think you can give nose a directory and it w

Re: [Tutor] Raw string

2008-07-21 Thread Monika Jisswel
> > Thanks, > I am aware of goodies that raw string offers, but my question was how to > use it with variable that already contains string. :) > if you are reading the value from a file : import re for line in myfile: if re.search(r'e:\mm tests\1. exp files\5.MOC-1012.exp', line): l

Re: [Tutor] Import modeuls

2008-07-21 Thread arsyed
On Mon, Jul 21, 2008 at 5:15 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > They want me to do one test runner which runs any test... And ideally it > should work on any platform > > When I added something to $PYTHONPATH, they told me to remove it... > > You can set environment variables within p

Re: [Tutor] Import modeuls

2008-07-21 Thread Oleg Oltar
They want me to do one test runner which runs any test... And ideally it should work on any platform When I added something to $PYTHONPATH, they told me to remove it... On Mon, Jul 21, 2008 at 12:11 PM, arsyed <[EMAIL PROTECTED]> wrote: > On Mon, Jul 21, 2008 at 4:46 AM, Oleg Oltar <[EMAIL

Re: [Tutor] Raw string

2008-07-21 Thread Neven Goršić
On Mon, Jul 21, 2008 at 9:44 AM, Monika Jisswel <[EMAIL PROTECTED]> wrote: > instead of s='e:\mm tests\1. exp files\5.MOC-1012.exp' > try to use : s = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace( > '\\', '') > for me here is what it gives: > s = r'e:\mm tests\1. exp files\5.MOC-101

Re: [Tutor] Import modeuls

2008-07-21 Thread arsyed
On Mon, Jul 21, 2008 at 3:46 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > If I am adding, __init__.py it still doesn't import anything. > Do I have add the import (from sampletest import EmailWithoutA) in my init > file? > > I didn't notice this before, but I don't think python does tilde expansio

Re: [Tutor] Import modeuls

2008-07-21 Thread Oleg Oltar
If I am adding, __init__.py it still doesn't import anything. Do I have add the import (from sampletest import EmailWithoutA) in my init file? On Mon, Jul 21, 2008 at 1:28 AM, arsyed <[EMAIL PROTECTED]> wrote: > On Sun, Jul 20, 2008 at 12:46 PM, Oleg Oltar <[EMAIL PROTECTED]> > wrote: > >> Hi >>

Re: [Tutor] Raw string

2008-07-21 Thread Monika Jisswel
instead of s='e:\mm tests\1. exp files\5.MOC-1012.exp' try to use : s = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace('\\', '') for me here is what it gives: >>> s = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace('\\', '') >>> print s e:\\mm tests\\1. exp files\\5.MOC-1012.exp >>