Page MenuHomeDevCentral

merge-dictionaries on macOS can't use temporary folder
Open, Needs TriagePublic

Description

When running git clone, we immediately have an error of Git:
fatal: Unable to read current working directory: No such file or directory

Full output:

$ merge-dictionaries --extract
Cloning into '/var/folders/nm/f7jxcvws0y7dywqsj60l_z480000gp/T/merge-dictionaries-tpey0lg6'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (13/13), done.
fatal: Unable to read current working directory: No such file or directory
fatal: fetch-pack: invalid index-pack output
Traceback (most recent call last):
  File "/usr/local/bin/merge-dictionaries", line 17, in <module>
    app.run()
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 173, in run
    app.run()
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 106, in run
    self.run_extract_all_words(args.format)
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 145, in run_extract_all_words
    words = self.extract_all_words()
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 141, in extract_all_words
    {word for method in self.get_words_sources() for word in method()}
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 141, in <setcomp>
    {word for method in self.get_words_sources() for word in method()}
  File "/Library/Python/3.9/site-packages/mergedictionaries/app/app.py", line 132, in <lambda>
    lambda: sources.git.extract_words_from_all_dictionaries(
  File "/Library/Python/3.9/site-packages/mergedictionaries/sources/git.py", line 145, in extract_words_from_all_dictionaries
    return {
  File "/Library/Python/3.9/site-packages/mergedictionaries/sources/git.py", line 148, in <setcomp>
    for word in GitRepository(repo, cached_repos).extract_words()
  File "/Library/Python/3.9/site-packages/mergedictionaries/sources/git.py", line 48, in extract_words
    return [word.strip() for word in open(self.get_dictionary_path())]
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/nm/f7jxcvws0y7dywqsj60l_z480000gp/T/merge-dictionaries-tpey0lg6/dictionary.txt'

(the second error is not relevant, if the repository hasn't been clone, of course any file in that repo doesn't exist)