Re: [Tutor] How to make the difference between binary and t ext files ?

2009-04-04 Thread Dominique
Kent Johnson tds.net> writes: > > You might want to look at grin which has full-featured recursive > search including identifying binary files: > http://pypi.python.org/pypi/grin > > Kent > ___ > Tutor maillist - Tutor python.org > http://mail.pyth

[Tutor] Learn as You Go. Tkinter, PIL, Pmw, etc. and Toolkits--Choices

2009-04-04 Thread Wayne Watson
Title: Signature.html As I've tried to extend a 2000 line program written by someone else, I've moved through some interesting territory. I have made enough changes to the GUI and internal workings to move ahead to the real gold in making changes. I'm now turning to PIL to actually do the impor

Re: [Tutor] renumbering a sequence

2009-04-04 Thread Dave Angel
Christopher Spears wrote: I want to write a script that takes a list of images and renumbers them with a user supplied number. Here is a solution I came up while noodling around in the interpreter: >>> alist = ["frame.0001.tif","frame.0002.tif","frame.0003.tif"] >>> new_start = 5000 >>> for x i

Re: [Tutor] Append a dictionary value

2009-04-04 Thread David
Sander Sweers wrote: I do not understand what it is you want to do. Do you want to replace the old date and time with the new? If so you already do this with todo[answer] = datevalue, time. Why do you want to use setdefault? I was confused, I thought it would add another value to the key not

Re: [Tutor] renumbering a sequence

2009-04-04 Thread Kent Johnson
On Sat, Apr 4, 2009 at 3:37 PM, Christopher Spears wrote: > > I want to write a script that takes a list of images and renumbers them with > a user supplied number.  Here is a solution I came up while noodling around > in the interpreter: > alist = ["frame.0001.tif","frame.0002.tif","frame.

Re: [Tutor] How to make the difference between binary and text files ?

2009-04-04 Thread Kent Johnson
On Sat, Apr 4, 2009 at 7:07 AM, Dominique wrote: > Hello, > > I am developing a very small multi-platform app to search for a specific word > or > expression in files located in a drive or directory. > So I need to open files to search for the word. > > I read that opening a binary file as a text

Re: [Tutor] Append a dictionary value

2009-04-04 Thread Sander Sweers
2009/4/4 David : > I put together a todo program here; > http://linuxcrazy.pastebin.com/f74beaf78 > > And I am trying to add an option to edit the values which are date and time. > Below I have gotten this far but now I need some help. looks like my attempt > to use setdefault will not work. Please

Re: [Tutor] Append a dictionary value

2009-04-04 Thread David
David wrote: I put together a todo program here; http://linuxcrazy.pastebin.com/f74beaf78 And I am trying to add an option to edit the values which are date and time. Below I have gotten this far but now I need some help. looks like my attempt to use setdefault will not work. Please point me i

[Tutor] Append a dictionary value

2009-04-04 Thread David
I put together a todo program here; http://linuxcrazy.pastebin.com/f74beaf78 And I am trying to add an option to edit the values which are date and time. Below I have gotten this far but now I need some help. looks like my attempt to use setdefault will not work. Please point me in the right d

[Tutor] renumbering a sequence

2009-04-04 Thread Christopher Spears
I want to write a script that takes a list of images and renumbers them with a user supplied number. Here is a solution I came up while noodling around in the interpreter: >>> alist = ["frame.0001.tif","frame.0002.tif","frame.0003.tif"] >>> new_start = 5000 >>> for x in alist: ... name, nu

Re: [Tutor] How to make the difference between binary and text files ?

2009-04-04 Thread Senthil Kumaran
Hello Dominique, On Sat, Apr 4, 2009 at 6:07 AM, Dominique wrote: > I am developing a very small multi-platform app to search for a specific word > or > expression in files located in a drive or directory. > So I need to open files to search for the word. > > I read that opening a binary file as

[Tutor] How to make the difference between binary and text files ?

2009-04-04 Thread Dominique
Hello, I am developing a very small multi-platform app to search for a specific word or expression in files located in a drive or directory. So I need to open files to search for the word. I read that opening a binary file as a text file (open(filename, 'r')) may corrupt the file. Consequently, b

Re: [Tutor] os.popen3 > subprocess.Popen but nohup.out won't go

2009-04-04 Thread Sander Sweers
2009/4/4 Sander Sweers : Bah, of course you need to open the files writable :-( This > outfile = open('/tmp/myoutfile') > errfile = open('/tmp/myerrfile') Should be outfile = open('/tmp/myoutfile', 'w') errfile =open('/tmp/myerrfile', 'w') Greets Sander ___

Re: [Tutor] os.popen3 > subprocess.Popen but nohup.out won't go

2009-04-04 Thread Sander Sweers
2009/4/4 dave selby : > os.popen3('nohup %s/core/kmotion_hkd2.py &> /dev/null &' % kmotion_dir) > > becomes .. > > subprocess.Popen('nohup %s/core/kmotion_hkd2.py &> /dev/null &' % > kmotion_dir, shell=True) > > all is well except I now get > > nohup: appending output to `nohup.out' > > on the term

[Tutor] os.popen3 > subprocess.Popen but nohup.out won't go

2009-04-04 Thread dave selby
Hi, I have upgraded to python 2.6 and was getting depreciation warnings about os.popen3 etc so I changed over to subprocess. os.popen3('nohup %s/core/kmotion_hkd2.py &> /dev/null &' % kmotion_dir) becomes .. subprocess.Popen('nohup %s/core/kmotion_hkd2.py &> /dev/null &' % kmotion_dir, shell=Tr