[mext] how to package with py2exe.

31 views
Skip to first unread message

Reguillo

unread,
Sep 3, 2010, 5:23:58 AM9/3/10
to Better Python
I have been trying to package a program that uses mext.reaction with
py2exe.
py2exe becomes a module of distutils.
py2exe uses a mf.py module for finding packages.

In the setup.py file, I tried several things to get mext imported by
the mf.py module.
But it was not totally succesfull.
Adding the line "import mext" to the setup.py doesn't seem to matter.

When adding the line "sys.path.append("C:\Python26\Lib\site-packages
\Reaction-0.2.2-py2.6")" to
setup.py, it seems to find all the modules, but when trying to run the
program it gives an error saying "ImportError: No module named const".


Any suggestions about how to package with py2exe?

Sergey Schetinin

unread,
Sep 3, 2010, 5:27:34 AM9/3/10
to better...@googlegroups.com
Try searching for namespace packages recipes on py2exe wiki, that should help.

BTW, what app are you trying to package?

> --
> Mailing list: http://groups.google.com/group/better-python
> Unsubscribe: better-pytho...@googlegroups.com

--
Best Regards,
Sergey Schetinin

http://self.maluke.com/ -- My articles and open-source stuff
http://www.maluke.com/ -- My commercial software and custom development services

Reguillo

unread,
Sep 3, 2010, 7:47:33 AM9/3/10
to Better Python
Now its working.

Here is what I did:


http://www.py2exe.org/index.cgi/ExeWithEggs

1. python setup.py develop (for mext.reaction)

2 python setup.py develop (for mext.context)

3 python setup.py develop (for mext.hacks)

After this py2exe can find the modules.
It finds it via the mext.context.egg-link, mext.hacks.egg-link and
mext.reaction.egg-link and these files are pointing to the install
folders.

In the install folder I modified, mext.context\mext\__init__.py and
mext.hacks\mext\reaction\__init__.py.

In all two files I included:

import modulefinder
for p in __path__:
modulefinder.AddPackagePath(__name__, p)
at the end of the file.

I had to add "import mext.const" to the setup.py file.
And add "mext.const" to the py2exe dictionary includes list.

Example:
setup(windows=[
{"script":"myscript.py"}
], options={
"py2exe":{"includes":[
"mext.const"
]
}
}
)



Its a small program using pyqt and sqlalchemy.


On Sep 3, 11:27 am, Sergey Schetinin <mal...@gmail.com> wrote:
> Try searching for namespace packages recipes on py2exe wiki, that should help.
>
> BTW, what app are you trying to package?
>
> On 3 September 2010 12:23, Reguillo <reguil...@gmail.com> wrote:
>
>
>
> > I have been trying to package a program that uses mext.reaction with
> > py2exe.
> > py2exe becomes a module of distutils.
> > py2exe uses a mf.py module for finding packages.
>
> > In the setup.py file, I tried several things to get mext imported by
> > the mf.py module.
> > But it was not totally succesfull.
> > Adding the line "import mext" to the setup.py doesn't seem to matter.
>
> > When adding the line "sys.path.append("C:\Python26\Lib\site-packages
> > \Reaction-0.2.2-py2.6")" to
> > setup.py, it seems to find all the modules, but when trying to run the
> > program it gives an error saying "ImportError: No module named const".
>
> > Any suggestions about how to package with py2exe?
>
> > --
> > Mailing list:http://groups.google.com/group/better-python
> > Unsubscribe: better-pytho...@googlegroups.com
>
> --
> Best Regards,
> Sergey Schetinin
>
> http://self.maluke.com/-- My articles and open-source stuffhttp://www.maluke.com/-- My commercial software and custom development services
Reply all
Reply to author
Forward
0 new messages