V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
commoccoom
V2EX  ›  Python

用 Python win32api 打开注册表 会出现错误

  •  
  •   commoccoom · 2015-09-18 23:51:02 +08:00 · 4638 次点击
    这是一个创建于 3151 天前的主题,其中的信息可能已经有所发展或是发生改变。
    import win32api
    import win32con

    key = win32api.RegOpenKey (win32con.HKEY_LOCAL_MACHINE,'SOFTWARE\\Microsoft\\Internet Explorer',0,win32con.KEY_ALL_ACCESS )

    然后出现错误

    pywintypes.error:(5,'RegOpenKeyEx','\xbe\xdc.........\xa3')
    第 1 条附言  ·  2015-09-19 13:47:15 +08:00
    是管理员权限的问题,已经解决了。谢谢!
    8 条回复    2017-12-14 16:58:47 +08:00
    ylhawj
        1
    ylhawj  
       2015-09-19 02:30:41 +08:00   ❤️ 1
    一般情况下,会是权限错误,

    用管理员打开 CMD ,然后跑这个 python 就没有问题了。
    ChiChou
        2
    ChiChou  
       2015-09-19 08:42:22 +08:00   ❤️ 1
    5 目测是 Windows API 里权限被拒绝的错误码
    zjxubinbin
        3
    zjxubinbin  
       2015-09-19 10:56:47 +08:00
    是不是装了 360 了...
    orzfly
        4
    orzfly  
       2015-09-19 11:32:46 +08:00
    > net helpmsg 5
    Access is denied.
    orzfly
        5
    orzfly  
       2015-09-19 11:34:04 +08:00
    u"拒绝访问。".encode ("gbk") == '\xbe\xdc\xbe\xf8\xb7\xc3\xce\xca\xa1\xa3'

    嗯,跟楼主的 '\xbe\xdc.........\xa3' 对上了。
    ChiChou
        6
    ChiChou  
       2015-09-19 13:12:48 +08:00
    @zjxubinbin 不用 360 , HKLM 下很多注册表项普通账户改不了的,需要管理员
    zjxubinbin
        7
    zjxubinbin  
       2015-09-19 13:15:05 +08:00
    @ChiChou 360 也会锁注册表~
    Webpir
        8
    Webpir  
       2017-12-14 16:58:47 +08:00
    最后怎么解决的呢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2491 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:56 · PVG 15:56 · LAX 00:56 · JFK 03:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.