[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libextractor] Python: libextractor
From: |
Karsten Hilbert |
Subject: |
[libextractor] Python: libextractor |
Date: |
Sun, 7 May 2006 21:40:41 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
Hallo Christian,
ich muß mal eine dumme Frage stellen: Wie nutze ich
libextractor aus Python ? Hintergrund ist folgender. Die
Dokumentation im Netz ist extrem spärlich:
"Python programmers will find that libextractor (since
0.5.0) can also be used from Python, just import Extractor."
Aber ich kann nicht rausfinden, wie es funktoniert:
#---------------------------
Script started on So 07 Mai 2006 21:14:08 CEST
merkur:~# python
Python 2.3.5 (#2, Mar 6 2006, 10:12:24)
[GCC 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Extractor
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named Extractor
>>> import extractor
>>> dir(extractor)
['Module', 'ModuleList', '__doc__', '__file__', '__name__']
>>> extractor.__doc__
'Extractor module.'
>>> extractor.__file__
'/usr/lib/python2.3/site-packages/extractor.so'
>>> extractor.__name__
'extractor'
>>> dir(extractor.Module)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__']
>>> extractor.Module.__doc__
'Module objects'
>>> str(extractor.Module)
"<type 'extractor.Module'>"
>>> str(extractor.Module())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __new__() takes at least 1 argument (0 given)
>>> repr(extractor.Module)
"<type 'extractor.Module'>"
>>> repr(extractor.Module())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __new__() takes at least 1 argument (0 given)
>>> dir(extractor.ModuleList)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', 'append', 'prepend']
>>> extractor.ModuleList.__doc__
"<type 'extractor.ModuleList'>"
>>> str(extractor.ModuleList())
'<ModuleList: 30 modules>'
>>> print extractor.ModuleList()
<ModuleList: 30 modules>
>>> print extractor.ModuleList()[0]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsubscriptable object
>>> print extractor.ModuleList().keys()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'extractor.ModuleList' object has no attribute 'keys'
>>> dir(print extractor.ModuleList())
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', 'append', 'prepend']
>>> repr(extractor.ModuleList())
'<ModuleList: 30 modules>'
>>> print "now what ?"
now what ?
Script done on So 07 Mai 2006 21:18:09 CEST
#---------------------------
Hier ist die Umgebung:
Debian Etch
Linux merkur 2.6.15-1-k7 #2 Mon Mar 6 15:42:39 UTC 2006 i686 GNU/Linux
libextractor-python:
Installiert:0.5.4+2496-1
Mögliche Pakete:0.5.4+2496-1
Versions-Tabelle:
*** 0.5.4+2496-1 0
990 ftp://ftp.gwdg.de testing/main Packages
100 /var/lib/dpkg/status
#---------------------------
Vielen Dank,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libextractor] Python: libextractor,
Karsten Hilbert <=