AttributeError:'NoneType'对象没有属性'GetDetailsOf'

问题描述 投票:0回答:1

[我希望有一种方法可以从Python 3.8中的文件(如专辑,艺术家或修改日期)中读取元数据

我尝试了StackOverflow的建议; Reading metadata with Python

Python终端的输出:

规格:Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32(在Windows 10上)

而且我正在我的下载文件夹中运行它。

Whelp!

>>> import win32com.client
>>> sh = win32com.client.gencache.EnsureDispatch('Shell.Application',0)
>>> ns = sh.NameSpace(r"directory")
>>> colnum = 0
>>> columns = []
>>> while True:
...     colname = ns.GetDetailsOf(None, colnum)
...     if not colname:
...             break
...     columns.append(colname)
...     colnum += 1
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
AttributeError: 'NoneType' object has no attribute 'GetDetailsOf'

我搜索了错误消息,但对这个确切的问题一无所获。

有人可以帮助我使此代码正常工作或找到这种方法的替代方法吗?

python attributeerror win32com
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.