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
yesq
V2EX  ›  Python

求助py程序打包exe某些模组运行问题

  •  
  •   yesq · 2012-03-15 20:07:48 +08:00 · 4537 次点击
    这是一个创建于 4396 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近学校寝室丢本非常频繁。昨晚借助google做了个自动拍照,记录ip的程序。工作正常。但是打包成exe程序后,摄像头没反应。
    摄像头模组用的VideoCapture
    打包用的PyInstaller和Py2exe

    摄像头部分代码(复制自 http://blog.csdn.net/dyx1024/article/details/7246830)
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-

    from VideoCapture import Device
    import time

    #最多保存5张抓取到的图片,超过5张,覆盖最早的那一张,依次循环
    MAX_PIC_NUM = 5

    #抓取频率,30秒抓取一次
    SLEEP_TIME_LONG = 30

    #初始化摄像头
    cam = Device(devnum=0, showVideoWindow=0)

    iNum = 0
    while True:

    #抓图
    cam.saveSnapshot(str(iNum)+ '.jpg', timestamp=3, boldfont=1, quality=75)

    #休眠一下,等待一分钟
    time.sleep(SLEEP_TIME_LONG)

    #超过5张,则覆盖之前的,否则,硬盘很快就会写满
    if iNum == MAX_PIC_NUM:
    iNum = 0
    else:
    iNum += 1
    1 条回复    1970-01-01 08:00:00 +08:00
    yesq
        1
    yesq  
    OP
       2012-03-15 20:08:55 +08:00
    谢谢各位啦
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   988 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:58 · PVG 05:58 · LAX 14:58 · JFK 17:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.