473,659 Members | 3,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

i'm getting the following error:
mechanize._resp onse.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._resp onse.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_cookiej ar(cj)
br.set_handle_r edirect(True)
br.set_handle_r eferer(True)
br.set_handle_r obots(False)
br.addheaders = [('User-Agent', 'Firefox')]

url2 ="http://www.quantcast.c om/xxxx/traffic"
#gets the page (url) from the quantcast app
url2=url2.repla ce("xxxx",url)
print "url2=",url 2
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 7042
bruce wrote:
i'm getting the following error:
mechanize._resp onse.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._resp onse.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_cookiej ar(cj)
br.set_handle_r edirect(True)
br.set_handle_r eferer(True)
br.set_handle_r obots(False)
br.addheaders = [('User-Agent', 'Firefox')]

url2 ="http://www.quantcast.c om/xxxx/traffic"
#gets the page (url) from the quantcast app
url2=url2.repla ce("xxxx",url)
print "url2=",url 2
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
3499
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 message: "Fatal Python error: Interpreter not initialized (version mismatch?)" However, Python does seem to be initialized. Py_IsInitialized() returns 1, and I can PyImport_Import() and I can run scripts successfully from my program.
1
10268
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 hangs with the following message: Fatal Python error: PyEval_RestoreThread: NULL tstate The strange thing is that this happens in a not very predictible way; some data is loaded and displayed in a self-made Tk widget. This works
1
6659
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 Response.BinaryWrite to display a dynamic image on a web page. The server is Windows 2000 SP4.
2
2283
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
5060
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 to catch that. How would I customize the error page then? Regards DC
1
1914
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 project many times to my application, but i getting this error now.please anybody try to help me out, if anybody solve this problem really million thanks to them. Thanks.
1
3561
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 exceptions from some of them. I throw them using: ::PyErr_SetString(::PyExc_RuntimeError, theErrorString); I crash the console when this function is invoked in the 'C' domain. I
3
4483
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 = MySQLdb.connection('localhost', 'root', '', 'books'); c=conn.cursor() cur = conn.cursor();
2
4770
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 Framework versions including 3.5. The web page does not have any code in the page_load event (in the .cs file) The default.html version of the same aspx file works fine, but not default.aspx itself, which produces a "%1 is not a valid Win32...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.