I am getting Error Copying files

I have tried both:
shutil.copy(SOURCE, TRAINING) & shutil.copy(os.path.join(SOURCE, TRAINING)) and I get the error

“Error occurred while copying file.” - my code below. Any help is appreciated.

for image in training_images:
try:
shutil.copy(os.path.join(SOURCE, TRAINING))
print(“File copied successfully.”)
except:
print(“Error occurred while copying file.”)

for image in testing_images:
    try:
        shutil.copy(os.path.join(SOURCE, TESTING))
        print("File copied successfully.")
    except:
        print("Error occurred while copying file.")

I was trying to use something less basic - my issue is now fixed. I used

for image in training_images:
#shutil.copy(os.path.join(SOURCE, TRAINING))
    copyfile(os.path.join(SOURCE,image), os.path.join(TRAINING,image))
    print("File copied successfully.")

and that fixed the copy issue.

1 Like