#1633 closed defect (fixed)
Unable to display shapefile attribute table due to pipe characters in dbf field — at Version 5
Reported by: | richardc | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 6.4.3 |
Component: | wxGUI | Version: | svn-releasebranch64 |
Keywords: | database, separator | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description (last modified by )
Hi,
I'm receiving the following error on attempting to view the attribute table of shapefiles in GRASS 6.4.1.2 (on Ubuntu Lucid):
item = layer, log = self.goutput) File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py", line 653, in __init__ self.__createBrowsePage() File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py", line 698, in __createBrowsePage self.mapDBInfo, layer) File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py", line 95, in __init__ keyColumn = self.LoadData(layer) File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py", line 247, in LoadData self.AddDataRow(i, record, columns, keyId) File "/usr/lib/grass64/etc/wxpython/gui_modules/dbm.py", line 286, in AddDataRow if self.columns[columns[j]]['ctype'] != types.StringType: IndexError : list index out of range
Method: I import the shapefile as follows:
Layer Manager > File > Import vector data > Common import formats > Select ESRI shapefile > Browse and select file > Import
And then select the layer in 'Layer Manager', and click on the 'Show attribute table' icon. Then the error results
'Please wait loading attribute data..' with the following in the command console -
if self.columns[columns[j]]['ctype'] != types.StringType: IndexError : list index out of range
On closer inspection of the dbf file, some of the fields contain pipe (i.e., '|') characters. On removing these the attribute table can be displayed.
QGIS is able to display all data in the attribute table, including 'pipe' characters.
Example of problem fields in single column named 'VARNAME_1,C,150':
VARNAME_1,C,150
Bangkok|Krung Thep|Krung Thep Maha Nakhon|Phra Nakhon-Thonburi Buri Rum Chaxerngsao|Pad Rew|Paed Riu|Petrieu|Shajeun Dhrao Chainat Chantaburi|Muang Chan
NOTE: issue posted originally at http://osgeo-org.1560.n6.nabble.com/Index-error-Unable-to-show-attribute-table-of-shapefile-tp4678952p4678952.html
Change History (5)
follow-up: 2 comment:1 by , 12 years ago
Component: | Display → wxGUI |
---|---|
Keywords: | database separator added |
follow-up: 3 comment:2 by , 12 years ago
Replying to annakrat:
In GRASS 7 I added option to choose separator in GUI settings.
For the record: r52712
Instead of strange error during loading table, you should now get dialog which suggests you to change the separator. Could someone test it before backport?
Tested, it works almost well now, telling the user:
"Inconsistent number of columns in the table <vectorname>. Try to change field separator in GUI Settings, Attributes tab, Data browser section."
Perhaps it should then not reach the attribute manager window (since useless) but just return or close the attribute manager window?
comment:3 by , 12 years ago
Replying to neteler:
Perhaps it should then not reach the attribute manager window (since useless) but just return or close the attribute manager window?
It is easier just to remove the browse data page (it looks like the case when you have table with no data). Attribute manager can stay open because you can still want to change some other things related to table columns, connection. Done in r52730.
Anna
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 12 years ago
Description: | modified (diff) |
---|
In GRASS 7 I added option to choose separator in GUI settings. Instead of strange error during loading table, you should now get dialog which suggests you to change the separator. Could someone test it before backport?
Anna