diff --git a/PixelfedImporter.py b/PixelfedImporter.py index e432213..9384eb2 100644 --- a/PixelfedImporter.py +++ b/PixelfedImporter.py @@ -104,6 +104,8 @@ def createNewPost(access_token, url, ImageID, ImageDescription): def sendImages(Token, url, imagedir, uploadType, deleteFile): files = getImages(imagedir) + if not files: + raise ValueError("No file found.") tags = getTags("tags.txt") tagDescription = "" newFileID = "" @@ -140,5 +142,8 @@ if __name__ == "__main__": imagedir = config.get("image_path") uploadType = config.get("upload_type") deleteFile = config.get("delete_file") - - sendImages(accessToken, url, imagedir, uploadType, deleteFile) \ No newline at end of file + + try: + sendImages(accessToken, url, imagedir, uploadType, deleteFile) + except ValueError as e: + print(f"Error while uploading the image: {e}") \ No newline at end of file