[Pythonmac-SIG] Python dieing outside project builder
Jack Jansen
Jack.Jansen@oratrix.com
Thu, 13 Jun 2002 21:41:59 +0200
On donderdag, juni 13, 2002, at 03:36 , Matthew Smith wrote:
> Hello,
>
> I'm linking to the python framework in an app I'm working on,
> the app needs
> to run a python script at start-up.
>
> If I run the app from inside project builder everything works
> and the return
> value for executing the script is fine.
>
> If the program is launched outside project builder (eg
> double-clicking on it
> in the finder), the script doesn't run and the return value
> gives an error.
>
> The script I am running is with the .app file in the build directory...
>
> Any ideas?
Just a wild guess: when you double-click you could have a
different working directory than when you run from Project
Builder. You could put some debug output in your embedding
application (for instance print the working directory, or set
the Py_VerboseFlag to 1 before calling Python), and the output
will appear in the console window
(Applications->Utilities->Console).
I'm also not 100% sure which Python initialize routine you need
to call if your Python scripts want access to Carbon methods. I
think Py_Initialize() may be good enough, but it could be that
you have to use PyMac_Initialize() (as in MacPython). Or maybe
you even need something completely different (i.e.
Py_Initialize() plus some of the stuff in PyMac_Initialize().
Maybe someone else has already experimented with embedding
MachoPython and has information to share?
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution --
Emma Goldman -