PratyushTripathy / COINS

This repository contains the source code of the COINS tool that allows to deduce natural continuity of street network.
MIT License
21 stars 2 forks source link

Error in executing the python code: "IndexError: pop from empty list" #4

Open MagnoliaChampaca opened 3 years ago

MagnoliaChampaca commented 3 years ago

At the last step of the process, when the output file is to be created after typing in the deflection angle threshold, the output is interrupted by an error in 'executing the python code'. The error reads: "IndexError: pop from empty list".

How can this be fixed?

PratyushTripathy commented 3 years ago

@MagnoliaChampaca could you please share the exact script that you are using and the file here?

OneDay48Hours commented 7 months ago

I have the same issue, any solution now?

The error is as follows:

An error has occurred while executing Python code:

IndexError: pop from empty list Traceback (most recent call last): File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/coins.py", line 231, in startProcessing self.processNetworkVector() File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/coins.py", line 243, in processNetworkVector myNetwork = network(inFile) File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/streetHierarchy.py", line 173, in init self.pythonPath = getPythonPath() File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/streetHierarchy.py", line 32, in getPythonPath path.pop() IndexError: pop from empty list

OneDay48Hours commented 7 months ago

I have the same issue, any solution now?

The error is as follows:

An error has occurred while executing Python code:

IndexError: pop from empty list Traceback (most recent call last): File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/coins.py", line 231, in startProcessing self.processNetworkVector() File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/coins.py", line 243, in processNetworkVector myNetwork = network(inFile) File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/streetHierarchy.py", line 173, in init self.pythonPath = getPythonPath() File "/Users/a/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/coins/streetHierarchy.py", line 32, in getPythonPath path.pop() IndexError: pop from empty list

Hi, I've found the reason for this error. This is due to the different path separators for different operating systems. In macOS, file paths use forward slashes / instead of backslashes . Therefore, just modify the code to accommodate the format of macOS file paths.

Here's the modified code: def getPythonPath(): path = os.file.split('/') path.pop() path.pop() path = '/'.join(path) return path

After making these changes, the code should run without error. However, it continues to spin indefinitely without producing any results after clicking "Run", there may be another issue that needs to be investigated.