[IronPython] End of the World? No just end of the line.

M. David Peterson xmlhacker at gmail.com
Mon Mar 5 20:48:09 CET 2007

Oh, and if any of you want to play with the result of Sylvain's sleuth
detective work coupled with our ongoing hybrid efforts to merge Amplee with
AtomicXML, you can access a ClickOnce app** @

>From the commandline,

>>> from cherrypyserver import server

Which will result in,

Creating APP store
> Creating the service WSGI application
> Creating the collection WSGI application
> All good!

>>> server.start()

Will then allow access to http://localhost:9999/ at which point you will

<?xml version="1.0" encoding="utf-8"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
  <atom:title type="text">My Music</atom:title>

in response.

Please see  http://trac.defuze.org/wiki/amplee for extended detail on where
to go from here.
Please see
extended detail as to where we're taking all of this.

Code is @ http://extf.googlecode.com/svn/trunk/WebApp for a standalone
version of the above that works on any .NET-enabled client (MS.NET or Mono:
both work equally as well, and in fact it was the fact that it worked with
Mono and did not with MS.NET that led to Sylvain's discovery and fix
mentioned at the start of this thread.  Mono helping to discover and solve
MS.NET <~> Unix* incompatibility issues > I *LOVE* IT! :D)

ClickOnce app is @ http://extf.googlecode.com/svn/trunk/Xameleon.ClickOnce/

Get all of this integrated into a nice, simple, and clean browser-based UI
is on tap for today.  When in decent demoable shape, one of us will update
this thread.

** From within Internet Explorer > I tried the ClickOnce Fx plugin suggested
on this list a while back, and could never get it to work > Any ideas from
any of you out there?)

On 3/5/07, M. David Peterson <xmlhacker at gmail.com> wrote:
> I would just like to take a time out to congratulate Sylvain on coming up
> with a subject line that brings tears of joy to a phreak-geek like me who
> takes pride in coming up with cheezy one-liners such as that so eloquently
> displayed in the subject of the original post.
> Thanks for the laugh/smile, Sylvain! :D
> On 3/3/07, Sylvain Hellegouarch <sh at defuze.org> wrote:
> >
> > Hi folks,
> >
> > Working with M. David Peterson trying to run the CherryPy HTTP server on
> > IP under Windows we ran into a fairly subtle bug that was actually not
> > so subtle at all.
> >
> > When the server accepts a connection it maps the socket into a file
> > object so that it can read and write with a nice API.
> >
> > When using IPCE socket module this achieves the same by doing this:
> >
> > def makefile(self, mode='r', bufsize=-1):
> >     stream = NetworkStream(self.socket )
> >     return file(stream, mode)
> >
> > This works great when you don't care about the way the end of the lines
> > is defined but if you do be ready for some hair-tearing hours.
> >
> > Indeed with IronPython running on Windows with the .NET framework the
> > end of the line is defined as <LF> whereas for instance on Linux with
> > Mono it's <CR><LF>.
> >
> > If I'm not mistaken CPython always ensures the end of line is <CR><LF>
> > so that people don't have to worry about the underlying OS behavior.
> >
> > The problem I faced is that HTTP marks the end of the header lists via a
> > <CR><LF> but because CherryPy reads the socket as a file it only gets a
> > <LF> with IP under Windows and therefore fails miserably. I've added a
> > test for a single <LF> in my copy of CherryPy and it fixed the problem.
> > But this is a bit of a hassle.
> >
> > I don't think there is a bug of any of the part here. However I believe
> > there should be either a very clear warning that this difference will
> > always exists and Python developer will have to check for that case, or
> > maybe IP should find a way to ensure that <CR><LF> is always returned
> > even under Windows (which I doubt is an easy thing to do).
> >
> > In any case if your code depends on the line ending be aware of that
> > difference as you could end up swearing too loud for your own good.
> >
> > - Sylvain
> > _______________________________________________
> > users mailing list
> > users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> --
> /M:D
> M. David Peterson
> http://mdavid.name | http://www.oreillynet.com/pub/au/2354 |
> http://dev.aol.com/blog/3155


M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070305/920f476f/attachment.html>

More information about the Ironpython-users mailing list