[Pythonmac-SIG] Opening an app from another app under different OSX versions
David Woods
dwoods at wcer.wisc.edu
Wed Jan 24 19:13:29 CET 2007
> David Woods wrote:
> > My wxPython application has a context sensitive help system, using
> > wx.html.HtmlHelpController(), which also contains a Tutorial for the
> > program. Users like to leave the Help window open while they are
> > simultaneously working in the application. To allow this, I set the
> > Help application up as a free-standing application that I can call
> > from my regular application when it is needed. (This is necessary
> > because of issues with menu construction.) My applications are built
> > using py2app, so the call I've been using looks like this:
> >
> > os.system('open -a TransanaHelp.app')
> >
> > This works on OS X 10.3, and it works when I'm running under Python
> > on
> > OS X 10.4, but I have not been able to get anything along these lines
> > to work under OS X 10.4 once my app has been bundled up with py2app.
> > It's like the Help app tries to launch, but then it immediately, and
> > silently, shuts down. (i.e. the Console doesn't report anything.)
> > os.spawnv() and os.popen2() don't work either. Does anybody have any
> > ideas for how I can launch a bundled wxPython app from within another
> > bundled wxPython app on OS X 10.4?
> >
> > Thanks for your help,
> >
> > David K. Woods, Ph.D.
> > Transana Lead Developer
> > Wisconsin Center for Education Research
> > University of Wisconsin, Madison
> > http://www.transana.org
> >
> >
> Where is the help application bundled? Alongside the main app
> in the same directory, or inside the main app's application
> bundle itself? Perhaps it's a path issue, i.e. 'open' can't
> find the app to open. If so, you may need to do some work to
> get a full path to the help app, then launch it (i.e.,
> os.system('open -a /path/to/myapp.app') ).
>
> - --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
Adding the path didn't help. Calling "open -a TransanaHelp.app" from the
command line finds the app, and adding the full path makes is start a bit
faster. But when the same call is made from within my bundled Python
program (regardless of whether the path is included), I see the following in
the console:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File
"/Applications/Transana_2/TransanaHelp.app/Contents/MacOS/TransanaHelp",
line 3, in ?
import sys, os
ImportError: No module named os
So it seems, if I'm interpreting this right, like Python's not able to find
its own modules under this particular scenario. Line 3 of TransanaHelp.py,
by the way, is not the import statement shown here. That line 3 is of some
internal Python routine that's not part of my code.
Any other ideas? Thanks,
David
More information about the Pythonmac-SIG
mailing list