deedy5 / duckduckgo_search

Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
MIT License
937 stars 117 forks source link

File write errors out when slash is present in query keywords #44

Closed bk521234 closed 1 year ago

bk521234 commented 1 year ago

File write errors out when slash is present in query keywords.

Stack trace of error when package is pip install'ed:

    results = ddg(
  File "/path/.venv/lib/python3.9/site-packages/duckduckgo_search/ddg.py", line 116, in ddg
    _do_output("ddg", keywords, output, results)
  File "/path/.venv/lib/python3.9/site-packages/duckduckgo_search/utils.py", line 111, in _do_output
    _save_json(
  File "/path/.venv/lib/python3.9/site-packages/duckduckgo_search/utils.py", line 70, in _save_json
    with open(jsonfile, "w") as file:
FileNotFoundError: [Errno 2] No such file or directory: 'george washington site:"wikipedia.com/wiki/"_20230322_085645.json'
deedy5 commented 1 year ago

Fixed in https://github.com/deedy5/duckduckgo_search/pull/50. Please update to v2.8.6