There was a bug found in the handling of binary data on Windows in
version of Spyce prior to v1.3.12. If you check the CHANGES file:
you will see that these should be fixed now. At least, the bug that was
reported was fixed. The problem is quite simple: the stream was being
read in 'text' mode, as opposed to 'binary' mode, and was therefore
being truncated at the first null, which could exist in SVG files, etc.
The two fixes were: the handler_dump method in spyceWWW.py was fixed to
open a file in mode 'rb'. See:
For the CGI handler, the following was added in spyceCGI.py:
if sys.platform == "win32":
import os, msvcrt
Perhaps you have discovered another instance of the same problem. I
imagine the solution would be a similar few lines. Could you send me a
small Spyce script that exhibits the problem, provide a sample file, and
also describe your configuration. I will try to replicate it.
All the best,
Rimon Barr - rimon@... - http://rimonbarr.com - Y!IM batripler
On Tue, 12 Oct 2004, Howard Jones wrote:
> First, a hearty thanks to all who have developed Spyce!
> While trying to resolve a difficulty with Spyce, I ran across a
> discussion thread regarding the Python cgi-module at'
> It relates to a similar quandry I'm presently in: the seeming inability
> of Spyce to handle POSTed binary file (image) uploads in a Windows
> development environment. I am currently working in an 'Apache2triad'
> (http://apache2triad.sourceforge.net/) setup running on a Windows '98
> laptop. (Yes, I know, but it's a long story and involves issues of
> Adobe's SVG plugin being full-featured only on Windows Internet
> Explorer, etc.... Besides, it appears there would be the same problem on
> Windows 2000 or XP.)
> Briefly, I am in the final phase of building a web site to support
> graphics archiving with techniques and software I've developed over the
> years (mostly on Windows platforms). A number of utilities and
> processing applications are written in Python and require a user to
> upload both SVG and raster graphics onto the web server for analysis,
> markup, integration, etc.
> When I discovered Spyce I was very excited that it seemed to provide a
> way to integrate all of these pieces, including dynamic web pages,
> within a single Python environment. However, I finally decided to 'hedge
> my bets' and built the web page handling in PHP, using Spyce only to
> broker upload-processing.
> I am able to upload text files (such as SVG documents) via Spyce but
> any associated binary raster images do not get uploaded. Apparently
> (according to the above mentioned cgi-module discussion thread) the
> culprit is a default 'text-only' buffer deep inside of Windows that I
> find no way to reset from Spyce.
> Fortunately I have been able to 'kludge' a workaround from the PHP side
> (thank Goodness I hedged my bet!). PHP uploads the files, resizes them,
> handles database ops, and then forwards the SVG text file via GET to
> Spyce and on into the markup analysis.
> So, the good news is that my web site is nearing completion and is able
> to handle all of the operations I'd planned.
> The bad news is that instead of a single, easily manageable, processing
> environment I have an awkward assembly of components. Perhaps when
> eventually I get everything up on a *nix server I'll be able to bring
> all of the components together in Spyce. But it would be much better if
> I could work out all of the inevitable bugs on a Windows 'localhost'.
> Is there any chance that Spyce will become more robust for graphics
> developers working in a Windows development environment?
> Howard Jones