Giter Club home page Giter Club logo

cambridge's People

Contributors

mhwgoo avatar migcosta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cambridge's Issues

Webster doesn't work

camb -wf hello
2022-11-14 10:29:27 ERROR webster.py[152] The fetched result is not what we intended for the word due to the network or website reasons, please try again.

Fail in case of word not found

Current in case the word is not found, cambridge asks the user to select a similar word that is present in the dictionary.

I'm basic building a GUI around cambridge, and I need it to fail and return exit code != 0 in case the word is not found, without asking the user.

Otherwise my GUI will hang waiting for cambridge to exit.

key error?

C:\Users\abc>camb commit
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Python39\Scripts\camb.exe_main
.py", line 4, in
File "c:\python39\lib\site-packages\cambridge\cambridge.py", line 512, in
from .log import logger
File "c:\python39\lib\site-packages\cambridge\log.py", line 11, in
data = Path(os.environ["HOME"]).absolute() / ".local" / "share" / "cambridge"
File "c:\python39\lib\os.py", line 679, in getitem
raise KeyError(key) from None
KeyError: 'HOME'

Doesn't work

I have latest pypi version 3.5.9:

❯ camb remit
2022-12-12 22:45:49 ERROR user_agent.py[70] Nothing parsed out
2022-12-12 22:45:49 ERROR base_events.py[1747] Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at /home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py:186> exception=SystemExit()>
Traceback (most recent call last):
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/main.py", line 17, in main
    args.func(args, con, cur)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/args.py", line 243, in search_word
    cambridge.search_cambridge(con, cur, input_word, is_fresh, is_ch)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/dicts/cambridge.py", line 40, in search_cambridge
    fresh_run(con, cur, req_url, input_word, is_ch)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/dicts/cambridge.py", line 75, in fresh_run
    result = fetch_cambridge(req_url, input_word, is_ch)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/dicts/cambridge.py", line 50, in fetch_cambridge
    res = dict.fetch(req_url, session)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/cambridge/dicts/dict.py", line 20, in fetch
    ua = user_agent()
  File "/home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py", line 250, in user_agent
    return asyncio.run(main(browser, use_cache))
  File "/usr/lib/python3.10/asyncio/runners.py", line 47, in run
    _cancel_all_tasks(loop)
  File "/usr/lib/python3.10/asyncio/runners.py", line 63, in _cancel_all_tasks
    loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1899, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py", line 211, in main
    await asyncio.gather(*tasks)
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1899, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py", line 103, in write_to_dict
    versions = await parse(browser, session)
  File "/home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py", line 92, in parse
    attempt = call_on_error(ValueError("Nothing parsed out"), url, attempt, OP[1])
  File "/home/USERNAME/.local/lib/python3.10/site-packages/fake_user_agent/user_agent.py", line 71, in call_on_error
    sys.exit()
SystemExit

Cannot import fake user agent

[XXX@XXX Downloads]$ camb hello
Traceback (most recent call last):
  File "/home/XXX/.local/bin/camb", line 5, in <module>
    from cambridge.main import main
  File "/home/XXX/.local/lib/python3.10/site-packages/cambridge/main.py", line 16, in <module>
    from .args import parse_args
  File "/home/XXX/.local/lib/python3.10/site-packages/cambridge/args.py", line 15, in <module>
    from .dicts import webster, cambridge
  File "/home/XXX/.local/lib/python3.10/site-packages/cambridge/dicts/webster.py", line 12, in <module>
    from ..dicts import dict
  File "/home/XXX/.local/lib/python3.10/site-packages/cambridge/dicts/dict.py", line 6, in <module>
    from fake_user_agent import user_agent
ImportError: cannot import name 'user_agent' from 'fake_user_agent' (/home/XXX/.local/lib/python3.10/site-packages/fake_user_agent/__init__.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.