[Pythonmac-SIG] Error in loading Bundle on Mac OS X 10.3.4

Brian Christensen brian at simpleprojectmanagement.com
Thu Sep 9 21:21:19 CEST 2004


I posted this problem to the wxPython-mac list, but no one there was  
able to solve the problem. Maybe you folks can help.

--------
My wxPython application works perfectly on my Mac OS X 10.3.4 test  
machine, but it does not load for one of my users. He also has Mac OS X  
10.3.4 installed. He has tried in on both his laptop and desktop  
machines with the same result. I appreciate your help in trying to  
track down this problem.

I have some additional data that may help to track down this problem. I  
have the output of the "set" command on both the users machine and my  
test machine. I also have the results of the "otools -L"  command from  
my development machine.

It has been a couple of weeks since my last post on this so I will  
repeat the error message he is getting:

===== Wed Jul 14 2004 ===== 17:47:12 US/Pacific =====
Traceback (most recent call last):
  File "/Users/andycarter/Desktop/GanttPV v0.1.1  
Folder/GanttPV.app/Contents/Resources/GanttPV.py", line 45, in ?
    import wx
  File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/wx/__init__.py", line 19, in ?
  File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/wx/core.py", line 4, in ?
  File "<dynloader for wx._core>", line 11, in ?
  File "<dynloader for wx._core>", line 9, in __load
ImportError: Failure linking new module:  
/usr/lib/wxPython-2.5.1.5/lib/libwx_base_carbond_xml-2.5.1.dylib: dyld:  
/Users/andycarter/Desktop/GanttPV v0.1.1  
Folder/GanttPV.app/Contents/MacOS/GanttPV can't open library:  
/usr/lib/wxPython-2.5.1.5/lib/libwx_base_carbond_xml-2.5.1.dylib  (No  
such file or directory, errno = 2)
------ end of error message -----

------ Response from wxPython-mac list -------
 > Any ideas what may be causing the problem? Or any suggestions what I
 > could check next?

Unfortunately I have no ideas.  The wxPython extension modules will  
have encoded in them the paths to the wxMac dylibs they use, but  
setting DYLD_LIBRARY_PATH will cause the dynamic loader to look in that  
location first.  What appears to be happening is that the  
DYLD_LIBRARY_PATH being put in os.environ in the bundle's startup  
script is being ignored for some reason and so the loader is still  
looking in the compiled in path, which doesn't exist.


I fooled around with this for a while this morning by building a  
standalone bundle for the superdoodle sample.  I then moved my  
installed wxMac libs to another location so they wouldn't be found by  
the bundle.  The bundle loaded and ran fine.  I then tweaked the  
startup script so that it wasn't setting DYLD_LIBRARY_PATH and then I  
got an error just like what you reported.

The only other thing I can think of to try is to build your bundle on a  
Panther system and see if it makes any difference.  (You could even do  
semi-standalone in that case to not include the Python framework since  
it will already be on the target machines.)

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!
------ end of wxPython-mac list response ------

The following is the information I included in my post to the  
wxPython-mac list:

This is the contents of the python file in the bundle that that tells  
the Mac where to find the library files.

----------- start of file ------------------------------
#!/usr/bin/python

import sys, os
execdir = os.path.dirname(sys.argv[0])
executable = os.path.join(execdir, "Python")
resdir = os.path.join(os.path.dirname(execdir), "Resources")
libdir = os.path.join(os.path.dirname(execdir), "Frameworks")
mainprogram = os.path.join(resdir, "GanttPV.py")

sys.argv.insert(1, mainprogram)
if 1 or 0:
    os.environ["PYTHONPATH"] = resdir
    if 1:
        os.environ["PYTHONHOME"] = resdir
else:
    pypath = os.getenv("PYTHONPATH", "")
    if pypath:
        pypath = ":" + pypath
    os.environ["PYTHONPATH"] = resdir + pypath
os.environ["PYTHONEXECUTABLE"] = executable
os.environ["DYLD_LIBRARY_PATH"] = libdir
os.environ["DYLD_FRAMEWORK_PATH"] = libdir
os.execve(executable, sys.argv, os.environ)
----------- end of file ------------------------------

Per my request, the user opened the Mac bundle and confirmed that the  
"missing" file is there.


On Wednesday, July 21, 2004, at 03:17  PM, Brian Christensen wrote:

>
> On Tuesday, July 20, 2004, at 06:00  PM, Robin Dunn wrote:
>
>> Brian Christensen wrote:
>>
>>> I have confirmed that the library files are copied to the right  
>>> directory. What makes this particularly troublesome is that I now  
>>> have a test machine that uses the same version of Mac OS X 10.3.4  
>>> that my user has, but it works fine on my test machine!
>>
>> Does your test machine have wxPython installed?
>
> No my test machine doesn't have wxPython installed.

