src-d / tmsc

Other
21 stars 9 forks source link

Use enry if it's already installed in PATH #3

Open bzz opened 7 years ago

bzz commented 7 years ago

Right now, after clean clone and installing all requirements

virtualenv -p python3 .venv
source .venv/bin/activate
git clone git@github.com:src-d/tmsc.git
cd tmsc
pip install -r requirements.txt

Run command python -m tmsc https://github.com/apache/spark results in

Number of documents: 112273
WARNING:topic_detector:No BOW cache was loaded.
Traceback (most recent call last):
  File "/<>/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/<>/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/<>/tmsc/tmsc/__main__.py", line 71, in <module>
    sys.exit(main())
  File "/<>/tmsc/tmsc/__main__.py", line 61, in main
    "timeout": args.timeout})
  File "<>/tmsc/tmsc/topic_detector.py", line 77, in __init__
    **(repo2bow_kwargs or {}))
  File "/<>/tmsc/tmsc/topic_detector.py", line 21, in __init__
    super().__init__(**kwargs)
  File "/<>/tmsc/.venv/lib/python3.6/site-packages/ast2vec/repo2/base.py", line 71, in __init__
    self._cloner.find_linguist(linguist)
  File "/<>/tmsc/.venv/lib/python3.6/site-packages/ast2vec/cloning.py", line 167, in find_linguist
    linguist)
FileNotFoundError: ./enry was not found. Install it: python3 -m ast2vec enry

Although latest Enry binary is available in the PATH


$ enry                                                                                                           
14.29%  Dockerfile
14.29%  Text
71.43%  Python
``
bzz commented 7 years ago

Quick search of ./enry reveals the --linguist flag.

Will re-try with python -m tmsc --linguist enry https://github.com/apache/spark

bzz commented 7 years ago

--linguist solves the issue.

Although it would still be nice to auto-detect enry binary in PATH by default

vmarkovtsev commented 7 years ago

Thanks for reporting, it should indeed be detected from PATH, looks like a defaults flaw in ast2vec.