[Pythonmac-SIG] pythonw and python with applescript
bob at redivi.com
Tue Dec 13 22:55:06 CET 2005
On Dec 13, 2005, at 1:30 PM, Zhi Peng wrote:
> Actually there is only one step away, that is, pythonw and python.
> With python, I can import modules by using PyImport_ImportModule
> ("name"). But I have to use pythonw since I used appscript. Then I
> can not import modules sucessfully with same commands.
No. As I've said three or four times already in this thread, that is
not an option because pythonw doesn't exist. It's just a shell
script that starts the Python interpreter from within an application
bundle. It's the exact same interpreter that is used when you type
python, it's just symlinked to somewhere else. To get that behavior
you MUST use an application bundle. It's a simple matter of creating
a few directories and an Info.plist and putting your application in
there. Quite trivial if you're using Xcode because it's got support
for application bundles, where the normal GCC toolchain does not.
> If converting C code to python, there will be a lot of changes too
> because C is strict typed language while python everything is
> Object. I have to make .so or .dylib in order to allow python code
> to call C code. That will be still a lot of work.
No, it's not a lot of changes. Trivially you could remove your
Python initialization/finalization code and change the rest of main()
to be callable from Python and turn that into an extension module.
20-30 minutes work at most. That would solve the immediate problem
because you wouldn't be embedding Python anymore.
More information about the Pythonmac-SIG