推荐学习书目
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 · Sep 18, 2015 · 5448 views
    This topic created in 3894 days ago, the information mentioned may be changed or developed.
    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')
    Supplement 1  ·  Sep 19, 2015
    是管理员权限的问题,已经解决了。谢谢!
    8 replies    2017-12-14 16:58:47 +08:00
    ylhawj
        1
    ylhawj  
       Sep 19, 2015   ❤️ 1
    一般情况下,会是权限错误,

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

    嗯,跟楼主的 '\xbe\xdc.........\xa3' 对上了。
    ChiChou
        6
    ChiChou  
       Sep 19, 2015
    @zjxubinbin 不用 360 , HKLM 下很多注册表项普通账户改不了的,需要管理员
    zjxubinbin
        7
    zjxubinbin  
       Sep 19, 2015
    @ChiChou 360 也会锁注册表~
    Webpir
        8
    Webpir  
       Dec 14, 2017
    最后怎么解决的呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5960 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 06:50 · PVG 14:50 · LAX 23:50 · JFK 02:50
    ♥ Do have faith in what you're doing.