[Pythonmac-SIG] IDLE etc build from CVS

Tony Lownds tony@lownds.com
Tue, 18 Feb 2003 12:35:44 -0800


--============_-1166521948==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

Hi Just,

At 1:29 PM +0100 2/18/03, Just van Rossum wrote:
>Tony Lownds wrote:
>
>>  I think there may be another problem with the latest change to
>>  applets: The __main__.py file used to be executed with the -psn
>>  arguments filtered out, but now the -psn arguments are not getting
>>  filtered out.
>>
>>  Is -psn argument handling the responsibility of the main program?
>
>Yes. But perhaps BuildApplet can provide a wrapper that handles this.

Since BuildApplet did do so in 2.2, I think providing a wrapper would 
be a Good Thing.

>  > Or should bundlebuilder take care of that?
>
>No, there are cases where the -psn argument is needed by the main
>program (possibly only apps made with PyObjC).

So it's not bundlebuilder's responsibility, but it may be 
BuildApplets' responsibility.

If the main program intends to ignore the -psn argument, it's easy 
enough to just do that in the main program:

if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn':
     del sys.argv[1]

...but the wrapper script could also simply drop the "$1" from the 
exec line too.

Handling the -psn argument properly in the main program also seems easy enough:

import argvemulator
argvemulator.ArgvCollector().mainloop()

I'm worried about the extra startup time with argvemulator: it takes 
21 seconds on my box, if I don't drop files! And if I do drop files, 
it breaks:

Exception in AE event handler function
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/argvemulator.py", 
line 89, in callback_wrapper
     rv = apply(_function, (_object,), _parameters)
   File 
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/argvemulator.py", 
line 104, in open_file
     fss = alias.Resolve()[0]
AttributeError: 'Carbon.File.Alias' object has no attribute 'Resolve'
AE error:  (-1, 'queue element not found during deletion')
in High Level Event: '0x61657674' '0x6f646f63'
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/argvemulator.py", 
line 53, in lowlevelhandler
     AE.AEProcessAppleEvent(event)
Error: (-1, 'queue element not found during deletion')

>Regarding the Idle problem: I'm not sure why this --extra argument is
>there in the first place; perhaps it's not needed with the new
>bundlebuilder-based BuildApplet?

I'm passing a directory that needs to go into Resources. Is there is 
a better option to use than --extra?

-Tony
--============_-1166521948==_ma============
Content-Type: text/html; charset="us-ascii"

<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: [Pythonmac-SIG] IDLE etc build from
CVS</title></head><body>
<div>Hi Just,</div>
<div><br></div>
<div>At 1:29 PM +0100 2/18/03, Just van Rossum wrote:</div>
<blockquote type="cite" cite>Tony Lownds wrote:<br>
<br>
&gt; I think there may be another problem with the latest change
to<br>
&gt; applets: The __main__.py file used to be executed with the
-psn<br>
&gt; arguments filtered out, but now the -psn arguments are not
getting<br>
&gt; filtered out.<br>
&gt;<br>
&gt; Is -psn argument handling the responsibility of the main
program?<br>
</blockquote>
<blockquote type="cite" cite>Yes. But perhaps BuildApplet can provide
a wrapper that handles this.</blockquote>
<div><br></div>
<div>Since BuildApplet did do so in 2.2, I think providing a wrapper
would be a Good Thing.</div>
<div><br></div>
<blockquote type="cite" cite>&gt; Or should bundlebuilder take care of
that?<br>
<br>
No, there are cases where the -psn argument is needed by the
main</blockquote>
<blockquote type="cite" cite>program (possibly only apps made with
PyObjC).</blockquote>
<div><br></div>
<div>So it's not bundlebuilder's responsibility, but it may be
BuildApplets' responsibility.</div>
<div><br></div>
<div>If the main program intends to ignore the -psn argument, it's
easy enough to just do that in the main program:</div>
<div><br></div>
<div>if len(sys.argv) &gt; 1 and sys.argv[1][:4] == '-psn':</div>
<div>&nbsp;&nbsp;&nbsp; del sys.argv[1]</div>
<div><br></div>
<div>...but the wrapper script could also simply drop the &quot;$1&quot;
from the exec line too.</div>
<div><br></div>
<div>Handling the -psn argument properly in the main program also
seems easy enough:</div>
<div><br></div>
<div>import argvemulator</div>
<div>argvemulator.ArgvCollector().mainloop()</div>
<div><br></div>
<div>I'm worried about the extra startup time with argvemulator: it
takes 21 seconds on my box, if I don't drop files! And if I do drop
files, it breaks:</div>
<div><br></div>
<div><tt><font size="+1" color="#000000">Exception in AE event handler
function<br>
Traceback (most recent call last):<br>
&nbsp; File
&quot;/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3<span
></span>/plat-mac/argvemulator.py&quot;, line 89, in
callback_wrapper<br>
&nbsp;&nbsp;&nbsp; rv = apply(_function, (_object,), _parameters)<br>
&nbsp; File
&quot;/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3<span
></span>/plat-mac/argvemulator.py&quot;, line 104, in open_file<br>
&nbsp;&nbsp;&nbsp; fss = alias.Resolve()[0]<br>
AttributeError: 'Carbon.File.Alias' object has no attribute
'Resolve'<br>
AE error:&nbsp; (-1, 'queue element not found during deletion')<br>
in High Level Event: '0x61657674' '0x6f646f63'<br>
Traceback (most recent call last):<br>
&nbsp; File
&quot;/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3<span
></span>/plat-mac/argvemulator.py&quot;, line 53, in
lowlevelhandler<br>
&nbsp;&nbsp;&nbsp; AE.AEProcessAppleEvent(event)</font></tt></div>
<div><tt><font size="+1" color="#000000">Error: (-1, 'queue element
not found during deletion')</font></tt></div>
<div><br></div>
<blockquote type="cite" cite>Regarding the Idle problem: I'm not sure
why this --extra argument is<br>
there in the first place; perhaps it's not needed with the
new</blockquote>
<blockquote type="cite" cite>bundlebuilder-based
BuildApplet?</blockquote>
<div><br></div>
<div>I'm passing a directory that needs to go into Resources. Is there
is a better option to use than --extra?</div>
<div><br></div>
<div>-Tony</div>
</body>
</html>
--============_-1166521948==_ma============--