Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pigar won't run unless an unrelated directory exists #99

Closed
jackpot-nfer opened this issue Nov 29, 2021 · 4 comments
Closed

Pigar won't run unless an unrelated directory exists #99

jackpot-nfer opened this issue Nov 29, 2021 · 4 comments
Labels

Comments

@jackpot-nfer
Copy link

jackpot-nfer commented Nov 29, 2021

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.

@JorgeMiguelGomes
Copy link

I have exactly the same problem.

@thiswillbeyourgithub
Copy link

Same here

@damnever
Copy link
Owner

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'

@damnever
Copy link
Owner

Checkout this version:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants