Re: Retrieve Custom 404 page.

2008-11-17 Thread godavemon
Perfect! Thanks! On Nov 17, 4:16 pm, Albert Hopkins <[EMAIL PROTECTED]> wrote: > On Mon, 2008-11-17 at 13:59 -0800, godavemon wrote: > > I'm using urllib2 to pull pages for a custom version of a web proxy > > and am having issues with 404 errors.  Urllib2 does a great

Retrieve Custom 404 page.

2008-11-17 Thread godavemon
I'm using urllib2 to pull pages for a custom version of a web proxy and am having issues with 404 errors. Urllib2 does a great job of letting me know that a 404 happened with the following code. import urllib2 url = 'http://cnn.com/asfsdafsadfasdf/' try: page = urllib2.urlopen( url ) except u

Re: Hamming Distance

2008-06-19 Thread godavemon
Great thanks! On Jun 19, 5:37 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Jun 19, 4:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > > > > > I need to calculate the Hamming Distance of two integers. The hamming > > distance is the number of bits in two integ

Re: Hamming Distance

2008-06-19 Thread godavemon
Awesome! Thanks a lot. On Jun 19, 5:00 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Jun 19, 6:27 pm, godavemon <[EMAIL PROTECTED]> wrote: > > > > > I need to calculate the Hamming Distance of two integers. The hamming > > distance is the number of bits

Hamming Distance

2008-06-19 Thread godavemon
I need to calculate the Hamming Distance of two integers. The hamming distance is the number of bits in two integers that don't match. I thought there'd be a function in math or scipy but i haven't been able to find one. This is my function but it seems like there should be a faster way. I do t

Re: MySQL-python Error

2007-12-30 Thread godavemon
Hopefully you've found it by now and didn't have a frustrating christmas :). Get the source from sourceforge and then follow the instructions here. http://www.davidcramer.net/code/57/mysqldb-on-leopard.html Worked perfectly for me on OSX 10.5, python 2.5. Was frustrating to find. Good luck!

Re: path error

2007-07-20 Thread godavemon
On Jul 20, 11:45 am, godavemon <[EMAIL PROTECTED]> wrote: > On Jul 20, 11:42 am, godavemon <[EMAIL PROTECTED]> wrote: > > > I'm on an intel macbook using OS X 10.4 and for some reason my path is > > being interpreted incorrectly. See the example: > > &g

Re: path error

2007-07-20 Thread godavemon
On Jul 20, 11:42 am, godavemon <[EMAIL PROTECTED]> wrote: > I'm on an intel macbook using OS X 10.4 and for some reason my path is > being interpreted incorrectly. See the example: > > [EMAIL PROTECTED] pwd > /Users/dave/til/jared <- dirname = jar

path error

2007-07-20 Thread godavemon
I'm on an intel macbook using OS X 10.4 and for some reason my path is being interpreted incorrectly. See the example: [EMAIL PROTECTED] pwd /Users/dave/til/jared <- dirname = jared [EMAIL PROTECTED] python ... >>> import os >>> os.path.abspath('') '/Users/dave/til/Jared' <- dirname

Re: newb question: file searching

2006-08-08 Thread godavemon
Hey, I've done similar things. You can use system comands with the following import os os.system('command here') You'd maybe want to do something like dir_name = 'mydirectory' import os os.system('ls ' +dir_name + ' > lsoutput.tmp') fin = open('lsoutput.tmp', 'r') file_list = fin.readlines() fi

Re: newb question: file searching

2006-08-08 Thread godavemon
Hey, I've done similar things. You can use system comands with the following import os os.system('command here') You'd maybe want to do something like dir_name = 'mydirectory' import os os.system('ls ' +dir_name + ' > lsoutput.tmp') fin = open('lsoutput.tmp', 'r') file_list = fin.readlines() fi

Re: binary conversion issues

2006-08-08 Thread godavemon
ile's case it wrote out an extra 4 bytes in the middle somewhere. Strange. Thanx for your help. Grant Edwards wrote: > On 2006-08-08, godavemon <[EMAIL PROTECTED]> wrote: > > > I'm using python's struct and binascii modules to write some values > > from my p

binary conversion issues

2006-08-08 Thread godavemon
I'm using python's struct and binascii modules to write some values from my parser to binary floats. This works great for all of my binary files except one. For some reason this file is saving to 836 (stated by my command shell) bytes instead of 832 like it should. It sounds like an issue with w

Re: convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I've been a member for a while but I had no idea how helpful this form is. I had a one hour meeting and when I came back there were 4 replies. Thanks for your help! Scott David Daniels wrote: > godavemon wrote: > > I need to take floats and dump out their 4 byte hex representatio

convert floats to their 4 byte representation

2006-06-14 Thread godavemon
I need to take floats and dump out their 4 byte hex representation. This is easy with ints with the built in hex function or even better for my purpose def hex( number, size ): s = "%"+str(size) + "X" return (s % number).replace(' ', '0') but I haven't been able to find anything f