[Pythonmac-SIG] Miscellaneous MacPython Questions
Thu, 23 Sep 1999 22:31:06 -0400
I've accumulated several questions about using MacPython over the
past few days and haven't been able to turn up answers on my own, so
I figured that it was time to turn to the gurus for a little help. I
consider myself somewhere between a newbie and a yearling as far as
Python goes and hope that none of these indicate that I have
overestimated my status. :-]
1. In the course of testing a text manipulation script that opens a
file, reads it, and then outputs the processed data into a new text
file, I have run into a problem if the output file already exists
from previous tests. Specifically if foo.txt already exists when the
script tries to set sys.stdout to foo.txt with the w switch, I get an
invalid argument error that won't go away until I trash the existing
foo.txt file. My expectation was that Python would simply overwrite
the existing file the way that Perl does, but I guess not. Is this a
Mac thing or what? In any case is there a switch that can be used to
force an overwrite (not an append)?
2. Is there a switch (or something) that can be used to simply check
the syntax of a script without actually trying to run it (kind of
like the Check Syntax command in MacPerl)?
3. What exactly is the difference between MacFreeze and the
4. What is the correct syntax to get the profiler to work on a Mac?
If I option launch Python and then try to set a unix command line
like python profile.py myscript.py I get nowhere.
5. What's the preferred way to set sys.stdout back to the python.out
window after you've already switched it to a file during script
execution? I'm using sys.stdout = sys.__stdout__ and that works fine,
but the __doc__ says to never use the __stdout__ static object and I
was just wondering how come (and whether I am getting ready to find
out the hard way if I continue to do that)?
6. If I was going to put an interface on a standalone Mac-only
application, am I correct in believing that there is no reason to
bother considering the use of (the very spooky) Tkinter over native
7. When .pyo files are created, is the optimization
machine-environment-specific, cpu specific or what?
8. When you create a standalone with MacFreeze, is a python
application effectively transformed into a C application? Is it
likely to run faster as a standalone?
That's about it. Thanks for help with any or all of the above.
Gordon Consulting & Design
Database Design/Scripting Languages