Jens,
I did it by dinamic loading the pyc files in my code. The problem with th=
is
approach is that at least one file will be a plain vanilla source code fi=
le
with the idea of also having it has a "plugin", so it might work 4 u as w=
ell.
You can check it out since it is Open Source project anyway stored at
http://file-spector.sourceforge.net
In the setup.py I load it using a glob instruction:
...
data_files =3D [("images", ["images/file-spector.ico",
"images/add-arrow.bmp",
"images/add-node.bmp",
"images/subtract.bmp",
"images/struct-a-file.gif",
"images/export.bmp",
"images/new.bmp",
"images/open.bmp",
"images/save.bmp"]),
("pool", glob.glob("pool/*.pyc")) ],
...
In the code, all files in the pool directory, which is actually
a package since it includes a file named __init__.py, are loaded
when needed for the first time using the import. You can check it
out in the class DataNodeVisitor in the DatNode module file.
http://cvs.sourceforge.net/viewcvs.py/file-spector/prototype/saf/
Still, Heller might have a better and absolute solution for it.
On Thu, 16 Sep 2004 10:55:23 +0200, Jens G=F6pfert <Jens.Goepfert@...>=
wrote:
>
> Hello,
>
>
> i have a simple python application compiled with py2exe. this applicati=
on imports at runtime all python scripts in a subfolder (plugins).
> until here all works fine. Now i want to distribute some plugins withou=
t source code. so i just let the pyc-files in this subfolder and now i go=
t an ImportError.
> if i run this application without compiling it with py2exe i can import=
pyc-files.
>
> Is it possible to import pyc-files in a py2exe compiled python app???
>
> Thanks
>
> Jens
>
--=20
Bruno Santos
mailto:bmsantos@...
"Treat people as they ought to be, and you will help them
become what they are capable of being." - Goethe
Grupo GMV SA.
---------------------------------------------------------------------
Isaac Newton, 11 - PTM - Tres Cantos - 28760 Madrid
---------------------------------------------------------------------
Phone: 91-8072100 Ext:3362 Fax: 91-8072199
---------------------------------------------------------------------
http://www.gmv.com http://www.gmv.es
http://www.gmvsistemas.com http://www.sgi.es
---------------------------------------------------------------------
This message is for the designated recipient only and may
contain privileged, proprietary, or otherwise private
information. If you have received it in error, please notify
the sender immediately and delete the original. Any
other use of the email by you is prohibited.
|