无法 运行 Whoosh 'quickstart' 示例 (FileNotFoundError)
Cannot run Whoosh 'quickstart' example (FileNotFoundError)
我刚刚尝试 运行 https://whoosh.readthedocs.io/en/latest/quickstart.html#a-quick-introduction
中的示例
cedricvr@atlantis94:~/repos/bibworm$ python3
Python 3.5.2 (default, Jul 5 2016, 12:43:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whoosh.index import create_in
>>> from whoosh.fields import *
>>> schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
>>> ix = create_in("indexdir", schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 102, in create_in
return FileIndex.create(storage, schema, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 425, in create
TOC.create(storage, schema, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 611, in create
toc.write(storage, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 676, in write
stream = storage.create_file(tempfilename)
File "/usr/local/lib/python3.5/dist-packages/whoosh/filedb/filestore.py", line 490, in create_file
fileobj = open(path, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/cedricvr/repos/bibworm/indexdir/_MAIN_0.toc.1469630628.6353247'
我有 Whoosh 版本:2.7.4
愚蠢的我:你必须mkdir
之前的目录:
import os
os.mkdir('indexdir')
我刚刚尝试 运行 https://whoosh.readthedocs.io/en/latest/quickstart.html#a-quick-introduction
中的示例cedricvr@atlantis94:~/repos/bibworm$ python3
Python 3.5.2 (default, Jul 5 2016, 12:43:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from whoosh.index import create_in
>>> from whoosh.fields import *
>>> schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
>>> ix = create_in("indexdir", schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 102, in create_in
return FileIndex.create(storage, schema, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 425, in create
TOC.create(storage, schema, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 611, in create
toc.write(storage, indexname)
File "/usr/local/lib/python3.5/dist-packages/whoosh/index.py", line 676, in write
stream = storage.create_file(tempfilename)
File "/usr/local/lib/python3.5/dist-packages/whoosh/filedb/filestore.py", line 490, in create_file
fileobj = open(path, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/cedricvr/repos/bibworm/indexdir/_MAIN_0.toc.1469630628.6353247'
我有 Whoosh 版本:2.7.4
愚蠢的我:你必须mkdir
之前的目录:
import os
os.mkdir('indexdir')