You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple program to read system keywords from a jpg file.
import pythoncom
from win32com.propsys import propsys
from win32com.shell import shellcon
import sys
def readTags(imgf_path):
# get PROPERTYKEY for "System.Keywords"
pk = propsys.PSGetPropertyKeyFromName("System.Keywords")
# get property store for a given shell item (here a file)
ps = propsys.SHGetPropertyStoreFromParsingName(imgf_path, None, shellcon.GPS_READWRITE, propsys.IID_IPropertyStore)
# read & print existing (or not) property value, System.Keywords type is an array of string
keywords = ps.GetValue(pk).GetValue()
return keywords
if __name__ == '__main__':
print(readTags(sys.argv[1]))
(env) C:\Users\user\source\repos\Test>python test.py "D:\FaceDb\Friends\images\friends (1).jpg"
Traceback (most recent call last):
File "C:\Users\user\source\repos\Test\test.py", line 1, in
import pythoncom
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\pythoncom.py", line 2, in
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'
Did you install pywin32 in your virtual environment and are you sure that when calling python it's using the executable in your venv?
I'm asking because
(env) C:\Users\user\source\repos\Test>python -c "import pywintypes,pythoncom;print(pywintypes.file,pythoncom.file,sep='\n')"
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'pywintypes'
Steps to reproduce the problem
Simple program to read system keywords from a jpg file.
Works great!
Create & activate virtual environment.
Fails.
Deactivate virtual environment, all is good.
Python version and distribution:
pywin32 version:
Installed from PyPI or exe installer:
Windows Version:
DLL locations:
The text was updated successfully, but these errors were encountered: