I'm having a slight problem here. I've got a script (shown below) which is
run from the command line. I am converting the filenames to lowercase and
then, for each .cr2 file, I'm building a command line and running it. Seems
pretty simple. I print the resulting command line and it looks fine, but
os.execl() won't seem to execute it. It tells me "no such file or
directory". Yet I can cut and paste the printed line onto the command line
and execute it and it works fine. Am I missing something? Here's the code:


import os
import string

# get a list of the files in the current working directory

filelist = os.listdir(os.getcwd())

# run through the list and convert all of them to lowercase

for name in filelist:
   lowered_name = string.lower(name)
   print name + " -> " + lowered_name
   os.rename (name,lowered_name)


# 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:

   #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 ??
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to