Re: [PyOpenGL-Users] [Py2exe-users] py2exe with (py)openGL
Brought to you by:
mcfletch
From: Sébastien R. <seb...@gm...> - 2008-04-17 08:53:51
|
the 2nd point is only a tips, to compile you just have to launch setup.py instead of launch something like "python setup.py py2exe" ;) Seb Astan Chee a écrit : > Thanks! > Two things I missed: > 1. The import that goes in the beginning of my script goes at the very > beginning before even before the OpenGL imports. > 2. The sys.argv.append('py2exe') in setup.py > Now it works. > Thanks alot! > > Sébastien Ramage wrote: >> this files works for me. >> >> >> Astan Chee a écrit : >>> Yeah, I have both of those. Although Im using >>> setuptools-0.6c8-py2.5.egg >>> >>> >>> >>> Sébastien Ramage wrote: >>>> Do you have put this at the beginning of you script : >>>> import sys >>>> import os >>>> sys.path.insert(0, os.path.join(sys.prefix, "PyOpenGL-3.0.0b1-py2.5.egg")) >>>> sys.path.insert(0, os.path.join(sys.prefix, "setuptools-0.6c7-py2.5.egg")) >>>> >>>> >>>> >>>> >>>> Astan Chee a écrit : >>>>> Yeah, I got them both in the .exe folder. If I didnt, wouldnt >>>>> py2exe not compile the .exe? >>>>> And yes, Im using python 2.5 >>>>> >>>>> Sébastien Ramage wrote: >>>>>> Have you copy the egg? >>>>>> you need to put PyOpenGL-3.0.0b1-py2.5.egg and >>>>>> setuptools-0.6c7-py2.5.egg in the exe folder >>>>>> many be you haven't PyOpenGL-3.0.0b1-py2.5.egg in site-packages, >>>>>> try to download it from Internet >>>>>> http://surfnet.dl.sourceforge.net/sourceforge/pyopengl/PyOpenGL-3.0.0b1-py2.5.egg >>>>>> >>>>>> (I assume you are using Python 2.5) >>>>>> >>>>>> >>>>>> Astan Chee a écrit : >>>>>>> Whops,sorry, my mistake. So many commas, Im so dizzy. >>>>>>> Anyway, now it compiles fine but when I try to run it, it gives me a >>>>>>> >>>>>>> Traceback (most recent call last): >>>>>>> File "script.py", line 1, in <module> >>>>>>> ImportError: No module named OpenGL.GL >>>>>>> >>>>>>> When I try to run the executeable. I tried to copy and paste the >>>>>>> OpenGL folder in site-packages in the python folder and it still >>>>>>> gives me the same error. >>>>>>> Any ideas? I think I have the latest version of these files. >>>>>>> Thanks again. >>>>>>> Astan >>>>>>> >>>>>>> Sébastien Ramage wrote: >>>>>>>> the error is the " , " at the end of options declaration >>>>>>>> this is correct : >>>>>>>> options = {'py2exe':{'excludes':['OpenGL'], >>>>>>>> 'packages':['ctypes','logging','weakref'], >>>>>>>> 'includes':['new','distutils.util'], >>>>>>>> 'bundle_files':1}} >>>>>>>> data_files=[("",["PyOpenGL-3.0.0b1-py2.5.egg"]), >>>>>>>> ("",["setuptools-0.6c7-py2.5.egg"]),] >>>>>>>> >>>>>>>> setup(console=["script.py"],options=options,data_files=data_files) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Astan Chee a écrit : >>>>>>>>> Thanks for that but Im not too familiar with py2exe. >>>>>>>>> This is what my setup looks like: >>>>>>>>> >>>>>>>>> #!/usr/bin/env python >>>>>>>>> from distutils.core import setup >>>>>>>>> import py2exe >>>>>>>>> >>>>>>>>> options = {'py2exe':{'excludes':['OpenGL'], >>>>>>>>> 'packages':['ctypes','logging','weakref'], >>>>>>>>> 'includes':['new','distutils.util'], >>>>>>>>> 'bundle_files':1}}, >>>>>>>>> data_files=[("",["PyOpenGL-3.0.0b1-py2.5.egg"]), >>>>>>>>> ("",["setuptools-0.6c7-py2.5.egg"]),] >>>>>>>>> >>>>>>>>> setup(console=["script.py"],options=options,data_files=data_files) >>>>>>>>> >>>>>>>>> But it gives me the error: >>>>>>>>> >>>>>>>>> Traceback (most recent call last): >>>>>>>>> File "setup.py", line 12, in <module> >>>>>>>>> >>>>>>>>> setup(console=["sol4.py"],options=options,data_files=data_files) >>>>>>>>> File "C:\Python25\lib\distutils\core.py", line 112, in setup >>>>>>>>> _setup_distribution = dist = klass(attrs) >>>>>>>>> File "C:\Python25\lib\site-packages\py2exe\__init__.py", >>>>>>>>> line 80, in __i >>>>>>>>> distutils.dist.Distribution.__init__(self, attrs) >>>>>>>>> File "C:\Python25\lib\distutils\dist.py", line 237, in __init__ >>>>>>>>> for (command, cmd_options) in options.items(): >>>>>>>>> AttributeError: 'tuple' object has no attribute 'items' >>>>>>>>> >>>>>>>>> What am I doing wrong? >>>>>>>>> Thanks again >>>>>>>>> >>>>>>>>> Sébastien Ramage wrote: >>>>>>>>>> Hi ! >>>>>>>>>> I have the same problem and it seems to be a problem with eggs. >>>>>>>>>> I have solved it by copying PyOpenGL-3.0.0b1-py2.5.egg and >>>>>>>>>> setuptools-0.6c7-py2.5.egg in my app directory >>>>>>>>>> and add this on header of my script : >>>>>>>>>> >>>>>>>>>> import sys >>>>>>>>>> import os >>>>>>>>>> sys.path.insert(0, os.path.join(sys.prefix, "PyOpenGL-3.0.0b1-py2.5.egg")) >>>>>>>>>> sys.path.insert(0, os.path.join(sys.prefix, "setuptools-0.6c7-py2.5.egg")) >>>>>>>>>> >>>>>>>>>> and add this in my setup script: >>>>>>>>>> >>>>>>>>>> options = {'py2exe':{'excludes':['OpenGL'], >>>>>>>>>> 'packages':['ctypes','logging','weakref'], >>>>>>>>>> 'includes':['new','distutils.util'], >>>>>>>>>> 'bundle_files':1}}, >>>>>>>>>> data_files=[("",["PyOpenGL-3.0.0b1-py2.5.egg"]), >>>>>>>>>> ("",["setuptools-0.6c7-py2.5.egg"]),], >>>>>>>>>> >>>>>>>>>> Seb >>>>>>>>>> >>>>>>>>>> Astan Chee a écrit : >>>>>>>>>> >>>>>>>>>>> Hi, >>>>>>>>>>> Im trying to make a .exe out of a pygame/pyopengl script using py2exe. >>>>>>>>>>> The headers of my script looks like this: >>>>>>>>>>> import sys >>>>>>>>>>> from OpenGL.GL import * >>>>>>>>>>> from OpenGL.GLU import * >>>>>>>>>>> from OpenGL.arrays import formathandler >>>>>>>>>>> formathandler.FormatHandler.chooseOutput( 'ctypesarrays' ) >>>>>>>>>>> import os, math, random >>>>>>>>>>> import pygame >>>>>>>>>>> from pygame.locals import * >>>>>>>>>>> if sys.platform == 'win32' or sys.platform == 'win64': >>>>>>>>>>> os.environ['SDL_VIDEO_CENTERED'] = '1' >>>>>>>>>>> >>>>>>>>>>> Im using py2exe 0.6.6 and pyopengl 3.0.0b1, and my setup.py file looks >>>>>>>>>>> like this: >>>>>>>>>>> >>>>>>>>>>> #!/usr/bin/env python >>>>>>>>>>> from distutils.core import setup >>>>>>>>>>> import py2exe >>>>>>>>>>> >>>>>>>>>>> setup(console=["script.py"]) >>>>>>>>>>> >>>>>>>>>>> And I can make the .exe fine, but when I try to run the .exe, I keep >>>>>>>>>>> getting this error: >>>>>>>>>>> >>>>>>>>>>> Traceback (most recent call last): >>>>>>>>>>> File "script.py", line 2, in <module> >>>>>>>>>>> File "OpenGL\GL\__init__.pyc", line 2, in <module> >>>>>>>>>>> File "OpenGL\raw\GL\__init__.pyc", line 6, in <module> >>>>>>>>>>> File "OpenGL\raw\GL\constants.pyc", line 7, in <module> >>>>>>>>>>> File "OpenGL\platform\__init__.pyc", line 57, in <module> >>>>>>>>>>> File "OpenGL\platform\__init__.pyc", line 53, in _load >>>>>>>>>>> RuntimeError: Unable to find an implementation for the 'win32' ('nt') >>>>>>>>>>> platform >>>>>>>>>>> >>>>>>>>>>> I've tried various things like copying the openGL folder to the .exe >>>>>>>>>>> folder and such, but it didnt work. What am I doing wrong here? >>>>>>>>>>> Thanks >>>>>>>>>>> Astan >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------------------- >>>>>>>>>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference >>>>>>>>>> Don't miss this year's exciting event. There's still time to save $100. >>>>>>>>>> Use priority code J8TL2D2. >>>>>>>>>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone >>>>>>>>>> _______________________________________________ >>>>>>>>>> Py2exe-users mailing list >>>>>>>>>> Py2...@li... >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/py2exe-users >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." >>>>>>>>> >>>>>>>>> <http://www.animallogic.com> >>>>>>>>> >>>>>>>>> Please think of the environment before printing this email. >>>>>>>>> >>>>>>>>> This email and any attachments may be confidential and/or >>>>>>>>> privileged. If you are not the intended recipient of this >>>>>>>>> email, you must not disclose or use the information >>>>>>>>> contained in it. Please notify the sender immediately and >>>>>>>>> delete this document if you have received it in error. We do >>>>>>>>> not guarantee this email is error or virus free. >>>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." >>>>>>> >>>>>>> <http://www.animallogic.com> >>>>>>> >>>>>>> Please think of the environment before printing this email. >>>>>>> >>>>>>> This email and any attachments may be confidential and/or >>>>>>> privileged. If you are not the intended recipient of this email, >>>>>>> you must not disclose or use the information >>>>>>> contained in it. Please notify the sender immediately and delete >>>>>>> this document if you have received it in error. We do not >>>>>>> guarantee this email is error or virus free. >>>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> ------------------------------------------------------------------------- >>>>>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference >>>>>> Don't miss this year's exciting event. There's still time to save $100. >>>>>> Use priority code J8TL2D2. >>>>>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> _______________________________________________ >>>>>> Py2exe-users mailing list >>>>>> Py2...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/py2exe-users >>>>>> >>>>> >>>>> -- >>>>> "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." >>>>> >>>>> <http://www.animallogic.com> >>>>> >>>>> Please think of the environment before printing this email. >>>>> >>>>> This email and any attachments may be confidential and/or >>>>> privileged. If you are not the intended recipient of this email, >>>>> you must not disclose or use the information >>>>> contained in it. Please notify the sender immediately and delete >>>>> this document if you have received it in error. We do not >>>>> guarantee this email is error or virus free. >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> ------------------------------------------------------------------------- >>>>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference >>>>> Don't miss this year's exciting event. There's still time to save $100. >>>>> Use priority code J8TL2D2. >>>>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone >>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> Py2exe-users mailing list >>>>> Py2...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/py2exe-users >>>>> >>> >>> -- >>> "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." >>> >>> <http://www.animallogic.com> >>> >>> Please think of the environment before printing this email. >>> >>> This email and any attachments may be confidential and/or >>> privileged. If you are not the intended recipient of this email, you >>> must not disclose or use the information >>> contained in it. Please notify the sender immediately and delete >>> this document if you have received it in error. We do not guarantee >>> this email is error or virus free. >>> > > -- > "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." > > <http://www.animallogic.com> > > Please think of the environment before printing this email. > > This email and any attachments may be confidential and/or privileged. > If you are not the intended recipient of this email, you must not > disclose or use the information > contained in it. Please notify the sender immediately and delete this > document if you have received it in error. We do not guarantee this > email is error or virus free. > |