danioxoli / HotSpotAnalysis_Plugin

A QGIS plugin for hotspot analysis
GNU General Public License v3.0
55 stars 12 forks source link

EOL while scanning string literal #44

Open NateTillern opened 4 years ago

NateTillern commented 4 years ago

I appear to be receiving the same error in the same place as Davide does in his comment in the "Issue with HotSpot Analysis Plugin - no module named shapes".

However, I am unable to implement the workaround suggested, which was to comment out line 95 from this file: "C:\Program Files\QGIS 3.4\apps\Python37\Lib\site-packages\pysal\ init.py" Because my "site-packages" folder has no "pysal" folder in it, which I assume is an issue. However, I have followed the installation instructions multiple times (attempting with and without "--no-cache-dir") and OSGeo4W says pysal was successfully installed.

My coding experience is limited to conducting statistical analysis. So what's going on here, along with what needs to be done in the OSGeo4W shell, is beyond my comprehension. Since it says it's an end of line error I'm hoping that it's an easy fix, I just don't really know how to go about fixing it so any help is very appreciated!

The error appears as follows when I install the plugin within Qgis: (interestingly if I reinstall it the error doesn't pop up, but there also is no button for the plugin in my plugin taskbar, if I uninstall it and then install it again the same error occurs)

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

SyntaxError: EOL while scanning string literal Traceback (most recent call last): File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis__init.py", line 34, in classFactory from .hotspot_analysis import HotspotAnalysis File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 38, in import pysal File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal__init__.py", line 95, in import pysal.spreg File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal\spreg\init.py", line 1, in from .ols import * File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal\spreg\ols.py", line 7, in from . import user_output as USER File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal\spreg\user_output.py", line 9, in from . import diagnostics File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal\spreg\diagnostics.py", line 12, in from .utils import spmultiply, sphstack, spmin, spmax File "D:/Program Files/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users\clark\AppData\Roaming\Python\Python37\site-packages\pysal\spreg\utils.py", line 10 author__ = "Luc Anselin luc.anselin@asu.edu, \ ^ SyntaxError: EOL while scanning string literal

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.10.2-A Coruña A Coruña, d4cd3cfe5a

Python Path: C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ClusterPoints D:/Program Files/apps/qgis/./python C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins D:/Program Files/apps/qgis/./python/plugins D:\Program Files\apps\Python37 D:\Program Files\apps\Python37\Scripts D:\Program Files\bin\python37.zip D:\Program Files\apps\Python37\DLLs D:\Program Files\apps\Python37\lib D:\Program Files\bin C:\Users\clark\AppData\Roaming\Python\Python37\site-packages D:\Program Files\apps\Python37\lib\site-packages D:\Program Files\apps\Python37\lib\site-packages\win32 D:\Program Files\apps\Python37\lib\site-packages\win32\lib D:\Program Files\apps\Python37\lib\site-packages\Pythonwin C:/Users/clark/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/clark/Qgis_Stuff/Spatial Testing

danioxoli commented 4 years ago

Dear,

This is a recurring problem using Windows which does not recognize some text characters in that particular script (pysal.spreg).

A workaround was identified in issue #15 (have a look) Actually there we solved by opening this script in a text editor as Admin:

"C:\Program Files\QGIS 3.4\apps\Python37\Lib\site-packages\pysal\ init .py"

and comment line 95, like:

# import pysal.spreg

This should solve your issue!

Best,

Daniele