smarnach / pyexiftool

a Python library to communicate with an instance of Phil Harvey's excellent ExifTool command-line application.
Other
270 stars 111 forks source link

OSError: [WinError 10038] An operation was attempted on something that is not a socket #26

Open AJFeng opened 5 years ago

AJFeng commented 5 years ago

When I run the test_exiftool.py

ERROR: test_get_metadata (main.TestExifTool)

Traceback (most recent call last): File "C:/Users/af3bd/Downloads/pyexiftool-master/pyexiftool-master/test/test_exiftool.py", line 67, in test_get_metadata actual_data = self.et.get_metadata_batch(source_files) File "C:\ProgramData\Anaconda3\lib\site-packages\exiftool.py", line 264, in get_metadata_batch return self.execute_json(filenames) File "C:\ProgramData\Anaconda3\lib\site-packages\exiftool.py", line 256, in execute_json return json.loads(self.execute(b"-j", params).decode("utf-8")) File "C:\ProgramData\Anaconda3\lib\site-packages\exiftool.py", line 227, in execute inputready,outputready,exceptready = select.select([fd],[],[]) OSError: [WinError 10038] An operation was attempted on something that is not a socket


Ran 4 tests in 1.850s

FAILED (errors=1)

Could any one help me with this error? Thanks.

DoZh commented 5 years ago

same problem to me

chazmorantz commented 5 years ago

I'm also hitting this error.

clemens-holleis commented 5 years ago

same here...

I manually replaced "exiftool.py" with this version here from a pull request: https://github.com/smarnach/pyexiftool/pull/25/commits/8738ae963afc784fcef76de6bcebf277a58379ab

it works for me now OS: WIN 10x64 Python: Python 3.6

I suggest to merge this change to the repository.

best regards

AJFeng commented 5 years ago

same here...

I manually replaced "exiftool.py" with this version here from a pull request: 8738ae9

it works for me now OS: WIN 10x64 Python: Python 3.6

I suggest to merge this change to the repository.

best regards

Wow, this works!!!!!!!

brandonmaul commented 5 years ago

This worked for me as well. Thank you @clemens-holleis

sylikc commented 5 years ago

So for those who had this fixed just by using one revision or another... it's because windows does not support the select() the way linux variants do.

Reference my fork commit to see what the fix is for your version of pyexiftool. There's a few floating around, but basically it's going to do the select.select() on non-windows platforms, but revert to the original code for win32 platforms https://github.com/sylikc/pyexiftool/commit/03a8595a2eafc61ac21deaa1cf5e109c6469b17c

LKirst commented 4 years ago

same here...

I manually replaced "exiftool.py" with this version here from a pull request: 8738ae9

it works for me now OS: WIN 10x64 Python: Python 3.6

I suggest to merge this change to the repository.

best regards

This solved the issue for me as well.

goocy commented 3 years ago

In case this pull request ever deviates from the main branch, you want to find %PythonDir%/lib/site-packages/exiftool.py and replace

while not output[-32:].strip().endswith(sentinel): inputready,outputready,exceptready = select.select([fd],[],[]) for i in inputready: if i == fd: output += os.read(fd, block_size)

with

while not output[-32:].strip().endswith(sentinel): if sys.platform == 'win32': # windows does not support select() for anything except sockets # https://docs.python.org/3.7/library/select.html output += os.read(fd, block_size) else: inputready,outputready,exceptready = select.select([fd],[],[]) for i in inputready: if i == fd: output += os.read(fd, block_size)

mchaptel commented 3 years ago

Same issue for me, it would be good to merge this @smarnach, even though this lib is 9 years old