Re: strange problems with urllib2

2005-10-27 Thread jdonnell
I haven't checked them, but will do it now. However, I don't have problems with anything but python. I can download that image in less than a second with wget or in my browser. I know that I had ipv6 problems before. I had to turn it off because of my nat router so I'll look into that sort of thing

strange problems with urllib2

2005-10-26 Thread jdonnell
When I run this code on windows it runs quickly (about a second per image) but when I run it on linux it runs very very slowly (10+ seconds per image). Is this a bug or am I missing something? On windows I tried 2.4.2 and 2.4.1 on linux i'm running 2.4.1 print 'starting' f = urllib2.urlopen('http:

Re: is there a better way to check an array?

2005-09-01 Thread jdonnell
Thanks for all the help everyone. Steve, sets are perfect. I didn't even realize they existed. Somehow I completely missed that part of the tutorial. Thanks :) -- http://mail.python.org/mailman/listinfo/python-list

is there a better way to check an array?

2005-09-01 Thread jdonnell
I want to check if a value is in an array. I'm currently doing it as follows, but I just don't like this way of doing it. It seems unpythonic. fieldIsRequired = true try: notRequiredAry.index(k) fieldIsRequired = false except ValueError: pass # throw expception if field is required an

Re: can't start new thread

2005-08-31 Thread jdonnell
>Maybe some other VPS(s) under the host OS have spun enough processes >or threads to make the host OS exhaust some limit. I'm not familiar with any hard limits in linux. Is there a config file with these settings? -- http://mail.python.org/mailman/listinfo/python-list

can't start new thread

2005-08-31 Thread jdonnell
I posted this about a month ago and peter asked for a stack trace. I didn't get the error again until yesterday and here is the stack trace and what I posted before. Traceback (most recent call last): File "./ab.py", line 240, in ? main() File "./ab.py", line 217, in main abThread.star

can't start new thread

2005-07-08 Thread jdonnell
I'm at a loss on this one. I have a multithreaded script that gets 'thread.error: can't start new thread' errors seemingly randomly. I just got it right after starting the script when it was trying to create the 5th thread. Usually the script will run for a while before throwing this error, but som

Re: adodb, sql server, and last insert id

2005-05-04 Thread jdonnell
Thanks for the reply. I found that before I posted, but that doesn't look thread safe and I haven't found anything that says it is or isn't. -- http://mail.python.org/mailman/listinfo/python-list

adodb, sql server, and last insert id

2005-05-02 Thread jdonnell
I'm not very familiar with sql server or adodb. I'm writing a python script that uses adodb as described at http://www.ecp.cc/pyado.html, but I can't figure out how to get the id of my last insert. -- http://mail.python.org/mailman/listinfo/python-list

Re: problems with  character

2005-03-23 Thread jdonnell
Thanks everyone, I got it working earlier this morning using deelan's suggestion. I modified the code in his link so that it removes rather than replaces the characters. Also, this was my first experience with unicode and what confused me is that I was thinking of a unicode object as an encoding,

Re: problems with  character

2005-03-23 Thread jdonnell
Thanks for all the replies. I just got in to work so I haven't tried any of them yet. I see that I wasn't as clear as I should have been so I'll clarify a little. I'm grabbing some data from msn's rss feed. Here's an example. http://search.msn.com/results.aspx?q=domain+name&format=rss&FORM=ZZRE Th

problems with  character

2005-03-22 Thread jdonnell
I have a mysql database with characters like   » in it. I'm trying to write a python script to remove these, but I'm having a really hard time. These strings are coming out as type 'str' not 'unicode' so I tried to just record[4].replace('Â', '') but this does nothing. However the followin

Re: web spider and password protected pages

2005-02-16 Thread jdonnell
"Nevertheless, perhaps you'll still post the answer here so that others who come along later can benefit from your experience in the same way that you benefited from reading whatever page you found (even if you didn't benefit from my suggestions...). " Your funny :) Perhaps you should take your ow

Re: web spider and password protected pages

2005-02-16 Thread jdonnell
"I quickly found a page that starts "Here is an explanation about how to handle password protected sites." ... I hope that teaches you a bit about how to fish, rather than just giving you one. ;-) " Actually, I found a much easier solution, but since you know how to fish I don't need to tell you

web spider and password protected pages

2005-02-16 Thread jdonnell
I've been writing a simple web spider for fun, and I've run into a problem I can't figure out. The spider hangs (waits for username and pass) when I hit a page that requires .htaccess authentication. self.f = urllib.urlopen('http://blogbloc.com/~jay/test/') #nothing below here gets executed print

Re: Getting milliseconds in Python

2005-02-16 Thread jdonnell
"This is no good, I am looking for milliseconds, not seconds.. as stated above. " The docs are not very clear. I had the same issue when I was trying to do the same thing, but the time and datetime modules return milliseconds on my linux machines. -- http://mail.python.org/mailman/listinfo/pytho

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread jdonnell
" Since this is (sort of) my second request it must not be an easy solution. Are there others using Python to connect MsSQL? " http://sourceforge.net/projects/mysql-python -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP Embedded In Python

2005-02-09 Thread jdonnell
Ok, I'm still a little confused. You mention header.html and access.php. For access.php use the os call. You'll probably want to use popen, and you also need to change your php script slightly. In order to run php scripts from the command line you have to put #!/usr/bin/php as the first line in th

Re: PHP Embedded In Python

2005-02-08 Thread jdonnell
Well it depends on how php is installed. Is it a linux system? Do you know how to run a php script from the command line? Once you have the php script running from the command line then you need to use the os module in python. There are a couple different ways to do it. Read the following for more

Re: PHP Embedded In Python

2005-02-07 Thread jdonnell
I'm not sure exactly what your trying to do, but I use php and python together a lot. I usually call the python script from php with the passthru function like this: -- http://mail.python.org/mailman/listinfo/python-list