damnever / pigar

:coffee: A tool to generate requirements.txt for Python project, and more than that. (IT IS NOT A PACKAGE MANAGEMENT TOOL)

Home Page:https://damnever.github.io/pigar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pigar won't run unless an unrelated directory exists

jackpot-nfer opened this issue · comments

This problem has persisted even after uninstalling and reinstalling pigar.

The (slightly modified) output is below, when running pigar from my_project root.

$ python -m pigar -p requirements.txt -P my_project
Traceback (most recent call last):
  File "/Users/redacted/.pyenv/versions/3.8.6/bin/pigar", line 8, in <module>
    sys.exit(main())
  File "/Users/redacted/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pigar/__main__.py", line 167, in main
    RequirementsGenerator(
  File "/Users/redacted/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pigar/core.py", line 66, in generate
    self._package_root, self._ignores, self.installed_pkgs
  File "/Users/redacted/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pigar/core.py", line 61, in installed_pkgs
    self._installed_pkgs = parse_installed_packages()
  File "/Users/redacted/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pigar/parser.py", line 265, in parse_installed_packages
    mapping.update(_search_path(path))
  File "/Users/redacted/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pigar/parser.py", line 305, in _search_path
    _file for _file in os.listdir(dev_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/redacted/redacted/another-repo'

I don't even know if I used it on another-repo. If I make an empty directory called another-repo in the desired path, it runs as desired, but obviously it's weird to have to keep an empty directory just sitting around.

If it matters, another-repo and my_project are sibling directories. This problem also persists across all of my projects, anywhere on my computer, not just this one case.

I have exactly the same problem.

Maybe because you have installed another-repo before?

What does this output?

python -c 'import sys, os;[list(map(lambda x: print(os.path.join(path, x)), os.listdir(path))) for path in sys.path if (os.path.isdir(path) and path.endswith(("site-packages", "dist-packages")))]' | grep 'link'

Checkout this version:

pip install git+https://github.com/damnever/pigar.git@main --upgrade