upload file using cgi on Win2k IIS

Ignacio Vazquez-Abrams ignacio at openservices.net
Thu Oct 11 15:26:51 EDT 2001


On Thu, 11 Oct 2001, Jason McWilliams wrote:

> Turns out that I didnt have windows handling Python scripts with the -u
> arg... to handle binary data unbuffered.  This fixed the problem by
> setting .py files to use python -u %s %s on IIS.  (thanks to another
> person on the list!)
>
> Although, I am trying to Freeze the program into a .exe file.  In that
> case it acts the same as before.  Not sure how to get freeze to do the
> same as python -u.

Well, setting the environment variable PYTHONUNBUFFERED will do it, although
in your case a better option might be to modify Python/frozenmain.c:

--- Python/frozenmain.c.orig	Thu Oct 11 15:23:24 2001
+++ Python/frozenmain.c	Thu Oct 11 15:23:47 2001
@@ -32,14 +32,10 @@

 	if ((p = getenv("PYTHONINSPECT")) && *p != '\0')
 		inspect = 1;
-	if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0')
-		unbuffered = 1;

-	if (unbuffered) {
-		setbuf(stdin, (char *)NULL);
-		setbuf(stdout, (char *)NULL);
-		setbuf(stderr, (char *)NULL);
-	}
+	setbuf(stdin, (char *)NULL);
+	setbuf(stdout, (char *)NULL);
+	setbuf(stderr, (char *)NULL);

 #ifdef MS_WIN32
 	PyInitFrozenExtensions();

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>

   "As far as I can tell / It doesn't matter who you are /
    If you can believe there's something worth fighting for."
       - "Parade", Garbage





More information about the Python-list mailing list