On Jan 19, 2010, at 7:25 , Роман Донченко wrote: >> On Mon, 2010-01-18 at 20:12 -0600, Daniel Eggert wrote: >>> I've been trying to use python to use Subversion’s Remote Access library, >>> but it crashes. >>> >>> >>> >>> #!/usr/bin/python >>> >>> import os >>> import svn >>> import svn.ra >>> import svn.client >>> import svn.core >>> >>> svn.ra.initialize() >>> >>> >>> class Callbacks(svn.ra.Callbacks): >>> def __init__(self): >>> self.auth_baton = svn.core.svn_auth_open([ >>> svn.client.get_simple_provider(), >>> svn.client.get_username_provider(), >>> ]) >>> svn.core.svn_auth_set_parameter(self.auth_baton, >>> >>> svn.core.SVN_AUTH_PARAM_DEFAULT_USERNAME, >>> "eggert") >>> svn.core.svn_auth_set_parameter(self.auth_baton, >>> >>> svn.core.SVN_AUTH_PARAM_DEFAULT_PASSWORD, >>> "aaa") >>> def open_tmp_file(self, pool): >>> path = '/tmp/' >>> (fd, fn) = tempfile.mkstemp(dir=path) >>> os.close(fd) >>> return fn >>> def cancel_func(self): >>> if False: >>> return svn.core.SVN_ERR_CANCELLED >>> return 0 >>> >>> c = Callbacks() >>> svn.ra.open2("http:/svn.example.com/svn", c, {}) >>> >>> >>> >>> My backtace looks like this: >>> >>> 0 ??? 0x00000001005390f0 0 + 4300443888 >>> 1 libapr-1.0.dylib 0x000000010110cde5 apr_hash_get + 11 >>> 2 libsvn_ra-1.0.dylib 0x00000001001f4d8f svn_ra_open3 + 186 >>> 3 libsvn_ra-1.0.dylib 0x00000001001f3572 svn_ra_open2 + 28 >>> 4 _ra.so 0x0000000100735b61 0x100730000 + 23393 >>> 5 org.python.python 0x000000010000b173 PyObject_Call + 112 >>> 6 org.python.python 0x0000000100084b6f >>> PyEval_CallObjectWithKeywords + 175 >>> 7 org.python.python 0x0000000100083a9e _PyBuiltin_Init + 14071 >>> 8 org.python.python 0x00000001000891df PyEval_EvalFrameEx + 15001 >>> 9 org.python.python 0x000000010008accf PyEval_EvalCodeEx + 1803 >>> 10 org.python.python 0x00000001000893aa PyEval_EvalFrameEx + 15460 >>> 11 org.python.python 0x000000010008accf PyEval_EvalCodeEx + 1803 >>> 12 org.python.python 0x000000010008ad62 PyEval_EvalCode + 54 >>> 13 org.python.python 0x00000001000a265a Py_CompileString + 78 >>> 14 org.python.python 0x00000001000a2723 PyRun_FileExFlags + 150 >>> 15 org.python.python 0x00000001000a423d PyRun_SimpleFileExFlags + 704 >>> 16 org.python.python 0x00000001000b0286 Py_Main + 2718 >>> 17 org.python.python.app 0x0000000100000e6c start + 52 >>> >>> >>> What am I doing wrong? >>> >>> /Daniel >>> > > The config argument isn't passed to the C API correctly ATM... you can use a > NULL config if that's enough for your needs: > > svn.ra.open2("http://svn.example.com/svn", c, None) > > Roman (who didn't get the original mail because of the Gmane mishap).
Thanks. That works. Should I file a bug about that not working? I got svn.ra.open2() and svn.ra.get_dir() working, but I'm unable to make the receiver/baton part of l = svn.ra.get_log2(session, None, 1, 4, 0, False, False, [], receiver, None) work. The receiver is supposed to be a svn_log_entry_receiver_t. I tried to do def receiver(baton, entry): print entry but I get TypeError: argument number 8: How does swig wrap svn_log_entry_receiver_t? I have not been able to find any python sample code that uses svn.ra. /Daniel
smime.p7s
Description: S/MIME cryptographic signature