![]() ![]() > 30 (str.join("\n", args))ĪttributeError: 'ExifTool' object has no attribute 'process' return follow ERROR using Python 3.8.10 and IPYTHON Otherwise the program will hang because the while loop inside execute() won't stop The second is that you have to decode the byte series returned by os.read(): output += os.read(fd, 4096).decode('utf-8')ĮDIT for Windows: To get this working on Windows, the sentinel need to be changed into "\r\n" The first is an additional argument to subprocess.Popen: self.process = subprocess.Popen( To get this to work in python 3 two small changes are needed. ![]() This class is written as a context manager to ensure the process is exited if you are done. ![]() Return json.loads(self.execute("-G", "-j", "-n", *filenames)) Stdin=subprocess.PIPE, stdout=subprocess.PIPE)ĭef _exit_(self, exc_type, exc_value, traceback): I also included get_metadata() to read the metadata in JSON format: import subprocessĭef _init_(self, executable="/usr/bin/exiftool"): Here's a simple class that launches an exiftool process and features an execute() method to send commands to that process. ExifTool supports JSON output, which is probably the best option for reading the metadata. You can then send commands to the process via stdin, and read the output on stdout. To avoid launching a new process for each image, you should start exiftool using the -stay_open flag. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |