[Pythonmac-SIG] MachoPython 2.2.2 build works; 3 minor questions
Jack Jansen
Jack.Jansen@cwi.nl
Fri, 8 Nov 2002 10:17:36 +0100
On Friday, Nov 8, 2002, at 01:26 Europe/Amsterdam, Russell E Owen wrote:
> 1) Readlines support is missing when python is run via the shell
> script in pythonw, though one can activate it by doing "import
> readline". Any idea how to get that done automatically at startup?
Put it in your PYTHONSTARTUP file. Or add it to sitecustomize.py. Or
there are probably many other ways...
> 2) Is it possible to make a Python/Tkinter source file that can be run
> as a command (i.e. that has a working #! line in it)? I tried the
> obvious, but it fails. Example:
>
> #!/usr/local/bin/pythonw
> """Test of #!/usr/local/bin/pythonw; the file does exist and does
> work"""
>
> Results in:
> /usr/local/bin/pythonw: Event not found.
#!/Applications/Python.app/Contents/MacOS/python
Not pretty, but it works.
> Ideally, I'd like to set it up so /usr/local/bin/python could be used
> for *everything* involving the command line, meaning I could type
> "python" at the command line or use #!/usr/local/bin/python in my
> source code and it would all work (including with Tkinter).
Under 10.2 you could create a minimal C program that does an execve()
of /Applications/Python.app/Contents/MacOS/python, I think that will
work okay. On 10.1 this will not work for all situations: on 10.1 the
window server is contacted as soon as you start a program (on 10.2 it
seems to be delayed until you actually use the window server), so using
the windowing Python will likely fail if you don't have a windowing
environment.
> 3) pythonw does the following when run with a source file as its
> argument:
> % pythonw TUI.py
> original argc=2
> original argv[0] = "/Applications/Python.app/Contents/MacOS/python"
> original argv[1] = "TUI.py"
> modified argc=2
> modified argv[0] = "/Applications/Python.app/Contents/MacOS/python"
> modified argv[1] = "TUI.py"
>
> I'm guessing this is a known oddity in 2.2.2 that is resolved in 2.3,
> but if there's some trivial way to stop it, I'll put it in the
> documentation.
Remove the silly debug prints from macmain.c and rebuild. Could you do
me a favor and file a bug report for this?
--
- 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 -