My test machine does not have the Mac development tools installed  
either.

>
>>
>>
>>> What could make it work correctly on one machine, but not on the  
>>> other?
>>> Is there something else that could be changing the DYLD_LIBRARY_PATH  
>>> after the "os.execve" but before it tries to load the library  
>>> module? Some script file that is being automatically loaded  
>>> somewhere in the middle of the process?
>>
>> Not that I know of, but that isn't saying much when it comes to OSX.  
>> Perhaps there are some other environment variables that are set that  
>> are affecting things.  Try getting them to send you the output of  
>> "set" from a terminal window.
>
> I have sent an email to ask. Hopefully he will answer. I'm concerned  
> he may have given up on it.

Here is the result of the set command on the user's machine that will  
not run the program:

------- Begin - User Mac --------
Last login: Wed Jul 21 13:49:08 on console
Welcome to Darwin!
ClearCube3:~ andycarter$ set
BASH=/bin/bash
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release"
[5]="powerpc-apple-darwin7.0")
BASH_VERSION='2.05b.0(1)-release'
COLUMNS=80
DIRSTACK=()
EUID=501
GROUPS=()
HISTFILE=/Users/andycarter/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/Users/andycarter
HOSTNAME=ClearCube3.local
HOSTTYPE=powerpc
IFS=$' \t\n'
LINES=24
LOGNAME=andycarter
MACHTYPE=powerpc-apple-darwin7.0
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=darwin7.0
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PIPESTATUS=([0]="0")
PPID=961
PS1='\h:\w \u\$ '
PS2='> '
PS4='+ '
PWD=/Users/andycarter
SECURITYSESSIONID=2100d0
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive- 
comments:
monitor
SHLVL=1
TERM=xterm-color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=100
UID=501
USER=andycarter
_=/etc/bashrc
__CF_USER_TEXT_ENCODING=0x1F5:0:0
------ End - User Mac -------

Here is the result from my test machine that does run the program:
------- Begin - Test Mac --------
Last login: Tue Aug 10 04:42:10 on console
Welcome to Darwin!
iMac:~ avc$ set
BASH=/bin/bash
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release"  
[5]="powerpc-apple-darwin7.0")
BASH_VERSION='2.05b.0(1)-release'
COLUMNS=80
DIRSTACK=()
EUID=502
GROUPS=()
HISTFILE=/Users/avc/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/Users/avc
HOSTNAME=iMac.local
HOSTTYPE=powerpc
IFS=$' \t\n'
LINES=24
LOGNAME=avc
MACHTYPE=powerpc-apple-darwin7.0
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=darwin7.0
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PIPESTATUS=([0]="0")
PPID=497
PS1='\h:\w \u\$ '
PS2='> '
PS4='+ '
PWD=/Users/avc
SECURITYSESSIONID=20f660
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive- 
comments:monitor
SHLVL=1
TERM=xterm-color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=100
UID=502
USER=avc
_=/etc/bashrc
__CF_USER_TEXT_ENCODING=0x1F6:0:0
------ End - Test Mac -------


>> You could also try using "otool -L" on _core.so with and without  
>> DYLD_LIBRARY_PATH set to see what it is trying to load in each case.
>
> When I type "otool" I get "otool: Command not found." I guess that  
> would be because I don't have the Apple developer tools installed.
>

This is what I get from otool on my development Mac (Mac OS X 10.2.8):

----- Begin -----
[G4:Resources/ExtensionModules/wx] bcc% otool -L _core.so
_core.so:
         /Library/Frameworks/Python.framework/Versions/2.3/Python  
(compatibility version 2.3.0, current version 2.3.0)
         /usr/lib/wxPython-2.5.1.5/lib/libwx_macd_html-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
         /usr/lib/wxPython-2.5.1.5/lib/libwx_macd_adv-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
         /usr/lib/wxPython-2.5.1.5/lib/libwx_macd_core-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
          
/usr/lib/wxPython-2.5.1.5/lib/libwx_base_carbond_xml-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
          
/usr/lib/wxPython-2.5.1.5/lib/libwx_base_carbond_net-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
         /usr/lib/wxPython-2.5.1.5/lib/libwx_base_carbond-2.5.1.dylib  
(compatibility version 2.5.1, current version 2.5.1)
         /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon  
(compatibility version 2.0.0, current version 122.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
current version 63.0.0)
[G4:Resources/ExtensionModules/wx] bcc%
----- End -----

Any ideas what may be causing the problem? Or any suggestions what I  
could check next?


(Andy, Thanks for your help in trying to track this down. -- Brian)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 9659 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040909/df99ee0d/attachment-0001.bin


More information about the Pythonmac-SIG mailing list