semiautomaticgit / SemiAutomaticClassificationPlugin

https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html
Other
136 stars 50 forks source link

AttributeError: module 'sys' has no attribute 'argv' #151

Closed abdulhafidz6 closed 2 years ago

abdulhafidz6 commented 3 years ago

Hi Luca, I just upgraded my SCP to 7.5.2 and got error while try to clip multiple bands. I wish this is not a duplicate issues. Thank you for your help.

An error has occurred while executing Python code:

AttributeError: module 'sys' has no attribute 'argv' Traceback (most recent call last): File "C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\clipmultiplerasters.py", line 82, in clipRastersAction self.clipRasters() File "C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\clipmultiplerasters.py", line 226, in clipRasters cfg.utls.GDALCopyRaster(vrtCheck, f, 'GTiff', cfg.rasterCompression, 'LZW') File "C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\core\utils.py", line 7034, in GDALCopyRaster cfg.pool = cfg.poolSCP(processes=1) File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\context.py", line 119, in Pool context=self.get_context()) File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\pool.py", line 176, in init self._repopulate_pool() File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\pool.py", line 241, in _repopulate_pool w.start() File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\OSGEO4~1\apps\Python37\lib\multiprocessing\spawn.py", line 163, in get_preparation_data sys_argv=sys.argv, AttributeError: module 'sys' has no attribute 'argv'

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.16.3-Hannover Hannover, 94ac9f21b8

Python Path: C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\network_gt C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\geometric_attributes C:/OSGEO4~1/apps/qgis/./python C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/OSGEO4~1/apps/qgis/./python/plugins C:\OSGEO4~1\apps\Python37 C:\OSGEO4~1\apps\Python37\Scripts C:\OSGeo4W64\bin\python37.zip C:\OSGEO4~1\apps\Python37\DLLs C:\OSGEO4~1\apps\Python37\lib C:\OSGeo4W64\bin C:\Users\hp\AppData\Roaming\Python\Python37\site-packages C:\OSGEO4~1\apps\Python37\lib\site-packages C:\OSGEO4~1\apps\Python37\lib\site-packages\win32 C:\OSGEO4~1\apps\Python37\lib\site-packages\win32\lib C:\OSGEO4~1\apps\Python37\lib\site-packages\Pythonwin C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\hp\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\GeoTrace\tools C:\Users\hp\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\HCMGIS/forms C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64 C:/Users/hp/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\rvt-qgis

abdulhafidz6 commented 3 years ago

Hi again.. I think I have resolved my issue. I followed this suggestion https://github.com/googleapis/oauth2client/issues/642#issuecomment-279643203

I modify import sys

into

import sys if not hasattr(sys, 'argv'): sys.argv = ['']

image

semiautomaticgit commented 3 years ago

Thank you for your feedback. I think is a strange issue, possibly it is related to the OSGEO installation

abdulhafidz6 commented 3 years ago

Thank you for your response. Previously I install my QGIS through standalone installer since version 3.4 - 3.12. I face this issue in version 3.10. Made a clean uninstall and tried network installer for 3.10 and 3.16 but still occur for both versions. It is solved after I tried the suggestion above.

semiautomaticgit commented 2 years ago

Thank you for your feedback. I'm closing this, but feel free to reopen if you still get he same issue.