[Pythonmac-SIG] BuildApplication and FTPlib questions

Just van Rossum just@letterror.com
Mon, 28 Jun 1999 12:32:41 +0200


At 3:36 PM -0400 6/26/99, Niel M. Bornstein wrote:
>Hey there -
>
>I'm using Python 1.5.2b1 to make a small specialized FTP app, and I have a
>couple of questions.
>
>I used BuildApplication to build a stand-alone, and I am unsure about a
>couple things.  First, although I used EditPythonPrefs to delay the SIOUX
>console until needed, it opens immediately.  Is there some way I can
>guarantee that it doesn't open until I do a print?

Did you try dropping your app onto EditPythonPrefs and then setting the
SIOUX option? The easiest thing in the long run is to create a resource
file in the same directory as your main program like this:
    MyMainProgram.py
    MyMainProgram.rsrc
And then drop the resource file onto EditPythonPrefs and edit your prefs.
Your edited prefs will now be included in your app when running
BuildApplication or BuildApplet.

>Second, the major functionality of this app is to transfer files by FTP.
>I'm not sure if I'm doing something wrong, but the transfer seems very
>slow... what kind of effect does the block size parameter have on the
>transfer?  Does it have to match the block size on the open() call?

Hm, no idea here. Anyone else?

>Also, in my test environment, the FTP sometimes has hung because the server
>was not responding.  Eventually, it times out with an error, but is there a
>way to capture a command-. to cancel the transfer?

This should work as is:

try:
    ...do ftp stuff...
except KeyboardInterrupt:
    ...user cancelled...

Just