cgitb and Apache
I have a cgi running in my alpha environment and, of course, everything works fine. In beta, when I attempt to access a page via our proxy, which works perfectly in alpha. It attempts to call cgitb but freezes for while and then exits. The Apache log show: [Mon Dec 22 23:49:25 2008] [error] [client 172.16.143.75] /usr/local/ python26/lib/python2.6/cgitb.py:173: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 [Mon Dec 22 23:49:25 2008] [error] [client 172.16.143.75] value = pydoc.html.repr(getattr(evalue, name)) The source for cgitb at 173 is: pydoc.html.escape(str(evalue)))] if isinstance(evalue, BaseException): for name in dir(evalue): if name[:1] == '_': continue ---> value = pydoc.html.repr(getattr(evalue, name)) exception.append('\n%s%s =\n%s' % (indent, name, value)) import traceback return head + ''.join(frames) + ''.join(exception) + ''' Any suggestions on how to deal with this? -- http://mail.python.org/mailman/listinfo/python-list
urlparse import Faillure
Python 2.5.2 (r252:60911, Aug 28 2008, 23:51:17) [GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import CGIHTTPServer Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.5/CGIHTTPServer.py", line 28, in import urllib File "/usr/local/lib/python2.5/urllib.py", line 30, in from urlparse import urljoin as basejoin File "/usr/local/lib/python2.5/urlparse.py", line 3, in See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, ImportError: cannot import name urlparse >>> urlparse.py """Parse (absolute and relative) URLs. See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June 1995. """ __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", "urlsplit", "urlunsplit"] It points to the third line of the comment. Any ideas on how to proceed with the debugging? -- http://mail.python.org/mailman/listinfo/python-list
Re: urlparse import Faillure
On Oct 10, 1:48 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Thu, 9 Oct 2008 22:47:58 -0700 (PDT), Robert Hancock wrote: > >>>> import CGIHTTPServer > ... > > ImportError: cannot import name urlparse > > ... > > It points to the third line of the comment. Any ideas on how to > > proceed with the debugging? > > Have you tried getting rid of this comment? I doubt that > the comment is a reason of this error, but it seems that > it shadows the real problem. Moreover, try to import urlparse > itself and check if you got the pyc file for urlparse.py > in your */lib/python2.5/ directory. > > -- > Regards, > Wojtek Walczak,http://tosh.pl/gminick/ It turns out that I had a script named urlparse.py in my path in another directory. I'm still not sure why the traceback pointed to the comment. -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 and Python 2.5.1
On Jun 16, 5:15 pm, Gerhard Häring <[EMAIL PROTECTED]> wrote: > milan_sanremo wrote: > > I have sqlite installed, but when I try to importsqlite3I receive: > > > Python 2.5.1 (r251:54863, Nov 3 2007, 02:54:36) [C] on sunos5 > > Type "help", "copyright", "credits" or "license" for more information. > importsqlite3 > > Traceback (most recent call last): > > File "", line 1, in > > ImportError: No module namedsqlite3 > > > Yet: > > > # find /usr/local/python -name "sqlite*" -print > > /usr/local/python/lib/python2.5/sqlite3 > > > # /opt/csw/bin/sqlite3 > > SQLite version 3.2.2 > > Enter ".help" for instructions > > sqlite> > > > What is missing? > > You compiled Python yourself. During that, theSQLite3header files > could not be found, so thesqlite3module was not compiled/installed. > > -- Gerhard Thanks, I'll recompile. -- http://mail.python.org/mailman/listinfo/python-list
Relative Package Import
mypackage/ __init__.py push/ __init__.py dest.py feed/ __init__py subject.py In subject.py I have from ..push import dest But i receive the error: Caught exception importing module subject: File "/usr/local/python/lib/python2.5/site-packages/pychecker/ checker.py", line 621, in setupMainCode() module = imp.load_module(self.moduleName, file, filename, smt) File "subject.py", line 1, in () from ..feed import dest ValueError: Attempted relative import in non-package What am I missing? -- http://mail.python.org/mailman/listinfo/python-list
Twisted: Get Protected HTTPS Page via Proxy with Authentication
from twisted.web import client from twisted.internet import reactor import base64 import sys def printPage(data): print data reactor.stop() def printError(failure): print >> sys.stderr, "Error:", failure.getErrorMessage() reactor.stop() if len(sys.argv) == 4: url = sys.argv[1] username = sys.argv[2] password = sys.argv[3] basicAuth = base64.encodestring('%s:%s' % (username, password)) authHeader = "Basic " + basicAuth.strip() client.getPage(url, headers={"Authorization": authHeader}).addCallback(printPage).addErrback(printError) reactor.run() else: print 'Usage: get_web_page.py ' If I run this against a password protected HTTP(S) site from a host that has direct access to the Internet it works fine. I now have to move it behind a proxy that requires authentication. The Twisted documentation did not make it clear (to me) how to add proxy authentication and I cannot find an example on the Internet. I've tried adding an additional Proxy-Authentication header to the call, but that doesn't help Any ideas would be greatly appreciated. Command line args: http://feedparser.org/docs/examples/basic_auth.xml test basic -- http://mail.python.org/mailman/listinfo/python-list
Re: Twisted: Get Protected HTTPS Page via Proxy with Authentication
This works: # Proxy credentials proxyAuth = base64.encodestring('%s:%s' % (proxy_username, proxy_password)) proxy_authHeader = "Basic " + proxyAuth.strip() # Web site credentials basicAuth = base64.encodestring('%s:%s' % (username, password)) authHeader = "Basic " + basicAuth.strip() return client.getPage(url, headers={"Authorization": authHeader, 'Proxy-Authenticate': proxy_authHeader}) -- http://mail.python.org/mailman/listinfo/python-list