authentication for xmlrpc via cgi
I'm using python 2.2 (hopefully we'll be upgrading our system to 2.3 soon) and I'm trying to prototype some xml-rpc via cgi functionality. If I override the Transport class on the xmlrpclib client and add some random header like "Junk", then when I have my xmlrpc server log it's environment when running, I see the HTTP_JUNK header. If I do this with AUTHORIZATION, the header is not found. Does this ring a bell for anyone? Am I misunderstanding how to use this header? I'm guessing that Apache might be eating this header, but I don't know why. thanks, dustin -- http://mail.python.org/mailman/listinfo/python-list
Re: python execution path
Peter Hansen wrote: > Dustin Lee wrote: > > I'm wondering if there is a way to get python to show each line as it > > is executed, sort of like sh -x does for shell programs. Seems like > > this would be a nice debugging aid. > > The best approach, if it's really intended to be a debugging > aid, might be to learn about "pdb", starting perhaps with the > following line inserted shortly above where you think your > bug might be: > > import pdb; pdb.set_trace() > > (run the code, wait for the prompt, type "?" for help, then > read the docs ;-) ) > > -Peter This is more of a what if-ish question I guess. I use pdb fairly regularly, I'm just looking to extend my debugging toolkit. I saw an article recently about how perl has the sh -x type functionality and I was curious if anything like that was possible in python. Not entirely sure how it would make my life better, but it seems intriguing. -- http://mail.python.org/mailman/listinfo/python-list
trying to find nose.tools.assert_raises_regexp
$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import nose.tools >>> nose.__version__ '1.3.3' >>> nose.tools.assert_raises_regexp Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'assert_raises_regexp' I see people using code like the following from nose.tools import assert_equals, assert_raises_regexp (the above line is from diy-lisp - a python project on githup) but I'm not able to find a version of nose that explicitly mentions this function. perplexed... -- https://mail.python.org/mailman/listinfo/python-list
Re: trying to find nose.tools.assert_raises_regexp
I knew it had to be something like that. Thanks. Time to upgrade. On Friday, May 23, 2014 6:07:08 PM UTC-6, Ned Batchelder wrote: > On 5/23/14 6:09 PM, qhfgva wrote: > > > $ python > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) > > > [GCC 4.4.3] on linux2 > > > Type "help", "copyright", "credits" or "license" for more information. > > >>>> import nose.tools > > >>>> nose.__version__ > > > '1.3.3' > > >>>> nose.tools.assert_raises_regexp > > > Traceback (most recent call last): > > >File "", line 1, in > > > AttributeError: 'module' object has no attribute 'assert_raises_regexp' > > > > > > > > > I see people using code like the following > > > > > > from nose.tools import assert_equals, assert_raises_regexp > > > > > > (the above line is from diy-lisp - a python project on githup) > > > > > > but I'm not able to find a version of nose that explicitly mentions this > > function. > > > > > > perplexed... > > > > > > > nose.tools auto-creates these names from the names in unittest, with > > this code: > > https://github.com/nose-devs/nose/blob/master/nose/tools/trivial.py#L46 > > > > You don't have assert_raises_regexp because your unittest module doesn't > > have assertRaisesRegexp. That method is new in 2.7, but you are using > > 2.6.5, so it doesn't exist. > > > > -- > > Ned Batchelder, http://nedbatchelder.com On Friday, May 23, 2014 6:07:08 PM UTC-6, Ned Batchelder wrote: > On 5/23/14 6:09 PM, qhfgva wrote: > > > $ python > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) > > > [GCC 4.4.3] on linux2 > > > Type "help", "copyright", "credits" or "license" for more information. > > >>>> import nose.tools > > >>>> nose.__version__ > > > '1.3.3' > > >>>> nose.tools.assert_raises_regexp > > > Traceback (most recent call last): > > >File "", line 1, in > > > AttributeError: 'module' object has no attribute 'assert_raises_regexp' > > > > > > > > > I see people using code like the following > > > > > > from nose.tools import assert_equals, assert_raises_regexp > > > > > > (the above line is from diy-lisp - a python project on githup) > > > > > > but I'm not able to find a version of nose that explicitly mentions this > > function. > > > > > > perplexed... > > > > > > > nose.tools auto-creates these names from the names in unittest, with > > this code: > > https://github.com/nose-devs/nose/blob/master/nose/tools/trivial.py#L46 > > > > You don't have assert_raises_regexp because your unittest module doesn't > > have assertRaisesRegexp. That method is new in 2.7, but you are using > > 2.6.5, so it doesn't exist. > > > > -- > > Ned Batchelder, http://nedbatchelder.com On Friday, May 23, 2014 6:07:08 PM UTC-6, Ned Batchelder wrote: > On 5/23/14 6:09 PM, qhfgva wrote: > > > $ python > > > Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) > > > [GCC 4.4.3] on linux2 > > > Type "help", "copyright", "credits" or "license" for more information. > > >>>> import nose.tools > > >>>> nose.__version__ > > > '1.3.3' > > >>>> nose.tools.assert_raises_regexp > > > Traceback (most recent call last): > > >File "", line 1, in > > > AttributeError: 'module' object has no attribute 'assert_raises_regexp' > > > > > > > > > I see people using code like the following > > > > > > from nose.tools import assert_equals, assert_raises_regexp > > > > > > (the above line is from diy-lisp - a python project on githup) > > > > > > but I'm not able to find a version of nose that explicitly mentions this > > function. > > > > > > perplexed... > > > > > > > nose.tools auto-creates these names from the names in unittest, with > > this code: > > https://github.com/nose-devs/nose/blob/master/nose/tools/trivial.py#L46 > > > > You don't have assert_raises_regexp because your unittest module doesn't > > have assertRaisesRegexp. That method is new in 2.7, but you are using > > 2.6.5, so it doesn't exist. > > > > -- > > Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
circular imports
I'm working with a large code base that I'm slowly trying to fix "unpythonic" features of. One feature I'm trying to fix is the use of: # how things are now sys.path.append('/general/path/aaa/bbb') # lots of lines like this to specific dirs import foo Insead I'd rather have PYTHONPATH already include '/general/path/' and then just use: # how I'd like them to be from aaa.bbb import foo So I thought I'd just add the necessary __init__.py files and then things would just work. Unfortunately trying this exposed a large number of circular imports which now cause the files to fail to load. Any ideas why the sys.path.append method has no problem with circular imports whereas doing thing the "right way" chokes. thanks, dustin -- http://mail.python.org/mailman/listinfo/python-list
Re: circular imports
All of the __init__.py files are empty and I don't know of any overlapping of names. Like I said this is code that works fine, I'm just trying to clean up some things as I go. Here are my working examples: x1.py == # how things work in our code now: # called with home/dlee/test/module python aaa/x1.py import sys sys.path.append('/home/dlee/test/module') import x2 def goo(): print 'hi from goo' if __name__ == '__main__': x2.foo() x2.py == import sys sys.path.append('/home/dlee/test/module') import x1 def foo(): print 'entered foo' x1.goo() y1.py == # this works but is not quite what I want # called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python aaa/y1.py" import aaa.y2 def goo(): print 'hi from goo' if __name__ == '__main__': aaa.y2.foo() y2.py == import aaa.y1 def foo(): print 'entered foo' aaa.y1.goo() z1.py == # how I'd like things to work, but is failing for me # called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python aaa/z1.py" from aaa import z2 def goo(): print 'hi from goo' if __name__ == '__main__': z2.foo() z2.py == om aaa import z1 def foo(): print 'entered foo' z1.goo() w1.py == # this would also be acceptible # called with "PYTHONPATH=$PYTHONPATH:/home/dlee/test/module python aaa/w1.py" import aaa.w2 as w2 def goo(): print 'hi from goo' if __name__ == '__main__': w2.foo() w2.py == import aaa.w1 as w1 def foo(): print 'entered foo' w1.goo() -- http://mail.python.org/mailman/listinfo/python-list
pychecker vs pychecker2
For my edification I was looking through the source code of pychecker. I noticed that there was also a pychecker2 directory (ubuntu). The pychecker command line tool points to pychecker (w/out the 2). Does anyone know off the top of their head what this second directory is about? thanks qhfgva -- http://mail.python.org/mailman/listinfo/python-list