473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Trying to solve a python/mechanize "error 500" http error

i'm getting the following error:
mechanize._response.httperror_seek_wrapper: HTTP Error 500:

i'm running python 5.1
and mechanize 0.1.7b

I have no idea as to what I have to change/modify/include to handle this
issue. The link that I'm testing is at the bottom of the page. When I insert
the link into the browser, I actually get an err page.. so, I suspect that
there is a handler that I should be able to modify/use to handle this
situation...

Thoughts/Comments will be greatly appreciated...

Thanks
the output is:

www = www.1800ink.com
url2= http://www.quantcast.com/www.1800ink.com/traffic
Traceback (most recent call last):
File "./reseller_scrape_child.py", line 288, in <module>
q1 = shopfuncs.quant(rhref)
File "/adkiller/shopfuncs.py", line 56, in quant
br.open(url2)
File "build/bdist.linux-x86_64/egg/mechanize/_mechanize.py", line 203, in
open
File "build/bdist.linux-x86_64/egg/mechanize/_mechanize.py", line 254, in
_mech_open
mechanize._response.httperror_seek_wrapper: HTTP Error 500:
[root@toshiba adkiller]# ./reseller_scrape_child.py

my code segment looks like:
====================================
from mechanize import Browser
import mechanize
br = Browser()
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values1 = {'name' : 'Michael Foord',
'location' : 'Northampton',
'language' : 'Python' }
headers = { 'User-Agent' : user_agent }

#br.set_cookiejar(cj)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.addheaders = [('User-Agent', 'Firefox')]

url2 ="http://www.quantcast.com/xxxx/traffic"
#gets the page (url) from the quantcast app
url2=url2.replace("xxxx",url)
print "url2=",url2
br.open(url2)

=======================================

this works ok for most of the sites.. but something weird is happening with
the actual page:
http://www.quantcast.com/www.1800ink.com/traffic
thanks...

Jul 21 '08 #1
1 7019
bruce wrote:
i'm getting the following error:
mechanize._response.httperror_seek_wrapper: HTTP Error 500:

i'm running python 5.1
and mechanize 0.1.7b

I have no idea as to what I have to change/modify/include to handle this
issue. The link that I'm testing is at the bottom of the page. When I insert
the link into the browser, I actually get an err page.. so, I suspect that
there is a handler that I should be able to modify/use to handle this
situation...

Thoughts/Comments will be greatly appreciated...

Thanks
the output is:

www = www.1800ink.com
url2= http://www.quantcast.com/www.1800ink.com/traffic
Traceback (most recent call last):
File "./reseller_scrape_child.py", line 288, in <module>
q1 = shopfuncs.quant(rhref)
File "/adkiller/shopfuncs.py", line 56, in quant
br.open(url2)
File "build/bdist.linux-x86_64/egg/mechanize/_mechanize.py", line 203, in
open
File "build/bdist.linux-x86_64/egg/mechanize/_mechanize.py", line 254, in
_mech_open
mechanize._response.httperror_seek_wrapper: HTTP Error 500:
[root@toshiba adkiller]# ./reseller_scrape_child.py

my code segment looks like:
====================================
from mechanize import Browser
import mechanize
br = Browser()
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values1 = {'name' : 'Michael Foord',
'location' : 'Northampton',
'language' : 'Python' }
headers = { 'User-Agent' : user_agent }

#br.set_cookiejar(cj)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.addheaders = [('User-Agent', 'Firefox')]

url2 ="http://www.quantcast.com/xxxx/traffic"
#gets the page (url) from the quantcast app
url2=url2.replace("xxxx",url)
print "url2=",url2
br.open(url2)

=======================================

this works ok for most of the sites.. but something weird is happening with
the actual page:
http://www.quantcast.com/www.1800ink.com/traffic
thanks...
Looking up 500 error (here
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
gives me:

10.5.1 500 Internal Server Error

The server encountered an unexpected condition which prevented it from
fulfilling the request.
On some servers (Amazon), when you get 500 errors you are instructed to try
the request again. I don't know about this server.

-Larry
Jul 21 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew Ellem | last post by:
I'm using Python embedded in my app, and I've run into problems creating my own modules. I'm using Python version 2.3 compiled with MSVC .NET (not 2003). When I call Py_InitModule I get the...
1
by: reinhard | last post by:
Our project was developed with Python 2.0 and includes some Tk 8.3 extension widgets as well as python extensions using the CXX interface. After moving to Python 2.3 and TclTk 8.4 our program...
1
by: Snake Djip | last post by:
Hi, I have a problem with a home-made DLL used in an ASP environment. It is coded in VB6, apartment-threaded. The DLL returns a binary PNG stream (an image). I use it with ASP's...
2
by: guenais | last post by:
Hello When I use Pyparallel to access the parallel port in WinXP with Python I get an error saying that this is a priviledged instruction Any clue ? Mike
7
by: DC | last post by:
Hi, there is a 500;13 page one can configure in the website properties, but ..Net Framework 1.1 also delivers the "server too busy" message sometimes and the IIS custom error page does not seem...
1
by: rocksoft | last post by:
Hi, i got error "class not registered" when i try to create web setup and deployment project to my web application. i'm used Asp.net and c# to my application, i created web setup and deployment...
1
by: mmacrobert | last post by:
Hi Everyone, I've created a 'C' dll that is accessed via ctypes library containing a bunch of functions. I've successfully been able to use the functions. However, I would like to throw python...
3
by: geddy | last post by:
My OS: Ubuntu 7.04 distribution Mysql: Server version: 5.0.38-Ubuntu_0ubuntu1.2-log Ubuntu 7.04 distribution mysql-python:1.2.2 python:2.5 when I run the following script: import MySQLdb conn...
2
by: jake | last post by:
I am new to web development. I published a VS 2008 web page (default.aspx) file (along with its .cs file), using the "Publish Web Site" feature, to a Windows 2003 server that has all the .Net...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.