[英]How to create sub key in windows Registry Using Python winreg module?
[英]How to make Python's winreg see entries in the registry that are visible in the Registry Editor for Adobe CC programs?
我正在嘗試使用 python 的winreg
庫來訪問 Adobe 產品(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。
評論中的@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
感謝所有的幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.