Random on Windows
15May2007 [webprog]
Have been trying to get this site running on my Windows box at work, which has been an interesting experience... Some of the things I'd done to set it up properly were particularly helpful - using SVN and using separate settings modules both make it really easy to tweak things without breaking the site in its other instances.
Most things just worked - going from *nix to Windows is pretty easy, it's going the other way that usually hurts... So far only ran into one weird bit, with my randoms app. The random image loading just wasn't working. I loaded up the python shell and tried there; still no good, using the bare minimum of python code. But after trying open(photo_path).read()
on a few different files, I noticed that it was returning very similar strings, and that they were a lot shorter than they should have been... Loaded up the python help (love being able to write p = open(photo_path)
and help(p)
to find out everything I can do!) and discovered a buffer setting. Sure enough, had to explicitly tell it not to buffer the file, but just read it all in one hit. No idea what the environmental difference is, but that's solved my problems, and I've just tested on my Linux box at home and it works properly here too.
One little change then (which I've made to the original post also):
open(photo_path).read()
becomes:
open(photo_path,'rb',0).read()
« Weeping for a Film :: iTunes, Now With Added Freedoms »
Related [webprog]
- None of these seem to get in the way (17May2010)
- IE6 and 7 on OSX (20Sep2008)
In which I run IE 6 and 7 on OSX; the entire process using free software - Random on Windows (15May2007)
In which I am baffled by the mystery that is Windows, and once more wooed by the ease with which one can make Python work, even there - Now ETagging Right! (17Apr2007)
In which I stop fighting the framework and let Django handle ETags the right way - Semantics and Style :: Markup for Dialogue (30Dec2006)
- Winter with Django (02Dec2006)
- Drop that double-u-double-u-double-u-dot (08Nov2005)
- Blog/Search (07Oct2005)
- Converting Relative to Absolute links in PHP (preg_replace) (21Sep2005)
- Think You’re Fighting Spam? (14Sep2005)
- BBC backstage access (12May2005)
- funky google trick (28Sep2004)
- The name of this class, ‘abc’, conflicts with the name of another class that was loaded, ‘abc’ (28Jun2004)
- The Altar Of Reason (10Jun2004)
- Domain.com.au Feedback (17May2004)
- aligned with evil (11May2004)
- flash gallery thingy (08Apr2004)