erre-quadro / spikex

SpikeX - SpaCy Pipes for Knowledge Extraction
Apache License 2.0
398 stars 28 forks source link

Creating dewiki_core #11

Open Fetzii opened 2 years ago

Fetzii commented 2 years ago

Description

I tryed to create a german wikigraph and got a type error for the compression_wrapper()

What I Did

spikex create-wikigraph de_wiki_graph --wiki de --dumps-path de_wiki_dumps

Traceback (most recent call last):
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\Scripts\spikex.exe\__main__.py", line 7, in <module>
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\__main__.py", line 23, in main
    typer.run(commands[command])
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\typer\main.py", line 859, in run
    app()
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\typer\main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\typer\main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\cli\create.py", line 62, in create_wikigraph
    wg = WikiGraph.build(**kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\wikigraph\wikigraph.py", line 61, in build
    p, r, d, c, cl = _make_graph_components(**kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\wikigraph\wikigraph.py", line 278, in _make_graph_components
    pprops = _get_pprops(**kwargs)
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\wikigraph\wikigraph.py", line 316, in _get_pprops
    for pageid, prop, value in iter_pprops_data:
  File "C:\Users\Friedrich.Schmidt\Anaconda3\envs\ml\lib\site-packages\spikex\wikigraph\dumptools.py", line 211, in _parse_wiki_sql_dump
    ) as pbar, compression_wrapper(compress_obj, "rb") as decompress_obj:
TypeError: compression_wrapper() missing 1 required positional argument: 'compression'

Additonal Information

https://github.com/RaRe-Technologies/smart_open/blob/develop/smart_open/compression.py -> Line 106: def compression_wrapper(file_obj, mode, compression):

The current "compression_wrapper" function actually expects another argument called "compression", which is not passed at the moment: compression_wrapper(compress_obj, "rb")

I fixed the error locally by adding the missing argument: compression_wrapper(compress_obj, "rb", 'infer_from_extension')

paoloq commented 2 years ago

Thank you, @Fetzii! I should've set some bounds on the dependency. I'll do it asap, but before that, using smart_open < 5.0 is another solution I guess.