Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapefiles issue #22

Open
devnullNZ opened this issue Sep 19, 2017 · 4 comments
Open

Shapefiles issue #22

devnullNZ opened this issue Sep 19, 2017 · 4 comments
Labels

Comments

@devnullNZ
Copy link

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
Copy link
Owner

afourmy commented Sep 19, 2017

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 !

@afourmy afourmy added the bug label Sep 19, 2017
@devnullNZ
Copy link
Author

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
Copy link
Owner

afourmy commented Sep 19, 2017

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
Copy link
Owner

afourmy commented Sep 19, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants