Re: vpython and py2exe

"家在仁和" <[email protected]>
Newsgroups gmane.comp.python.visualpython.user
Message-ID <[email protected]>
Thanks for Anton and Danid's reply.
I thought maybe I find a better solution by using "data_files" keywords in py2exe setup files.
To illustrate, I've made an example in the attachment. 
It has 2 py files:
bounce.py which from the viusal examples
###################################################
from visual import *


floor = box(length=4, height=0.5, width=4, color=color.blue)


ball = sphere(pos=(0,4,0), color=color.red)
ball.velocity = vector(0,-1,0)


dt = 0.01
while 1:
    rate(100)
    ball.pos = ball.pos + ball.velocity*dt
    if ball.y < 1:
        ball.velocity.y = -ball.velocity.y
    else:
        ball.velocity.y = ball.velocity.y - 9.8*dt
#################################################

setup_py2exe.py is the configure file for py2exe
###########################################################
#! /usr/bin/env python
#coding=utf-8
from distutils.core import setup   
import py2exe  
from glob import glob
data_files = [("Microsoft.VC90.CRT",
    glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*')),
    ("vis",glob(r'C:\Python27\Lib\site-packages\vis\*.tga'))]
 
includes = ["encodings", "encodings.*"]  
options = {"py2exe":   
            {   "skip_archive":1,
                "optimize": 2,   
                "includes": includes,   
                "bundle_files": 3,
                "dll_excludes":["MSVCP90.dll"]  
            }   
          }   
setup(      
    version = "0.1",   
    description = "Vpython example",   
    name = "HuiTao Software",   
    options = options,
    data_files = data_files,
    windows=[{"script": "bounce.py" }],            
    )  

##########################################################
 
I've test this example in my computer(XP-sp3 32bit, python 2.7, numpy1.6.1, 
vpython5.71, py2exe0.6.9). It works fine!
Yours sincerely!
                                                       T. Q.


------------------ Original ------------------
From:  "Daπid"<[email protected]>;
Date:  Tue, Sep 6, 2011 04:27 AM
To:  
Cc:  "visualpython-users"<[email protected]>; 
Subject:  Re: [Visualpython-users] vpython and py2exe

 
The problem arises when you are importing the materials, which are not
always needed. A simple but not complete workaround is to enclose the
import visual statement in a try except:

try: import visual
except IOError: pass

That will do, if you are not using materials.


2011/9/5 家在仁和 <[email protected]>:
> Hi, guys!
>     I'm a newbie with viusal. I've got the same problem about viusal and
> py2exe which has been described by
> this link:
> http://vpython.wikidot.com/forum/t-224090/vpython5-and-py2exe
> Simply speaking, the exe program which made by py2exe cannot find *.tga
> files.
> The upside link gives a solution, but not so good. Is there any more better
> solution?
> Thank you!
>                                                      Teddy Qian
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Visualpython-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/visualpython-users
>
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Visualpython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/visualpython-users



从QQ邮箱发来的超大附件

VPythonAndPy2exe.rar (  13.88 M, 2011 年 9 月 22 日 16:30 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?k=7c62613219e9179ba5e10c241736044b025254510050550018035102051b025d51004c0a0755544905520757000500575000070431223632651b155a5e58770a51321800544e534a470313320c&code=5ba2166d&t=exs_ftn_download

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev

_______________________________________________
Visualpython-users mailing list
Visualpython-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/visualpython-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.