[Tutor] Trouble getting os.execl() command to work
Luke Paireepinart
rabidpoobear at gmail.com
Sun Feb 11 07:07:38 CET 2007
See my comments in-line with the rest of the e-mail.
Richard Querin wrote:
> import os
> import string
>
> # get a list of the files in the current working directory
>
> filelist = os.listdir(os.getcwd())
Ok we have a list of all the files
>
> # run through the list and convert all of them to lowercase
>
> for name in filelist:
we loop over the list
> lowered_name = string.lower(name)
> print name + " -> " + lowered_name
> os.rename (name,lowered_name)
and rename any that are not lowercase.
>
>
> # run through the list again and for all .cr2 files run
> # the exiftool command to copy the exif data from cr2 to jpg file
>
>
> for name in filelist:
oops! filelist still contains the non-normalized names of the files!
>
> #extract extension
> ext = name[-3:]
>
> if ext == 'cr2':
> jpg_dest = name[:-4]+".jpg"
> cmd_string = "/home/richard/ExifTool/exiftool -TagsFromFile "
> + name + " -exif:all " + jpg_dest
> print cmd_string #this string looks correct
> os.execl(cmd_string) #the resulting command throws an error ??
It can't find the files because of this.
HTH,
-Luke
More information about the Tutor
mailing list