pybel and py2exe

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

pybel and py2exe

Fergal Duffy
Hi,

I want to create a windows executable based on python scripts, and using the pybel openbabel interface, using py2exe to budle it all up. My application works fine as a script run from the command line, but when I package it up with py2exe, it fails to run, with the following message written to the log

Traceback (most recent call last):
  File "pepgui.py", line 14, in <module>
    import pybel
  File "pybel.pyc", line 37, in <module>
  File "pybel.pyc", line 33, in _formatstodict
ValueError: need more than 1 value to unpack



My application is in a scrip file: pepgui.py, and I have written a short setup.py file to bundle it as an .exe:

from distutils.core import setup
import py2exe

opts = {"py2exe": {"dll_excludes": ["MSVCR80.dll","MSVCP80.dll"]}}

setup(options=opts, windows=['pepgui.py'])


Thanks,

Fergal Duffy


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: pybel and py2exe

Noel O'Boyle
Administrator
py2exe creates a zip file. Take a look in there. Does it contain all
of OpenBabel's DLLs and obf files?

If so, then the problem is that OpenBabel cannot find them. Try just
copying them all into the directory containing the .exe.

If you don't mind me asking, why are you interested in using py2exe?
If there's general interest in this, I could look into sorting it out.

- Noel

On 18 July 2010 16:26, Fergal Duffy <[hidden email]> wrote:

> Hi,
>
> I want to create a windows executable based on python scripts, and using the
> pybel openbabel interface, using py2exe to budle it all up. My application
> works fine as a script run from the command line, but when I package it up
> with py2exe, it fails to run, with the following message written to the log
>
> Traceback (most recent call last):
>   File "pepgui.py", line 14, in <module>
>     import pybel
>   File "pybel.pyc", line 37, in <module>
>   File "pybel.pyc", line 33, in _formatstodict
> ValueError: need more than 1 value to unpack
>
>
> My application is in a scrip file: pepgui.py, and I have written a short
> setup.py file to bundle it as an .exe:
>
> from distutils.core import setup
> import py2exe
>
> opts = {"py2exe": {"dll_excludes": ["MSVCR80.dll","MSVCP80.dll"]}}
>
> setup(options=opts, windows=['pepgui.py'])
>
> Thanks,
>
> Fergal Duffy
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: pybel and py2exe

Noel O'Boyle
Administrator
py2exe misses many of the obf files so you need to specify them
explicity with the data_files option. The following setup.py works for
me (with "python setup.py py2exe"):

import os
import glob
from distutils.core import setup

import py2exe

data_files=[(".", glob.glob(os.path.join(os.environ["BABEL_DATADIR"],
                                         "*.obf")))]

setup(name="TestScript",
      version="1.0",
      author="Noel O'Boyle",
      author_email="[hidden email]",
      console = [{'script':'simple.py'}],
      options = {'py2exe': {'dll_excludes':['MSVCP80.dll', 'MSVCR80.dll'],
                 'excludes': ["Tkconstants","Tkinter","tcl"]}},
      data_files = data_files,
      )

- Noel

On 22 July 2010 15:40, Noel O'Boyle <[hidden email]> wrote:

> py2exe creates a zip file. Take a look in there. Does it contain all
> of OpenBabel's DLLs and obf files?
>
> If so, then the problem is that OpenBabel cannot find them. Try just
> copying them all into the directory containing the .exe.
>
> If you don't mind me asking, why are you interested in using py2exe?
> If there's general interest in this, I could look into sorting it out.
>
> - Noel
>
> On 18 July 2010 16:26, Fergal Duffy <[hidden email]> wrote:
>> Hi,
>>
>> I want to create a windows executable based on python scripts, and using the
>> pybel openbabel interface, using py2exe to budle it all up. My application
>> works fine as a script run from the command line, but when I package it up
>> with py2exe, it fails to run, with the following message written to the log
>>
>> Traceback (most recent call last):
>>   File "pepgui.py", line 14, in <module>
>>     import pybel
>>   File "pybel.pyc", line 37, in <module>
>>   File "pybel.pyc", line 33, in _formatstodict
>> ValueError: need more than 1 value to unpack
>>
>>
>> My application is in a scrip file: pepgui.py, and I have written a short
>> setup.py file to bundle it as an .exe:
>>
>> from distutils.core import setup
>> import py2exe
>>
>> opts = {"py2exe": {"dll_excludes": ["MSVCR80.dll","MSVCP80.dll"]}}
>>
>> setup(options=opts, windows=['pepgui.py'])
>>
>> Thanks,
>>
>> Fergal Duffy
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss