|
Dear readers,
py2exe has a problem including libxml2. Not at building time, but at
runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has
the problem? (and can you drop me your setup.py scipt, please).
Thanks in advance,
Rene O. | |
Share:
|
"Rene Olsthoorn" <ro*@post.com> wrote in
news:3f*********************@news.xs4all.nl: py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me your setup.py scipt, please).
i have no project using that lib, so i cant tell from experience.
but did you check if the lib is copied to the dist dir?
if its not copied, you may need to use the data_files option altough the
dependecies for taht lib have to be tracked manually
or the --packages or --force-imports option may help, if you load the xml
module in advance
you should probably mention which python and py2exe version you used as
well as the module you import that does not work. the 0.5 version has a
slightly different output than the older ones.
chris
--
Chris <cl******@gmx.net> | | |
"Rene Olsthoorn" <ro*@post.com> wrote in message
news:3f*********************@news.xs4all.nl... Dear readers,
py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me your setup.py scipt, please).
Perhaps you hit the same problem I did when using libxml2 and libxslt in a
service created by p2exe.
Here are notes from my project diary (these notes are meant for my client to
reconcile my bill vs. what I did)
-----
The service builds, I can install it, but get an error when I run it:
The instance's SvcRun() method failed
File "win32serviceutil.pyo", line 663, in SvcRun
File "UMXWIN32SVC.pyo", line 41, in SvcDoRun
File "Rose\WebServer\UMXMServer.pyo", line 53, in ?
File "Rose\WebServer\umx_handler.pyo", line 16, in ?
File "Rose\WebServer\HTTPHandler.pyo", line 95, in ?
File "Rose\WebServer\XMLProcessor.pyo", line 34, in ?
exceptions.ImportError: dynamic module does not define init
function (initlibxslt)
This says that the service cannot import the libxslt module for some reason.
I built a test script that py2exe runs in console mode, it also fails in the
same way.
I think libxml is using some kind of dynamic import mechanism, we need to
work around.
Aha, figured it out. example problem with libxml2.
libxml2.py is a module that imports libxml2mod.pyd which imports libxml2.dll
But, py2exe creates a default path like this:
c:\\temp\\rose, c:\\temp\\rose\\library.zip
This means that python tries to import from the directory first, before
importing from library.zip. So, python imports libxml2.dll, not libxml2.py
My workaround is to reverse the order of the imports in the startup script:
zipfile = sys.path[-1]
sys.path.insert(0,zipfile) | | |
I used a cvs checking. py2exe/__init__.py has this:
__version__ = "0.4.0"
--
Novell DeveloperNet Sysop #5
_
"Thomas Heller" <th*****@python.net> wrote in message
news:fz**********@python.net... "Brad Clements" <bk*@Murkworks.com> writes:
"Rene Olsthoorn" <ro*@post.com> wrote in message news:3f*********************@news.xs4all.nl... Dear readers,
py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT
has the problem? (and can you drop me your setup.py scipt, please).
Perhaps you hit the same problem I did when using libxml2 and libxslt in
a service created by p2exe.
Here are notes from my project diary (these notes are meant for my
client to reconcile my bill vs. what I did) ----- The service builds, I can install it, but get an error when I run it:
The instance's SvcRun() method failed File "win32serviceutil.pyo", line 663, in SvcRun File "UMXWIN32SVC.pyo", line 41, in SvcDoRun File "Rose\WebServer\UMXMServer.pyo", line 53, in ? File "Rose\WebServer\umx_handler.pyo", line 16, in ? File "Rose\WebServer\HTTPHandler.pyo", line 95, in ? File "Rose\WebServer\XMLProcessor.pyo", line 34, in ?
exceptions.ImportError: dynamic module does not define init function (initlibxslt)
This says that the service cannot import the libxslt module for some
reason. I built a test script that py2exe runs in console mode, it also fails in
the same way.
I think libxml is using some kind of dynamic import mechanism, we need
to work around.
Aha, figured it out. example problem with libxml2.
libxml2.py is a module that imports libxml2mod.pyd which imports
libxml2.dll But, py2exe creates a default path like this:
c:\\temp\\rose, c:\\temp\\rose\\library.zip
This means that python tries to import from the directory first, before importing from library.zip. So, python imports libxml2.dll, not
libxml2.py My workaround is to reverse the order of the imports in the startup
script: zipfile = sys.path[-1] sys.path.insert(0,zipfile)
Which version of py2exe are you using, and what is this libxml2?
IIRC, in the latest version py2exe doesn't put the executable's directory on the path anymore, but file names like libxml2.py, libxml2.pyd, and libxml2.dll all at the same time have the potential to confuse it!
Thomas -- http://mail.python.org/mailman/listinfo/python-list | | |
Brad, Thomas,
Thanks for your help.
Brad, you were right. It is a same name problem.
The sys.path trick that Brad uses is good.
If that does not work try the following:
Go to your Python 2.3 site-packages directory. Locate the file libxml2.py
and copy it to libxml2py.py
In your code use:
import libxml2py as libxml2
Then, the exe generated by py2exe correctly runs.
Thomas, LibXML is a very fast XML parser. It has python bindings. http://xmlsoft.org/python.html
Greets,
Rene Olsthoorn.
"Thomas Heller" <th*****@python.net> schreef in bericht
news:fz**********@python.net... "Brad Clements" <bk*@Murkworks.com> writes:
"Rene Olsthoorn" <ro*@post.com> wrote in message news:3f*********************@news.xs4all.nl... Dear readers,
py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT
has the problem? (and can you drop me your setup.py scipt, please).
Perhaps you hit the same problem I did when using libxml2 and libxslt in
a service created by p2exe.
Here are notes from my project diary (these notes are meant for my
client to reconcile my bill vs. what I did) ----- The service builds, I can install it, but get an error when I run it:
The instance's SvcRun() method failed File "win32serviceutil.pyo", line 663, in SvcRun File "UMXWIN32SVC.pyo", line 41, in SvcDoRun File "Rose\WebServer\UMXMServer.pyo", line 53, in ? File "Rose\WebServer\umx_handler.pyo", line 16, in ? File "Rose\WebServer\HTTPHandler.pyo", line 95, in ? File "Rose\WebServer\XMLProcessor.pyo", line 34, in ?
exceptions.ImportError: dynamic module does not define init function (initlibxslt)
This says that the service cannot import the libxslt module for some
reason. I built a test script that py2exe runs in console mode, it also fails in
the same way.
I think libxml is using some kind of dynamic import mechanism, we need
to work around.
Aha, figured it out. example problem with libxml2.
libxml2.py is a module that imports libxml2mod.pyd which imports
libxml2.dll But, py2exe creates a default path like this:
c:\\temp\\rose, c:\\temp\\rose\\library.zip
This means that python tries to import from the directory first, before importing from library.zip. So, python imports libxml2.dll, not
libxml2.py My workaround is to reverse the order of the imports in the startup
script: zipfile = sys.path[-1] sys.path.insert(0,zipfile)
Which version of py2exe are you using, and what is this libxml2?
IIRC, in the latest version py2exe doesn't put the executable's directory on the path anymore, but file names like libxml2.py, libxml2.pyd, and libxml2.dll all at the same time have the potential to confuse it!
Thomas | | |
Brad, Thomas,
Thanks for your help.
Brad, you were right. It is a same name problem.
The sys.path trick that Brad uses is good.
If that does not work try the following:
Go to your Python 2.3 site-packages directory. Locate the file libxml2.py
and copy it to libxml2py.py In your code use: import libxml2py as libxml2
Then, the exe generated by py2exe correctly runs.
Thomas, LibXML is a very fast XML parser. It has python bindings. http://xmlsoft.org/python.html
Greets,
Rene Olsthoorn.
"Thomas Heller" <th*****@python.net> schreef in bericht
news:fz**********@python.net... "Brad Clements" <bk*@Murkworks.com> writes:
"Rene Olsthoorn" <ro*@post.com> wrote in message news:3f*********************@news.xs4all.nl... Dear readers,
py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT
has the problem? (and can you drop me your setup.py scipt, please).
Perhaps you hit the same problem I did when using libxml2 and libxslt in
a service created by p2exe.
Here are notes from my project diary (these notes are meant for my
client to reconcile my bill vs. what I did) ----- The service builds, I can install it, but get an error when I run it:
The instance's SvcRun() method failed File "win32serviceutil.pyo", line 663, in SvcRun File "UMXWIN32SVC.pyo", line 41, in SvcDoRun File "Rose\WebServer\UMXMServer.pyo", line 53, in ? File "Rose\WebServer\umx_handler.pyo", line 16, in ? File "Rose\WebServer\HTTPHandler.pyo", line 95, in ? File "Rose\WebServer\XMLProcessor.pyo", line 34, in ?
exceptions.ImportError: dynamic module does not define init function (initlibxslt)
This says that the service cannot import the libxslt module for some
reason. I built a test script that py2exe runs in console mode, it also fails in
the same way.
I think libxml is using some kind of dynamic import mechanism, we need
to work around.
Aha, figured it out. example problem with libxml2.
libxml2.py is a module that imports libxml2mod.pyd which imports
libxml2.dll But, py2exe creates a default path like this:
c:\\temp\\rose, c:\\temp\\rose\\library.zip
This means that python tries to import from the directory first, before importing from library.zip. So, python imports libxml2.dll, not
libxml2.py My workaround is to reverse the order of the imports in the startup
script: zipfile = sys.path[-1] sys.path.insert(0,zipfile)
Which version of py2exe are you using, and what is this libxml2?
IIRC, in the latest version py2exe doesn't put the executable's directory on the path anymore, but file names like libxml2.py, libxml2.pyd, and libxml2.dll all at the same time have the potential to confuse it!
Thomas | | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
5 posts
views
Thread by Michael Peuser |
last post: by
|
1 post
views
Thread by Brian Donovan |
last post: by
|
1 post
views
Thread by Funduk |
last post: by
|
17 posts
views
Thread by Thomas Heller |
last post: by
|
2 posts
views
Thread by Laszlo Nagy |
last post: by
|
1 post
views
Thread by cesar.ortiz |
last post: by
|
1 post
views
Thread by Jimmy Retzlaff |
last post: by
|
reply
views
Thread by Larry Bates |
last post: by
|
reply
views
Thread by Jimmy Retzlaff |
last post: by
| | | | | | | | | | |