I recently tried to convert my app to .p3d and came across a problem I can’t hack through. Well, I urgently need to include the “lxml” library in my project. The problem is I can’t find a way to properly include lxml/etree.so so that it will import and work. So far I’m testing it on a following main.py:
from lxml import html
Here’s the pdef file:
import sys
sys.path.insert(0,'')
class MyP3D(p3d):
require('morepy')
sys.path.append('/usr/share/pyshared')
sys.path.append('/usr/lib/python2.6/dist-packages')
config(
version="0.0",
display_name = "MyP3D")
module('lxml')
file('/usr/lib/python2.6/dist-packages/lxml/etree.so',newDir='lxml')
mainModule('main')
And this is the output:
> ppackage -i output_dir WTF.pdef
:Packager: Reading WTF.pdef
There are some missing modules: ['lxml.etree']
Generating MyP3D.0.0.linux_i386.p3d
> panda3d output_dir/MyP3D.0.0.linux_i386.p3d
Traceback (most recent call last):
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
File "VFSImporter", line 153, in load_module
File "main.py", line 1, in <module>
File "VFSImporter", line 153, in load_module
File "/usr/share/pyshared/lxml/html/__init__.py", line 8, in <module>
from lxml import etree
File "VFSImporter", line 127, in load_module
File "VFSImporter", line 228, in _import_extension_module
ImportError: /usr/lib/libxml2.so.2: undefined symbol: gzopen64
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 411, in run
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 496, in run
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 454, in step
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
File "VFSImporter", line 153, in load_module
File "main.py", line 1, in <module>
I would also like to report an EXTREMELY annoying bug with paths - for some reason ppackage tries to run /bin/sh -c ldd somefile > OtherFile and can’t run it because of messed up environment variables. I bypassed it by replacing /bin/sh with my own script fixing the PATH, but it’s an ugly hack. It’s also reported HERE. Here’s where it’s looking for ldd:
> strace -s 300 -fdv ppackage -i output_dir WTF.pdef 2>&1 | grep -i ldd
[pid 16653] execve("/bin/sh", ["sh", "-c", "ldd \"/usr/lib/python2.6/dist-packages/lxml/etree.so\" >\"/tmp/p3d_fwHGvY\""], ["LANGUAGE=", "KDE_MULTIHEAD=false", "KDE_SESSION_VERSION=4", "KONSOLE_DBUS_SERVICE=:1.36", "LOGNAME=deetah", "WINDOWPATH=7", "GTK_MODULES=canberra-gtk-module", "GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/deetah/.gtkrc-2.0:/home/deetah/.gtkrc-2.0-kde4:/home/deetah/.kde/share/config/gtkrc-2.0", "KDE_FULL_SESSION=true", "SHLVL=1", "DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-eDgkbWF6J9,guid=ce6a64a0d519155c1af284cf4c86bae7", "USER=deetah", "LANG=pl_PL.UTF-8", "GTK_RC_FILES=/etc/gtk/gtkrc:/home/deetah/.gtkrc::/home/deetah/.kde/share/config/gtkrc", "WINDOWID=48234535", "XDM_MANAGED=method=classic,auto", "XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share", "DM_CONTROL=/var/run/xdmctl", "_=/usr/bin/strace", "DISPLAY=:0.0", "PWD=/home/deetah/projekty/python/pynk/ppd/tiny", "XCURSOR_THEME=oxy-white", "GS_LIB=/home/deetah/.fonts", "COLORFGBG=15;0", "KDE_SESSION_UID=1000", "SSH_AGENT_PID=1283", "XDG_SESSION_COOKIE=8301149227d6e8371b57ae224b7f2749-1283898087.316820-386313914", "OLDPWD=/home/deetah/projekty/python/pynk/ppd", "TERM=xterm", "PROFILEHOME=", "SESSION_MANAGER=local/deetah-laptop:@/tmp/.ICE-unix/1616,unix/deetah-laptop:/tmp/.ICE-unix/1616", "QT_PLUGIN_PATH=/home/deetah/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/", "SSH_AUTH_SOCK=/tmp/ssh-FYtJNS1239/agent.1239", "KONSOLE_DBUS_SESSION=/Sessions/6", "DESKTOP_SESSION=default", "HOME=/home/deetah", "GPG_AGENT_INFO=/tmp/gpg-iFYxq2/S.gpg-agent:1284:1", "SHELL=/bin/zsh", "LC_ALL=pl_PL.utf8", "ECHANGELOG_USER=Dawid W\304\231gli\305\204ski <cla@gentoo.org>", "WORDCHARS=*?_[]~\\!#$%^<>|`@#$%^*()+?", "PS1=%{\33[0;32m%}%(!.#.>) %{\33[0m%}", "GREP_COLOR=31", "HISTSIZE=5000", "HISTFILE=/home/deetah/.history_zsh", "SAVEHIST=4000", "EDITOR=/usr/bin/vim", "PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "LD_LIBRARY_PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "DYLD_LIBRARY_PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PYTHONPATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PYTHONHOME=", "PRC_PATH=/home/deetah/.panda3d/prc:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PANDA_PRC_PATH=/home/deetah/.panda3d/prc:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "TEMP=/tmp/", "PANDA3D_ROOT=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "EGG_ROOT=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7"] [wait(0x57f) = 16653]
[pid 16653] stat64("/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7/ldd", [wait(0x57f) = 16653]
[pid 16653] stat64("/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7/ldd", [wait(0x57f) = 16653]
[pid 16653] write(2, "ldd: not found", 14ldd: not found [wait(0x57f) = 16653]
The funny thing is, whenever I copy ldd to the mentioned dir where it looks for it, the binary gets removed. Any better workarounds/solutions? So far, I’m completely doomed by these two errors.