Re: changing a file's permissions

2006-10-02 Thread oscartheduck
> This is an attribute of the file (an object in the filesystem) which > is checked by the kernel before allowing the file to be > executed. Python has nothing to do with this; if the attributes allow > execution, you can execute it as a program; if not, you can't. > I took this to heart and chang

regular expression concatenation with strings

2007-06-22 Thread oscartheduck
Hi folks, I have a little script that sits in a directory of images and, when ran, creates thumbnails of the images. It works fine if I call the function inside the program with something like "thumbnailer("jpg), but I want to use a regular expression instead of a plain string so that I can match

Re: regular expression concatenation with strings

2007-06-22 Thread oscartheduck
TED]> wrote: > Hi, > > oscartheduck wrote: > > I have a little script that sits in a directory of images and, when > > ran, creates thumbnails of the images. It works fine if I call the > > function inside the program with something like "thumbnailer("jpg),

Re: regular expression concatenation with strings

2007-06-22 Thread oscartheduck
ok at your code, you address implicitly by suggesting that the extension be a different variable. Thanks! On Jun 22, 3:10 pm, oscartheduck <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed a small error in the code (you referenced extension, which > you had renamed to filen

Re: regular expression concatenation with strings

2007-06-22 Thread oscartheduck
Got it: #!/usr/bin/env python from PIL import Image import glob, os, re size = 128, 128 def thumbnailer(dir, filenameRx): for picture in [ p for p in os.listdir(dir) if os.path.isfile(os.path.join( dir,p)) and filenameRx.match(p) ]: file, ext = os.path.splitext(picture) im

Re: regular expression concatenation with strings

2007-06-22 Thread oscartheduck
un 22, 4:07 pm, oscartheduck <[EMAIL PROTECTED]> wrote: > Got it: > > #!/usr/bin/env python > from PIL import Image > import glob, os, re > > size = 128, 128 > > def thumbnailer(dir, filenameRx): > for picture in [ p for p in os.listdir(dir) if >

regular expressions eliminating filenames of type foo.thumbnail.jpg

2007-06-24 Thread oscartheduck
Hi folks, I'm trying to alter a program I posted about a few days ago. It creates thumbnail images from master images. Nice and simple. To make sure I can match all variations in spelling of jpeg, and different cases, I'm using regular expressions. The code is currently: - #!/usr/bin/env

Re: regular expressions eliminating filenames of type foo.thumbnail.jpg

2007-06-25 Thread oscartheduck
I eventually went with: #!/usr/bin/env python from PIL import Image import glob, os, re size = 128, 128 def thumbnailer(dir, filenameRx): for picture in [ p for p in os.listdir(dir) if os.path.isfile(os.path.join( dir,p)) and filenameRx.match(p) if 'thumbnail' not in p]: file, ext

Re: regular expressions eliminating filenames of type foo.thumbnail.jpg

2007-06-25 Thread oscartheduck
ot used it much, has such huge leaps forwards relative to 2.2 that it's frightening thinking about where the language is going. But for now, I'm going to have to work on this problem again from scratch, it seems. On Jun 25, 3:41 pm, oscartheduck <[EMAIL PROTECTED]> wrote: > I eve

Re: I have a chance to do somting diffrent way not Python ?!

2007-04-28 Thread oscartheduck
Hi anders, try looking here first: http://docs.python.org/lib/module-os.html Also: http://sourceforge.net/projects/pywin32/ On Apr 28, 10:27 am, anders <[EMAIL PROTECTED]> wrote: > Hi! > On my work we have a lot off diffrent server to make software for > diffrent os > from Windows, OS/X to Lin

capturing system exit status

2007-04-01 Thread oscartheduck
Hi folks, in a program I'm writing I have several commands I pass to the unix OS underneath the code. I want to perform error checking to make sure that the OS commands' exit gracefully, but I'm not seeing a simple python module to do this. The closest I can see is system(), as detailed here: htt

try... except SyntaxError: unexpected EOF while parsing

2007-04-04 Thread oscartheduck
I have a small script for doing some ssh stuff for me. I could have written it as shell script, but wanted to improve my python skills some. RIght now, I'm not catching a syntax error as I'd like to. Here's my code: #!/usr/bin/env python import sys import os port = input("Please enter a port to

Re: try... except SyntaxError: unexpected EOF while parsing

2007-04-04 Thread oscartheduck
Wow. Thanks, everyone, for the responses. It helps a lot having such a well informed and helpful resource. -- http://mail.python.org/mailman/listinfo/python-list

newbie: windows xp scripting

2006-05-21 Thread oscartheduck
I've been having trouble with the following style of script. It's simple stuff, I know, but it's stumping me: import os dirfrom = 'C:\\test' dirto = 'C:\\test1\\' copy_command = 'copy "%s" "%s"' % (dirfrom, dirto) if os.system(copy_command) == 0: print "yay" else: print "boo" What's g

Re: Does anybody know how to install PythonMagick?

2006-05-21 Thread oscartheduck
What distribution are you using? -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: windows xp scripting

2006-05-21 Thread oscartheduck
It wasn't, but after seeing your success I discovered what was wrong. My destination directory didn't exist, and for some reason windows wasn't automatically creating it to dump the files in. I could fix this with a nested if statement, but it "feels" like windows should be creating this folder au

Re: newbie: windows xp scripting

2006-05-21 Thread oscartheduck
It wasn't, but after seeing your success I discovered what was wrong. My destination directory didn't exist, and for some reason windows wasn't automatically creating it to dump the files in. I could fix this with a nested if statement, but it "feels" like windows should be creating this folder au

Re: newbie: windows xp scripting

2006-05-21 Thread oscartheduck
For completeness' sake, this is the new script I came up with: import os dirfrom = 'C:\\test' dirto = 'C:\\test1\\' makedir = 'mkdir "%s"' % dirto copy_command = 'copy "%s" "%s"' % (dirfrom, dirto) if os.system(copy_command) == 0: print "yay" else: if os.system(makedir) == 0: if