[PyKDE] buggy api crash gen_python_api_20050605
Laurent Dufréchou
laurent.dufrechou at free.fr
Fri Jul 14 00:14:14 BST 2006
Hello I've started gen_python_api.py script.
All is being processed well until svn library processing.
When it imports svn.client this library seems to contain a function
'import'!
Here is my little test on this api:
Python 2.4.3 (#1, Jul 6 2006, 00:11:26)
[GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import svn.client
>>> svn.client.__dict__['import']
<function svn_client_import at 0xb7526764>
>>> svn.client.import.__doc__
File "<stdin>", line 1
svn.client.import.__doc__
^
SyntaxError: invalid syntax
>>>
If I launch gen_python_api.py I've got this error:
processing /usr/lib/python2.4/site-packages/NumTut
NumTut : importing ... exceptions.ImportError
NumTut.mkpic : importing ... exceptions.ImportError
NumTut.testview : importing ... exceptions.ImportError
NumTut.view : importing ... exceptions.ImportError
-done with /usr/lib/python2.4/site-packages/NumTut
processing /usr/lib/python2.4/site-packages/svn
svn.client : importing ... ok, processing ...
Traceback (most recent call last):
File "gen_python_api.py", line 288, in ?
processFolder(folder)
File "gen_python_api.py", line 223, in processFolder
processFolder(folder + os.sep + entry, prefix=prefix+entry+'.')
File "gen_python_api.py", line 244, in processFolder
processModule(module, file)
File "gen_python_api.py", line 152, in processModule
processName(entryprefix, module + '.', name, ns)
File "gen_python_api.py", line 93, in processName
exec 'hasdoc = hasattr(' + moduleprefix + name + ', "__doc__")' in ns
File "<string>", line 1
hasdoc = hasattr(svn.client.import, "__doc__")
^
SyntaxError: invalid syntax
Can you help me create a (good) patch to avoid this type of error?
(perhaps using a list of python keywords from python 2.4.3 help() )
['and','else','import','raise','assert','except','in','return','break','exec',
'is','try','class','finally','lambda','while','continue','for','not','yield','def','from','or','del','global','pass',
'elif','if','print'] ?
Regards,
Laurent
More information about the PyQt
mailing list