[Pythonmac-SIG] Toxic Edit / Cocoa 'IDE'

Jonathan Wight JWight@bigfoot.com
Tue, 03 Apr 2001 23:51:08 -0500


On 04/03/2001 19:13, "Steven D. Majewski" <sdm7g@virginia.edu> wrote:

>> Cool. I'll probably be putting a new version on
>> http://toxicsoftware.com/ToxicEdit/ tonight with some fixes.

It's online now. Nothing major in it - just some changes to the way it
initializes the globals and locals before it executes the script. Now you
have your __name__ == __main__ and sys isn't imported by default.

There is a weirdness though and I haven't figured it out. If I run this code
in the Terminal Python:

print dir(__builtins__)

I get something a lot like this. About 40 entries in the list.

['ArithmeticError', 'AssertionError', <--snipped--> 'vars', 'xrange', 'zip']

If I do the same inside ToxicEdit I get this:

['clear', 'copy', 'get', 'has_key', 'items', 'keys', 'popitem',
'setdefault', 'update', 'values']

Which looks like the methods of a dictionary item. The odd thing is is that
seems to be correct (at least superficially). Because if I don't install the
__builtins__ module commands like dir() wouldn't even work. Weird.

> Out of all of those, I'm not quite sure what the "Right" thing to do
> is: maybe check for $PWD and if not set, fall back to $HOME or
> parent dir or bundlePath.

How about setting the CWD to the parent directory of the open script? This
would allow imports referring to the script's local siblings to work.

> ( It would be cool if there was a way to have an option to
> automatically run the script without clicking RUN. )

Don't know an friendly way to do that. Maybe add to the "#!/bin/python"
mechanism so that if the second line is something like "# LaunchOnOpen" or
similar ToxicEdit will execute the script. Suggestions?

> (PS. I just set up an iDisk & home page at mac.com.
>  I'm going to put  binaries on ObjCmodule.so & Carbonmodule.so
>  there for folks who don't want  to attempt the whole build. )

Um, what's the iDisk name?