> 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
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
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),
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
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
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
>
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
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
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
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
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
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
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
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
What distribution are you using?
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
18 matches
Mail list logo