2

我正在尝试使用winregpython 库来访问 Adob​​e 产品(Photoshop、After Effects 等)的注册表项,虽然我可以HKEY_LOCAL_MACHINE在注册表编辑器中看到子键,但 Python 似乎看不到相同的键。是否有需要更改的权限,或者我以错误的方式接近这个?

这是一个总结迄今为止结果的屏幕截图

我正在运行的代码是:

import winreg
i=0
while True:
    try:
        # self.aeKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\After Effects\\16.0")
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Adobe\Setup\Reader")

        printTest = winreg.EnumKey(key, i)
        print(printTest)
        i+=1
    except WindowsError:
        break

这导致我返回

Acrobat Distiller
Acrobat PDFMaker
Adobe AIR
Adobe ARM
CommonFiles
ExtendScript Toolkit
ExtensionManager
PDF Admin Settings
Registration
Repair
Setup

但不是

Adobe Bridge, Adobe Acrobat, After Effects,Photoshop

编辑:我目前正在运行 32 位 Python。

4

1 回答 1

2

评论中的@martineau 直击头部!我需要更改访问密钥以允许找到 64 位注册表。

import winreg
i=0
while True:
    try:
        # self.aeKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\After Effects\\16.0")
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Adobe",0, winreg.KEY_READ | winreg.KEY_WOW64_64KEY)
        assert key != None, "Key = None"
        printTest = winreg.EnumKey(key, i)
        print(printTest)
        i+=1
    except WindowsError:
        break

现在生产

Acrobat Distiller
Acrobat PDFMaker
Adobe Acrobat
Adobe Bridge
After Effects
Animate
Character Animator
CommonFiles
Dreamweaver 2020
Dreamweaver CC 2019
Identity
Licensing
Photoshop
Prelude
Premiere Pro

感谢所有的帮助!

于 2020-04-15T20:44:00.303 回答