damnever / pigar

:coffee: A tool to generate requirements.txt for Python project, and more than that. (IT IS NOT A PACKAGE MANAGEMENT TOOL)
https://damnever.github.io/pigar/
BSD 3-Clause "New" or "Revised" License
1.61k stars 90 forks source link

In Windows, 'os.rename' raises FileExistsError for overwrite #175

Closed laoraid closed 10 months ago

laoraid commented 10 months ago

Describe the bug Visit https://docs.python.org/3/library/os.html#os.rename Overwriting files in Windows raises FileExistsError.(__main__.py line 326) According to the document, I think it would be better to use replace() for cross-platform.

To Reproduce Steps to reproduce the behavior:

  1. Setup directories and files in windows
  2. Install pigar..
  3. Run pigar..
  4. See error..

Expected behavior Overwrite requirements.txt.

Context (Environment)

damnever commented 10 months ago

Thank you for the report. Could you provide a detailed traceback? We would greatly appreciate if you could submit a Pull Request to directly address this issue.

damnever commented 10 months ago

Oh.. I see, did you mean this line?

https://github.com/damnever/pigar/blob/3fd8f22865e5c2902dea82ab06d6427fcf22c031/pigar/__main__.py#L326