3liz / QuickOSM

QGIS plugin to fetch OSM data with the Overpass API
GNU General Public License v2.0
184 stars 55 forks source link

FileExistsError at installation #418

Open jvdkwast opened 2 years ago

jvdkwast commented 2 years ago

What is the bug?

When I install QuickOSM from the Plugins Manager in QGIS 3.26 on Windows I get a FileExistsError. This bug was reproduced on a laptop of another user.

Couldn't load plugin 'QuickOSM' due to an error when calling its classFactory() method 

FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\Users\\hansa\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\QuickOSMTest\\python\\plugins\\QuickOSM\\resources\\i18n\\preset_cs-rCZ.po' -> 'C:\\Users\\hansa\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\QuickOSMTest\\python\\plugins\\QuickOSM\\resources\\i18n\\preset_cs_CZ.po' 
Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python/plugins\QuickOSM\__init__.py", line 12, in classFactory
    return QuickOSMPlugin(iface)
  File "C:\Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python/plugins\QuickOSM\quick_osm.py", line 74, in __init__
    self.extract_zip_file()
  File "C:\Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python/plugins\QuickOSM\quick_osm.py", line 123, in extract_zip_file
    os.rename(file_path, new_file_path)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\Users\\hansa\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\QuickOSMTest\\python\\plugins\\QuickOSM\\resources\\i18n\\preset_cs-rCZ.po' -> 'C:\\Users\\hansa\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\QuickOSMTest\\python\\plugins\\QuickOSM\\resources\\i18n\\preset_cs_CZ.po'

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] 
QGIS version: 3.26.2-Buenos Aires Buenos Aires, feec3d3b12f 

Python Path:
C:/OSGeo4W/apps/qgis/./python
C:/Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python
C:/Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python/plugins
C:/OSGeo4W/apps/qgis/./python/plugins
C:\OSGeo4W\bin\python39.zip
C:\OSGeo4W\apps\Python39\DLLs
C:\OSGeo4W\apps\Python39\lib
C:\OSGeo4W\bin
C:\OSGeo4W\apps\Python39
C:\OSGeo4W\apps\Python39\lib\site-packages
C:\OSGeo4W\apps\Python39\lib\site-packages\win32
C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib
C:\OSGeo4W\apps\Python39\lib\site-packages\Pythonwin
C:/Users/hansa/AppData/Roaming/QGIS/QGIS3\profiles\QuickOSMTest/python

Environment

jvdkwast commented 2 years ago

The same happens on QGIS 3.22.10.

Gustry commented 2 years ago

Temporary fixed, but I want to keep the ticket open to clean a little bit the code. Commit b43c05dfaf93a34839e89cd13e722da56f1b7e63