[Pythonmac-SIG] Opening an app from another app under different OS X versions

2007-01-24 Thread David Woods
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

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OS X versions

2007-01-24 Thread Kevin Walzer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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
 
 ___
 Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
 http://mail.python.org/mailman/listinfo/pythonmac-sig
 
 
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
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFt4gOEsLm8HXyq4sRAur4AJ9u3vKlXLEldALsil/IdcuUE2/8UwCeKFxo
UwGgrIA4fvwU+FA2OjtrPg0=
=dyGm
-END PGP SIGNATURE-
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OS X versions

2007-01-24 Thread Dethe Elza
As Kevin said, you may only need the full path to your app.  It's  
remotely possible you would need the full path to open as well (/usr/ 
bin/open).  Full paths are finicky though, and you will need to know  
where your application is installed, if the help application is in  
the app bundle, for instance.  Also, paths are different on  
internationalized versions of OS X.

The right way is probably to use PyObjC and the NSWorkspace object:

from AppKit import NSWorkspace
NSWorkspace.sharedWorkspace.launchApplication_('MyApp')

For more on Workspace services, there is this article: file:/// 
Developer/ADC%20Reference%20Library/documentation/Cocoa/Conceptual/ 
Workspace/index.html

Also, when you're launching an app with open, you don't need the -a  
flag, but without it you do need the path to the application.

--Dethe


You need to lay out the user interface components visually, by hand,  
with total control over where they go. Automated LayoutManagers don’t  
cut it. A corollary of this is that you can’t move a UI layout from  
one platform to another and have the computer make everything fit.  
Computers don’t lay out interfaces by themselves any better than they  
can translate French to English by themselves. -- Jens Alfke



___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OSX versions

2007-01-24 Thread David Woods
 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

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OSX versions

2007-01-24 Thread Dethe Elza
On 24-Jan-07, at 10:13 AM, David Woods wrote:

 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.

I had a problem like this when first moving from distutils-based  
setup files to setuptools-based setup files.  Getting the latest  
version of py2app may help.

--Dethe

Copyrights may have been an efficient mechanism to support creative  
and artistic work in the middle ages, but they don’t work very well  
in the Internet Age. --Dean Baker


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OSX versions

2007-01-24 Thread David Woods
  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.
 
 I had a problem like this when first moving from distutils-based  
 setup files to setuptools-based setup files.  Getting the latest  
 version of py2app may help.
 
 --Dethe

Upgrading to py2app 0.3.5 had absolutely no effect.

David

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Question about setup.py build

2007-01-24 Thread Daniel Lord
I admit to being a novice at this yet, but I couldn't find anything  
relevant to this issue on-line:

I am trying to build a version of pysqlite that works with sqllite3 :
1. Apple's installed version doesn't work with the latest so I  
reinstalled
2. sqllite3 won't build shared libs for universal binaries (typical  
of a lot of linux/UNIX build since the developers never have that  
problem except on OS X)
3. so I built Intel-only but
4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g - 
isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc.  
etc.) with python setup.py build
5. But nowhere in the setup.py or setup.cfg  is that set. I  
explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from  
there.

So where is it being set? By the Python build? Where? I jsut need a  
little pointer or two and I'll do the rest. Thanks.

Daniel
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Question about setup.py build

2007-01-24 Thread Bob Ippolito
On 1/24/07, Daniel Lord [EMAIL PROTECTED] wrote:
 I admit to being a novice at this yet, but I couldn't find anything
 relevant to this issue on-line:

 I am trying to build a version of pysqlite that works with sqllite3 :
 1. Apple's installed version doesn't work with the latest so I
 reinstalled
 2. sqllite3 won't build shared libs for universal binaries (typical
 of a lot of linux/UNIX build since the developers never have that
 problem except on OS X)

Why would you want shared libs anyway? I'm pretty sure the Mac build
script that comes with Python 2.5 (Mac/BuildScript/build-installer.py)
will automatically download SQLite and compile it universally as a
static lib. Take a look in there.

 3. so I built Intel-only but
 4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g -
 isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc.
 etc.) with python setup.py build
 5. But nowhere in the setup.py or setup.cfg  is that set. I
 explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from
 there.

 So where is it being set? By the Python build? Where? I jsut need a
 little pointer or two and I'll do the rest. Thanks.

The same place that everything else that distutils knows about is
coming from, the Makefile in your Python library that was created when
Python was built: lib/python2.4/config/Makefile

-bob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Opening an app from another app under different OSX versions

2007-01-24 Thread Bob Ippolito
On 1/24/07, David Woods [EMAIL PROTECTED] wrote:
   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.
 
  I had a problem like this when first moving from distutils-based
  setup files to setuptools-based setup files.  Getting the latest
  version of py2app may help.
 
  --Dethe

 Upgrading to py2app 0.3.5 had absolutely no effect.


It's *probably* because py2app sets a lot of environment variables
that can effect child Python interpreters... Try clearing out any PY*
environment variables sometime early in your script.

-bob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Question about setup.py build

2007-01-24 Thread Daniel Lord
Thanks Bob, coming through as always.

Daniel

On Jan 24, 2007, at 14:26, Bob Ippolito wrote:

 On 1/24/07, Daniel Lord [EMAIL PROTECTED] wrote:
 I admit to being a novice at this yet, but I couldn't find anything
 relevant to this issue on-line:

 I am trying to build a version of pysqlite that works with sqllite3 :
 1. Apple's installed version doesn't work with the latest so I
 reinstalled
 2. sqllite3 won't build shared libs for universal binaries (typical
 of a lot of linux/UNIX build since the developers never have that
 problem except on OS X)

 Why would you want shared libs anyway? I'm pretty sure the Mac build
 script that comes with Python 2.5 (Mac/BuildScript/build-installer.py)
 will automatically download SQLite and compile it universally as a
 static lib. Take a look in there.

 3. so I built Intel-only but
 4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g -
 isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc.
 etc.) with python setup.py build
 5. But nowhere in the setup.py or setup.cfg  is that set. I
 explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from
 there.

 So where is it being set? By the Python build? Where? I jsut need a
 little pointer or two and I'll do the rest. Thanks.

 The same place that everything else that distutils knows about is
 coming from, the Makefile in your Python library that was created when
 Python was built: lib/python2.4/config/Makefile

 -bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Question about setup.py build

2007-01-24 Thread Daniel Lord
I realized I only copied Bob on this and to send it out to everyone  
might help someone else
the build for PySQLite is poorly designed and ignores the state of '-- 
enable-shared' and looks for the dylib anyway so fails on static-only  
builds.

I will have to hack it to get it to work. Shame, shame.

On Jan 24, 2007, at 15:08, Daniel Lord wrote:


Bob,
Just so you know though, I was building the dynamic libs because  
the installer looks for them even if you disable shared libs.
Bad design. So I'll have to 'hack' it to make it work. Not that  
that isn't business as usual with OS X ;-)


[EMAIL PROTECTED] sudo make install
Password:
tclsh ./tclinstaller.tcl 3.3
couldn't open .libs/libtclsqlite3.dylib: no such file or directory
while executing
open $LIBFILE
invoked from within
set in [open $LIBFILE]
(file ./tclinstaller.tcl line 23)
make: *** [tcl_install] Error 1
[



___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig