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

Rename doesn't replace on Windows #103

Closed
martin-ueding opened this issue Mar 2, 2024 · 2 comments
Closed

Rename doesn't replace on Windows #103

martin-ueding opened this issue Mar 2, 2024 · 2 comments
Labels
type: bug Something isn't working
Milestone

Comments

@martin-ueding
Copy link
Owner

On Windows one cannot use os.rename to overwrite a file:

  File "C:\Users\$USER\geo-activity-playground\geo_activity_playground\__main__.py", line 118, in make_activity_repository
    precompute_activity_distances(repository)
  File "C:\Users\$USER\geo-activity-playground\geo_activity_playground\core\similarity.py", line 29, in precompute_activity_distances
    with stored_object(fingerprint_path, {}) as fingerprints, stored_object(
  File "C:\Users\$USER\.conda\envs\geo-activity-playground\Lib\contextlib.py", line 144, in __exit__
    next(self.gen)
  File "C:\Users\$USER\geo-activity-playground\geo_activity_playground\core\tasks.py", line 30, in stored_object
    temp_location.rename(path)
  File "C:\Users\$USER\.conda\envs\geo-activity-playground\Lib\pathlib.py", line 1175, in rename
    os.rename(self, target)
FileExistsError: [WinError 183] Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist: 'Cache\\activity_distances.tmp' -> 'Cache\\activity_distances.pickle'    
@martin-ueding martin-ueding added the type: bug Something isn't working label Mar 2, 2024
@martin-ueding martin-ueding added this to the 0.20.0 milestone Mar 2, 2024
martin-ueding added a commit that referenced this issue Mar 2, 2024
@martin-ueding
Copy link
Owner Author

I just delete the old file before, this should fix it.

@martin-ueding
Copy link
Owner Author

Version 0.20.0 is released you can update and try it out. If the issue persists, please reopen this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant