afourmy / pyNMS

A vendor-agnostic NMS for carrier-grade network simulation and automation
GNU General Public License v3.0
83 stars 15 forks source link

Shapefiles issue #22

Open devnullNZ opened 7 years ago

devnullNZ commented 7 years ago

Start fails with shapefile error - File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 291, in load raise ShapefileException("Unable to open %s.dbf or %s.shp." % (shapeName, shapeName) ) shapefile.ShapefileException: Unable to open /home/e069390/Projects/pyNMS/Shapefiles/World countries (low resolution).dbf or /home/e069390/Projects/pyNMS/Shapefiles/World countries (low resolution).shp

Shapefiles dir contains no .dbf files, only .shp

Edited pyNMS/views/geographical_view.py to use a different shapefile set & it works fine, so definitely an issue with either missing or corrupt files

afourmy commented 7 years ago

Well that's strange, /pyNMS/Shapefiles does contain a 'World countries (low resolution).shp' file. (.dbf files are not needed, only .shp) I only have windows right now, and I see you're using linux, that may be the reason why. I'll test on linux and try to fix it. Thanks for reporting the bug !

devnullNZ commented 7 years ago

Renamed file & tested importing directly. Looks like the .shp file is the issue:

import shapefile sf = shapefile.Reader("./wc_lowres.shp") Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 237, in init self.load(args[0]) File "/usr/local/lib/python3.5/dist-packages/shapefile.py", line 291, in load raise ShapefileException("Unable to open %s.dbf or %s.shp." % (shapeName, shapeName) ) shapefile.ShapefileException: Unable to open ./wc_lowres.dbf or ./wc_lowres.shp.

afourmy commented 7 years ago

I see, thank you. I will try to reproduce it. In the meantime, I will deactivate the display of a map by default, so that it does not prevent pyNMS from running (and pyshp, shapely and pyproj will no longer be compulsory, which is also a good thing).

afourmy commented 7 years ago

The 'World countries (low resolution).shp' shapefile is no longer imported at running time. A new entry was added to the toolbar (globe icon) for the user to import shapefiles. pyshp and shapely are no longer mandatory to run pyNMS, only pyproj is, as the geographical system (display of nodes at their GPS coordinates) remains active. This should fix the problem for now, until I have a unix system to reproduce the bug as I suspect this might have something to do with the way filepaths are handled on unix.